Upgrade from CentOS 6.5 to CentOS 7 using redhat-upgrade-tool | linuxsysconfig

Last month Red Hat released RHEL 7 and few days ago CentOS announced the GA of CentOS 7. As you may know, starting RHEL 7 Red Hat introduces support for upgrading to major releases (RHEL 6.5 –> RHEL 7) via a tool called redhat-upgrade-tool.

Not sure if this is 100% supported by CentOS at this time, but I found the CentOS rpm packages on their development site and thought of giving them a try and luckily it turned out OK.

Of course this is only a proof of concept, it may possibly not work by default on production environments, so use with care. For my test I used a fully updated base installation of CentOS 6.5 VM running on VirtualBox.

 

Download required packages

 

<span class="pln">mkdir </span><span class="pun">-</span><span class="pln">p </span><span class="pun">/</span><span class="pln">root</span><span class="pun">/</span><span class="pln">upgrade</p><p>cd </span><span class="pun">/</span><span class="pln">root</span><span class="pun">/</span><span class="pln">upgrade</p><p>wget http</span><span class="pun">:</span><span class="com">//dev.centos.org/centos/6/upg/x86_64/Packages/preupgrade-assistant-1.0.2-33.0.3.el6.centos.x86_64.rpm http://dev.centos.org/centos/6/upg/x86_64/Packages/preupgrade-assistant-contents-0.5.13-1.0.5.el6.centos.noarch.rpm http://dev.centos.org/centos/6/upg/x86_64/Packages/preupgrade-assistant-ui-1.0.2-33.0.3.el6.centos.x86_64.rpm http://dev.centos.org/centos/6/upg/x86_64/Packages/redhat-upgrade-tool-0.7.22-3.el6.centos.noarch.rpm</span>

 

Install preupgrade assistant

 

<span class="pln">yum localinstall preupgrade</span><span class="pun">-</span><span class="pln">assistant</span><span class="pun">-*</span>

 

Run preupgrade assistant

 

<span class="pln">preupg</span>

 This does a check on the installed system and tries to identify potential issues after the upgrade. It should be run until all tests pass successfully. Not sure it did anything on my VM as all tests returned “not applicable”. I haven’t used the original tool (for RHEL7) but I suspect the CentOS equivalent is still work in progress, so I decided to skip it. More info on the preupgrade assistant is available in the RedHat official documentation.

 

Install redhat-upgrade-tool

 

<span class="pln">yum localinstall redhat</span><span class="pun">-</span><span class="pln">upgrade</span><span class="pun">-</span><span class="pln">tool</span><span class="pun">-</span><span class="lit">0.7</span><span class="pun">.</span><span class="lit">22</span><span class="pun">-</span><span class="lit">3.el6.centos</span><span class="pun">.</span><span class="pln">noarch</span><span class="pun">.</span><span class="pln">rpm</span>

 

Import the CentOS 7 rpm gpg key

 

<span class="pln">rpm </span><span class="pun">--</span><span class="kwd">import</span><span class="pln"> http</span><span class="pun">:</span><span class="com">//ftp.plusline.de/centos/7.0.1406/os/x86_64/RPM-GPG-KEY-CentOS-7</span>

 

Run the upgrade tool

 

The tool can use a local ISO, the local media drive or a network URL to perform the upgrade. The network command argument needs to be followed by a release version (rawhide is also supported) and a valid installation repository (at the time of this writing not all repositories were updated or reachable, so I did some trial and error until I found a working repo) which can be defined as a standard URL or a mirror (full mirror list is available here).

<span class="pln">redhat</span><span class="pun">-</span><span class="pln">upgrade</span><span class="pun">-</span><span class="pln">tool </span><span class="pun">--</span><span class="pln">network </span><span class="lit">7.0</span><span class="pln"> </span><span class="pun">--</span><span class="pln">instrepo http</span><span class="pun">:</span><span class="com">//ftp.plusline.de/centos/7.0.1406/os/x86_64/</span>

Should this warn you that you didn’t run the upgrade assistant, you can force its execution by adding the extra option:

<span class="pln">redhat</span><span class="pun">-</span><span class="pln">upgrade</span><span class="pun">-</span><span class="pln">tool </span><span class="pun">--</span><span class="pln">network </span><span class="lit">7.0</span><span class="pln"> </span><span class="pun">--</span><span class="pln">instrepo http</span><span class="pun">:</span><span class="com">//ftp.plusline.de/centos/7.0.1406/os/x86_64/ --force</span>

A successful run ends with this message: “Finished. Reboot to start upgrade.

 

Reboot

 

After restarting the machine, the OS will boot a new grub entry called System Upgrade which is supposed to upgrade all packages previously downloaded by the upgrade tool. I ran into a small problem here “Database environment version mismatch” likely caused by the rpm tool itself (rpm version is 4.11 in CentOS 7 and 4.8 in CentOS 6).

<span class="pln">cd </span><span class="pun">/</span><span class="pln">mnt</span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">rpm</p><p>rm __</span><span class="pun">*</span><span class="pln"></p><p>init </span><span class="lit">6</span>

Removing the rpm database files and rebooting worked for me (CTRL+D or exiting the shell should also work as that would exit the emergency mode and continue from the last step before the error occurred) and the upgrade went through without other issues.

<span class="pln">cat </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">centos</span><span class="pun">-</span><span class="pln">release</p><p></span><span class="typ">CentOS</span><span class="pln"> </span><span class="typ">Linux</span><span class="pln"> release </span><span class="lit">7.0</span><span class="pun">.</span><span class="lit">1406</span><span class="pln"> </span><span class="pun">(</span><span class="typ">Core</span><span class="pun">)</span>

 

UPDATE

 

If you follow this guide make sure you use the latest releases of the upgrade packages (preupgrade-assistant-* and redhat-upgrade-tool) as provided by CentOS here. Also note that after the writing of this article, CentOS published a wiki page on the upgrade tool so it’s probably best to use that instead. Thanks.

 

来源URL:http://linuxsysconfig.com/2014/07/upgrade-to-centos-7/