CentOS 6 到 CentOS 7 的升级过程

来源:互联网 发布:我的阿里云tv工程模式 编辑:程序博客网 时间:2024/04/29 18:09

英文原文:CentOS 6 to CentOS 7 Upgrade Procedure

在红帽企业版7发布之后仅仅几周,centos7也发布了,并且包含了与红帽同样令人兴奋的功能。除了期待已久的systemd和当前热门的Docker,此次发布还使系统自动从版本6更新到版本7而不需要安装镜像文件成为可能。虽然升级还需要重启,因此不能算是一种live upgrade,但对于那些只能通过远程访问的服务器来说还是非常方便的。

红帽早已发布并且文档化了必要的更新工具。CentOS团队还来不及导入、测试和重新构建工具,但是开发人员早已经在做开始做了-而且他们提供了未测试的二进制文件。

AhahaGe

AhahaGe
翻译于 1年前

0人顶

顶 翻译的不错哦!

请,注意:由于这些包还未经测试,你不应该,通过任何方式,在除了像备用测试机这种你可以简单的重新部署并且没有任何有价值数据的机器上尝试它。千万不要在生产机器上尝试它!

但是如果你想初步的了解下工具是大体上如何工作的,我推荐你建立一个简单CentOS 6虚拟机,安装尽可能少的程序包以及所有的系统更新。然后,从上文提到的CentOS库中安装这些rpm。

在这些rpm当中有个Preupgrade Assistant,它可以在系统上安全的执行:preupg仅仅是分析系统而不会执行任何任务,执行后它会给出一些建议告诉更新程序在更新的时候去搜索什么。

AhahaGe

AhahaGe
翻译于 1年前

0人顶

顶 翻译的不错哦!

由于我仅在安装了很少服务的系统上运行,所以在运行preupg后我没有得到实际的结果。甚至在一台装了更多服务的系统上也得到了相同的结果(有许多行,因此只显示部分行作为例子);

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

$ sudo preupg

Preupg tool doesn't do the actual upgrade.

Please ensure you have backed up your system and/or data in the event of a failed upgrade

that would require a full re-install of the system from installation media.

Do you want to continue? y/n

y

Gathering logs used by preupgrade assistant:

All installed packages : 01/10 ...finished (time 00:00s)

All changed files      : 02/10 ...finished (time 00:48s)

Changed config files   : 03/10 ...finished (time 00:00s)

All users : 04/10 ...finished (time 00:00s)

...

042/100 ...done (samba shared directories selinux)

043/100 ...done (CUPS Browsing/BrowsePoll configuration)

044/100 ...done (CVS Package Split)

...

|samba shared directories selinux          |notapplicable  |

|CUPS Browsing/BrowsePoll configuration    |notapplicable  |

|CVS Package Split                         |notapplicable  |

...

就像上面提到的,Preupgrade Assistant只是帮助分析在更新的时候会出现什么问题-真正的步骤需要用l redhat-upgrade-tool-cli. 工具完成。要让这个工具可以有效工作,必须先导入CentOS 7的键:

?

1

$ sudo rpm --import http://isoredirect.centos.org/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7

AhahaGe

AhahaGe
翻译于 1年前

1人顶

顶 翻译的不错哦!

然后,实际的升级工具被调用,相应的选项是将来的发行版本以及下载数据的URL地址。另外由于这工具会对preupg没有提前运行发出警告,故我不得不添加了--force选项屏蔽,虽然这个警告是正确的。一旦升级工具被调用起来,一些必要信息,包以及图片开始下载,然后它会请求重启,这重启操作不会自动发生。

?

1

2

3

4

$ sudo /usr/bin/redhat-upgrade-tool-cli --force --network 7 --instrepo=http://mirror.centos.org/centos/7/os/x86_64

setting up repos...

.treeinfo                                                                                                                                            | 1.1 kB     00:00    

getting boot images...

重启之后,机器会使用下载好的包开始更新自己,依据这机器的处理速度不同相应的解析时间会有所不同,期望数分钟而不是几秒。无论怎样,如果一切运行正常的话,下次登录将会进入CentOS 7界面了。

$ cat /etc/os-release  NAME="CentOS Linux"VERSION="7 (Core)"ID="centos"ID_LIKE="rhel fedora"VERSION_ID="7"PRETTY_NAME="CentOS Linux 7 (Core)"ANSI_COLOR="0;31"CPE_NAME="cpe:/o:centos:centos:7"HOME_URL="https://www.centos.org/"BUG_REPORT_URL=https://bugs.centos.org/

yum localinstall http://dev.centos.org/centos/6/upg/x86_64/Packages/preupgrade-assistant-1.0.2-33.el6.x86_64.rpm http://dev.centos.org/centos/6/upg/x86_64/Packages/preupgrade-assistant-contents-0.5.13-1.el6.noarch.rpm http://dev.centos.org/centos/6/upg/x86_64/Packages/python-rhsm-1.9.7-1.el6.x86_64.rpm http://dev.centos.org/centos/6/upg/x86_64/Packages/redhat-upgrade-tool-0.7.22-1.el6.noarch.rpm
preupg
redhat-upgrade-tool-cli --force --network=7 --instrepo=http://mirrors.aliyun.com/centos/7/os/x86_64/
rm -f /etc/yum.repos.d/CentOS-SCL.repo
wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 http://mirrors.aliyun.com/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7
sed -i 's/6/7/g' /etc/yum.repos.d/CentOS-Base.repo
yum update
reboot
cat /etc/redhat-release

0 0
原创粉丝点击