CentOS 6.x 到 CentOS 7 的升级过程
<p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, " microsoft="">在红帽企业版7发布之后仅仅几周,centos7也发布了,并且包含了与红帽同样令人兴奋的功能。除了期待已久的systemd和当前热门的Docker,此次发布还使系统自动从版本6更新到版本7而不需要安装镜像文件成为可能。虽然升级还需要重启,因此不能算是一种live upgrade,但对于那些只能通过远程访问的服务器来说还是非常方便的。</p><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, " microsoft="">
红帽早已发布并且文档化了必要的更新工具。CentOS团队还来不及导入、测试和重新构建工具,但是开发人员早已经在做开始做了-而且他们提供了未测试的二进制文件。</p><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, " microsoft="">
<strong>请注意</strong>:由于这些包还未经测试,你不应该,通过任何方式,在除了像备用测试机这种你可以简单的重新部署并且没有任何有价值数据的机器上尝试它。千万不要在生产机器上尝试它!</p><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, " microsoft="">
但是如果你想初步的了解下工具是大体上如何工作的,我<strong>推荐你建立一个简单CentOS 6虚拟机,安装尽可能少的程序包以及所有的系统更新</strong>。然后,从上文提到的CentOS库中安装这些rpm。</p><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, " microsoft="">
在这些rpm当中有个Preupgrade Assistant,它可以在系统上安全的执行:preupg仅仅是分析系统而不会执行任何任务,执行后它会给出一些建议告诉更新程序在更新的时候去搜索什么。</p><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, " microsoft="">
由于我仅在安装了很少服务的系统上运行,所以在运行preupg后我没有得到实际的结果。甚至在一台装了更多服务的系统上也得到了相同的结果(有许多行,因此只显示部分行作为例子);</p><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, " microsoft=""><span style="font-family: tahoma, arial, " microsoft="" background-color:=""></span><span style="font-family: tahoma, arial, " microsoft="" background-color:="">代码如下:</span></p><pre class="brush:bash;toolbar:false">$ 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 |
...</pre><p><br/></p><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, " microsoft="">
</p><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, " microsoft="">
就像上面提到的,Preupgrade Assistant只是帮助分析在更新的时候会出现什么问题-真正的步骤需要用l redhat-upgrade-tool-cli. 工具完成。要让这个工具可以有效工作,必须先导入CentOS 7的键:</p><pre class="brush:bash;toolbar:false">$ sudo rpm --import http://isoredirect.centos.org/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7</pre><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, " microsoft="">
</p><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, " microsoft="">
然后,实际的升级工具被调用,相应的选项是将来的发行版本以及下载数据的URL地址。另外由于这工具会对preupg没有提前运行发出警告,故我不得不添加了--force选项屏蔽,虽然这个警告是正确的。一旦升级工具被调用起来,一些必要信息,包以及图片开始下载,然后它会请求重启,这重启操作不会自动发生。</p><pre class="brush:bash;toolbar:false">$ 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...</pre><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, " microsoft="">
重启之后,机器会使用下载好的包开始更新自己,依据这机器的处理速度不同相应的解析时间会有所不同,期望数分钟而不是几秒。无论怎样,如果一切运行正常的话,下次登录将会进入CentOS 7界面了。</p><pre class="brush:bash;toolbar:false">$ 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/"</pre><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, " microsoft="">
结论表明升级工具运行的很好。 虽然它比不上一个真正的live upgrade,如果提供一个非常好的升级远程服务器方式。 我测试了一台干净的虚拟机还有一台电脑裸机,远程服务器,升级工具都工作地出奇的好。 不幸的是,分析工具没能像我期望的那样工作,这可能是由于它还未经测试或者是我没有正确地使用它。随着时间的推移, 我期待着升级工具会如何发展和改善。 但是 , 再一次,如前所述 – 不要 在自己的 产品 服务器上尝试它。</p>
頁:
[1]