LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 917|回复: 1

【原创】把Fedora core 6(fc 6)直接升级为CentOS 5

[复制链接]
发表于 2008-4-22 21:06:41 | 显示全部楼层 |阅读模式
为了搭建moodle平台,安装一个LAMP环境。本来要用centos 5,但是没有安装光盘,只有DVD 的iso文件,又赶时间来不及做网络安装或者硬盘安装。正好手里有个FC6的DVD光盘,于是先用FC6临时顶一下。顶过去之后,毕竟版本老了,没有快的升级源,还是想改回centos 5,又不想备份数据重装,于是准备从FC6直接升级为centos 5。
早期有台电脑出于测试的目的,也安装了FC6,正好拿它做试验,成功了再到moodle服务器上面去应用。

先在网上找了一些资料,网址:http://www.linuxidc.com/Linux/2008-01/10562.htm

根据提示,先卸载fc6的yum相关软件:

[root@localhost yum.repos.d]# rpm -qa|grep yum
yum-updatesd-3.0-6
yum-metadata-parser-1.0-8.fc6
yum-3.0-6
[root@localhost yum.repos.d]# rpm -e yum
error: Failed dependencies:
        yum = 3.0-6 is needed by (installed) yum-updatesd-3.0-6.noarch
        yum >= 2.9.5 is needed by (installed) pirut-1.2.5-1.noarch
[root@localhost yum.repos.d]# rpm -e yum-updatesd
[root@localhost yum.repos.d]# rpm -e yum-metadata-parser
error: Failed dependencies:
        yum-metadata-parser is needed by (installed) yum-3.0-6.noarch
[root@localhost yum.repos.d]# rpm -e yum
error: Failed dependencies:
        yum >= 2.9.5 is needed by (installed) pirut-1.2.5-1.noarch
[root@localhost yum.repos.d]# rpm -e pirut
[root@localhost yum.repos.d]# rpm -e yum
[root@localhost yum.repos.d]# rpm -e yum-metadata-parser
[root@localhost yum.repos.d]# rpm -qa|grep yum

然后下载cent 5的yum相关软件,这里的IP是我内部服务器上面已经有的cent 5 DVD 的iso文件解开的。

[root@localhost lsg]# lftp 192.168.1.243
lftp 192.168.1.243:~> cd pub/cent5/CentOS/
cd 成功, 当前目录=/pub/cent5/CentOS
lftp 192.168.1.243:/pub/cent5/CentOS> mget yum*
538120 bytes transferred                        
Total 4 files transferred
lftp 192.168.1.243:/pub/cent5/CentOS> by
[root@localhost lsg]# ll
总计 552
drwxr-xr-x 2 lsg  lsg    4096 02-20 15:59 Desktop
-rw-r--r-- 1 lsg  lsg    2141 02-20 17:58 tttt
-rw-r--r-- 1 root root 492832 2007-04-04 yum-3.0.5-1.el5.centos.2.noarch.rpm
-rw-r--r-- 1 root root  11934 2007-04-04 yum-cron-0.1-1.el5.centos.noarch.rpm
-rw-r--r-- 1 root root  22762 2007-04-04 yum-metadata-parser-1.0-8.fc6.i386.rpm
-rw-r--r-- 1 root root  10592 2007-04-04 yum-updatesd-3.0.5-1.el5.centos.2.noarch.rpm
[root@localhost lsg]#
[root@localhost lsg]# rpm -ivh yum*
warning: yum-3.0.5-1.el5.centos.2.noarch.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing...                ########################################### [100%]
   1:yum                    ########################################### [ 25%]
   2:yum-cron               ########################################### [ 50%]
   3:yum-metadata-parser    ########################################### [ 75%]
   4:yum-updatesd           ########################################### [100%]
[root@localhost lsg]#

修改yum的配置文件,添加centos的升级源。我添加的是自己的内部服务器源,这样速度会快一些。ftp协议也支持。
下面是我在网上找到的网页里面的,大家可以根据自己升级的速度决定是否采用这个源。
vi /etc/yum.repos.d/CentOS-Base.repo

  1. # CentOS-Base.repo
  2. #
  3. # This file uses a new mirrorlist system developed by Lance Davis for CentOS.
  4. # The mirror system uses the connecting IP address of the client and the
  5. # update status of each mirror to pick mirrors that are updated to and
  6. # geographically close to the client.  You should use this for CentOS updates
  7. # unless you are manually picking other mirrors.
  8. #
  9. # If the mirrorlist= does not work for you, as a fall back you can try the
  10. # remarked out baseurl= line instead.
  11. #
  12. #
  13. [base]
  14. name=CentOS-5.1 - Base
  15. baseurl=http://mirror.tini4u.net/centos/5.1/os/$basearch/
  16. http://centos.ustc.edu.cn/centos/5.1/os/$basearch/
  17. http://ftp.daum.net/centos/5.1/os/$basearch/
  18. http://mirror.secuidc.com/centos/5.1/os/$basearch/
  19. http://centos.ermly.com/centos/5.1/os/$basearch/
  20. http://ftp.hostrino.com/pub/centos/5.1/os/$basearch/
  21. gpgcheck=1
  22. gpgkey=http://centos.ermly.com/centos/5.1/os/i386/RPM-GPG-KEY-CentOS-5
  23. #released updates
  24. [updates]
  25. name=CentOS-5.1 - Updates
  26. baseurl=http://mirror.tini4u.net/centos/5.1/os/$basearch/
  27. http://centos.ustc.edu.cn/centos/5.1/os/$basearch/
  28. http://ftp.daum.net/centos/5.1/os/$basearch/
  29. http://mirror.secuidc.com/centos/5.1/os/$basearch/
  30. http://centos.ermly.com/centos/5.1/updates/$basearch/
  31. http://ftp.hostrino.com/pub/centos/5.1/os/$basearch/
  32. gpgcheck=1
  33. gpgkey=http://centos.ermly.com/centos/5.1/os/i386/RPM-GPG-KEY-CentOS-5
  34. #packages used/produced in the build but not released
  35. [addons]
  36. name=CentOS-5.1 - Addons
  37. baseurl=http://mirror.tini4u.net/centos/5.1/os/$basearch/
  38. http://centos.ustc.edu.cn/centos/5.1/os/$basearch/
  39. http://ftp.daum.net/centos/5.1/os/$basearch/
  40. http://mirror.secuidc.com/centos/5.1/os/$basearch/
  41. http://centos.ermly.com/centos/5.1/addons/$basearch/
  42. http://ftp.hostrino.com/pub/centos/5.1/os/$basearch/
  43. gpgcheck=1
  44. gpgkey=http://centos.ermly.com/centos/5.1/os/i386/RPM-GPG-KEY-CentOS-5
  45. #additional packages that may be useful
  46. [extras]
  47. name=CentOS-5.1 - Extras
  48. baseurl=http://mirror.tini4u.net/centos/5.1/os/$basearch/
  49. http://centos.ustc.edu.cn/centos/5.1/os/$basearch/
  50. http://ftp.daum.net/centos/5.1/os/$basearch/
  51. http://mirror.secuidc.com/centos/5.1/os/$basearch/
  52. http://centos.ermly.com/centos/5.1/extras/$basearch/
  53. http://ftp.hostrino.com/pub/centos/5.1/os/$basearch/
  54. gpgcheck=1
  55. gpgkey=http://centos.ermly.com/centos/5.1/os/i386/RPM-GPG-KEY-CentOS-5
  56. #additional packages that extend functionality of existing packages
  57. [centosplus]
  58. name=CentOS-5.1 – Plus
  59. baseurl=http://mirror.tini4u.net/centos/5.1/os/$basearch/
  60. http://centos.ustc.edu.cn/centos/5.1/os/$basearch/
  61. http://ftp.daum.net/centos/5.1/os/$basearch/
  62. http://mirror.secuidc.com/centos/5.1/os/$basearch/
  63. http://centos.ermly.com/centos/5.1/centosplus/$basearch/
  64. http://ftp.hostrino.com/pub/centos/5.1/os/$basearch/
  65. gpgcheck=1
  66. enabled=0
  67. gpgkey=http://centos.ermly.com/centos/5.1/os/i386/RPM-GPG-KEY-CentOS-5
  68. #contrib - packages by Centos Users
  69. [contrib]
  70. name=CentOS-5.1 - Contrib
  71. baseurl=http://mirror.tini4u.net/centos/5.1/os/$basearch/
  72. http://centos.ustc.edu.cn/centos/5.1/os/$basearch/
  73. http://ftp.daum.net/centos/5.1/os/$basearch/
  74. http://mirror.secuidc.com/centos/5.1/os/$basearch/
  75. http://centos.ermly.com/centos/5.1/contrib/$basearch/
  76. http://ftp.hostrino.com/pub/centos/5.1/os/$basearch/
  77. gpgcheck=1
  78. enabled=0
  79. gpgkey=http://centos.ermly.com/centos/5.1/os/i386/RPM-GPG-KEY-CentOS-5
复制代码


centos升级速度比较快的源我还是推荐USTC的:http://centos.ustc.edu.cn/

把fc相关的repo文件移动,否则出错。

[root@localhost yum.repos.d]# yum update
Loading "installonlyn" plugin
Setting up Update Process
Setting up repositories
updates                   100% |=========================| 1.1 kB    00:00   
addons                    100% |=========================| 1.1 kB    00:00   
extras                    100% |=========================| 1.1 kB    00:00   
Reading repository metadata in from local files
primary.xml.gz            100% |=========================| 798 kB    00:00   
################################################## 2334/2334
primary.xml.gz            100% |=========================| 798 kB    00:00   
################################################## 2334/2334

到这里停止,没有反应了。用top杀进程后,尝试 yum upgrade 现象相同。man yum似乎没有答案。再执行yum check-update 后,再update 成功。


(349/351): pango-1.14.9-3 100% |=========================| 333 kB    00:00   
(350/351): libxml2-python 100% |=========================| 697 kB    00:00   
(351/351): comps-extras-1 100% |=========================|  46 kB    00:00   
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897


GPG key retrieval failed: [Errno 4] IOError: <urlopen error (-2, '\xe6\x9c\xaa\xe7\x9f\xa5\xe7\x9a\x84\xe5\x90\x8d\xe7\xa7\xb0\xe6\x88\x96\xe6\x9c\x8d\xe5\x8a\xa1')>
[root@localhost yum.repos.d]#
       0 Package(s)        

Total download size: 513 M
Is this ok [y/N]: Exiting on user Command
Complete!

但是此时只是从源服务器下载成功,并没有安装,当时没有发现原因,于是转而到临时缓存目录里面找下载的安装包,用rpm手工安装,后来发现是GPG-KEY的问题,安装新的key就可以了,呵呵,绕了个弯路。不过这种办法也可以完成升级。

[root@localhost yum.repos.d]# rpm --import ftp://192.168.1.243/pub/cent5/RPM-GPG-KEY-beta
[root@localhost yum.repos.d]# yum update
Loading "installonlyn" plugin
Setting up Update Process
Setting up repositories
Reading repository metadata in from local files
此时再update都从local files这里找了

[root@localhost packages]# pwd
/var/cache/yum/base/packages
[root@localhost packages]# rpm -ivh *.rpm
warning: a2ps-4.13b-57.1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
error: Failed dependencies:
        centos-release-notes is needed by centos-release-5-0.0.el5.centos.2.i386
        launchmail is needed by evolution-2.8.0-33.el5.i386
        cyrus-sasl-md5 is needed by gaim-2.0.0-0.28.beta5.el5.i386
        busybox >= 1.2.0 is needed by kexec-tools-1.101-164.el5.i386
        m2crypto >= 0.16-5 is needed by python-urlgrabber-3.1.0-2.noarch
        xorg-x11-drv-tek4957 is needed by xorg-x11-drivers-7.1-4.1.el5.i386
[root@localhost packages]# lftp 192.168.1.243
lftp 192.168.1.243:~> cd pub/cent5/CentOS/
cd 成功, 当前目录=/pub/cent5/CentOS
lftp 192.168.1.243:/pub/cent5/CentOS> get busybox-
busybox-1.2.0-3.el5.centos.i386.rpm  busybox-anaconda-1.2.0-3.el5.centos.i386.rpm
lftp 192.168.1.243:/pub/cent5/CentOS> get busybox-1.2.0-3.el5.centos.i386.rpm
1061228 bytes transferred                                         
lftp 192.168.1.243:/pub/cent5/CentOS> get centos-release-notes-5.0.0-2.i386.rpm
114177 bytes transferred                                            
lftp 192.168.1.243:/pub/cent5/CentOS> get launchmail-4.0.0-1.el5.noarch.rpm
4204 bytes transferred
lftp 192.168.1.243:/pub/cent5/CentOS> get cyrus-sasl-md5-2.1.22-4.i386.rpm
46521 bytes transferred                                       
lftp 192.168.1.243:/pub/cent5/CentOS> get m2crypto-0.16-6.el5.1.i386.rpm
498796 bytes transferred                                    
lftp 192.168.1.243:/pub/cent5/CentOS> get xorg-x11-drv-tek4957-1.1.0-1.1.i386.rpm
10192 bytes transferred                                               
lftp 192.168.1.243:/pub/cent5/CentOS> by
[root@localhost packages]# rpm -Uvh *.rpm
warning: a2ps-4.13b-57.1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
error: Failed dependencies:
        system-logos is needed by compiz-0.0.13-0.36.20060817git.el5.i386
        system-logos is needed by firstboot-1.4.27.2-1.el5.centos.1.noarch
        system-logos is needed by gdm-2.16.0-30.el5.centos.i386
        /usr/share/gnome-screensaver/lock-dialog-system.glade is needed by gnome-screensaver-2.16.1-5.el5.i386
        system-logos is needed by gnome-screensaver-2.16.1-5.el5.i386
        system-logos is needed by gnome-session-2.16.0-6.el5.centos.i386
        system-logos is needed by rhgb-0.16.4-6.el5.centos.i386

这几个包依赖关系不好解决,又用不到,干脆删掉,不就没有什么依赖关系了,呵呵

[root@localhost packages]# rm -f compiz-0.0.13-0.36.20060817git.el5.i386.rpm firstboot-1.4.27.2-1.el5.centos.1.noarch.rpm gdm-2.16.0-30.el5.centos.i386.rpm gnome-screensaver-2.16.1-5.el5.i386.rpm gnome-session-2.16.0-6.el5.centos.i386.rpm rhgb-0.16.4-6.el5.centos.i386.rpm
[root@localhost packages]# rpm -Uvh *.rpm
warning: a2ps-4.13b-57.1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897

    file /usr/share/backgrounds/images/default-dual-wide.jpg from install of desktop-backgrounds-basic-2.0-40.el5.centos conflicts with file from package fedora-logos-6.0.6-1.fc6
        file /usr/share/backgrounds/images/default-dual.jpg from install of desktop-backgrounds-basic-2.0-40.el5.centos conflicts with file from package fedora-logos-6.0.6-1.fc6
        file /usr/share/backgrounds/images/default-wide.jpg from install of desktop-backgrounds-basic-2.0-40.el5.centos conflicts with file from package fedora-logos-6.0.6-1.fc6
        file /usr/share/backgrounds/images/default.jpg from install of desktop-backgrounds-basic-2.0-40.el5.centos conflicts with file from package fedora-logos-6.0.6-1.fc6
[root@localhost packages]# rpm -e fedora-logos
error: Failed dependencies:
        system-logos is needed by (installed) grub-0.97-13.i386
        system-logos is needed by (installed) redhat-artwork-5.0.8-1.fc6.i386
        system-logos is needed by (installed) rhgb-0.16.4-1.fc6.i386
        system-logos is needed by (installed) gdm-2.16.0-10.fc6.i386
        system-logos is needed by (installed) gnome-screensaver-2.16.0-7.fc6.i386
        system-logos is needed by (installed) gnome-session-2.16.0-3.fc6.i386
        system-logos is needed by (installed) compiz-0.0.13-0.32.20060817git.fc6.i386
        system-logos is needed by (installed) firstboot-1.4.23-1.noarch
        /usr/share/gnome-screensaver/lock-dialog-system.glade is needed by (installed) gnome-screensaver-2.16.0-7.fc6.i386
[root@localhost packages]# rpm -e --nodeps fedora-logos
[root@localhost packages]# rpm -Uvh *.rpm
warning: a2ps-4.13b-57.1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
error: Failed dependencies:
        system-logos is needed by compiz-0.0.13-0.36.20060817git.el5.i386
        system-logos is needed by firstboot-1.4.27.2-1.el5.centos.1.noarch
        system-logos is needed by gdm-2.16.0-30.el5.centos.i386
        /usr/share/gnome-screensaver/lock-dialog-system.glade is needed by gnome-screensaver-2.16.1-5.el5.i386
        system-logos is needed by gnome-screensaver-2.16.1-5.el5.i386
        system-logos is needed by gnome-session-2.16.0-6.el5.centos.i386
        system-logos is needed by rhgb-0.16.4-6.el5.centos.i386
[root@localhost packages]# rm -f compiz-0.0.13-0.36.20060817git.el5.i386.rpm firstboot-1.4.27.2-1.el5.centos.1.noarch.rpm gdm-2.16.0-30.el5.centos.i386.rpm gnome-screensaver-2.16.1-5.el5.i386.rpm gnome-session-2.16.0-6.el5.centos.i386.rpm rhgb-0.16.4-6.el5.centos.i386.rpm
[root@localhost packages]# rpm -Uvh *.rpm
warning: a2ps-4.13b-57.1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing...                ########################################### [100%]
   1:libgcc                 ########################################### [  0%]
   2:redhat-menus           ########################################### [  1%]
   3:setup                  ########################################### [  1%]
   4:filesystem             ########################################### [  1%]

最后再把漏的几个包单独安装。如果早就解决了GPG-KEY的问题,就可以直接update了

[root@localhost ~]# rpm -ivh redhat-logos-4.9.8-6.el5.centos.noarch.rpm
warning: redhat-logos-4.9.8-6.el5.centos.noarch.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing...                ########################################### [100%]
   1:redhat-logos           ########################################### [100%]
[root@localhost ~]#
[root@localhost ~]# rpm -Uvh /var/cache/yum/base/packages/gdm-2.16.0-30.el5.centos.i386.rpm
warning: /var/cache/yum/base/packages/gdm-2.16.0-30.el5.centos.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing...                ########################################### [100%]
   1:gdm                    ########################################### [100%]
[root@localhost ~]# rpm -Uvh /var/cache/yum/base/packages/gnome-session-2.16.0-6.el5.centos.i386.rpm /var/cache/yum/base/packages/rhgb-0.16.4-6.el5.centos.i386.rpm
warning: /var/cache/yum/base/packages/gnome-session-2.16.0-6.el5.centos.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing...                ########################################### [100%]
   1:gnome-session          ########################################### [ 50%]
   2:rhgb                   ########################################### [100%]
[root@localhost ~]#
发表于 2008-4-22 21:47:29 | 显示全部楼层
又赶时间来不及做网络安装或者硬盘安装。

硬盘安装来不及?
毕竟版本老了

fedora core 6和centos 5的包版本都是差不多,而RHEL 5就是一个修复完善之后的fc6。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表