upgrade CentOS from 6.5 to 7 in an EC2 Instance
How can I upgrade CentOS from 6.5 to 7.0 under Amazon Web Services EC2 instance?
I have added the redhead upgrade tool to my repository and installed it, called the preupg
and then imported the CentOS 7 GPG and then called:
redhat-upgrade-tool --network 7.0 --instrepo [repo here] --cleanup-post
The preupg and pre installation went perfect with no problem and the redhat-upgrade-tool
asked me to reboot. I called the shutdown -r now
and when I tried to ssh to it to check what's happening it opened in seconds, so I typed lsb_release -a
and it showed 'CentOS 6.5 (Final)'. Then I tried cat /etc/centos-release
just to be sure nothing happened and it also showed 'CentOS 6.5 (Final)'
How can I get this to work?
Solution 1:
Quite simply, if you follow the steps listed in here:
1 - Download required packages
mkdir -p /root/upgrade
cd /root/upgrade
wget http://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
2 - Install preupgrade assistant
yum localinstall preupgrade-assistant-*
3 - Run preupgrade assistant
preupg
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.
4 - Install redhat-upgrade-tool
yum localinstall redhat-upgrade-tool-0.7.22-3.el6.centos.noarch.rpm
5 - Import the CentOS 7 rpm gpg key
rpm --import http://ftp.plusline.de/centos/7.0.1406/os/x86_64/RPM-GPG-KEY-CentOS-7
6 - 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).
redhat-upgrade-tool --network 7.0 --instrepo http://ftp.plusline.de/centos/7.0.1406/os/x86_64/
Should this warn you that you didn’t run the upgrade assistant, you can force its execution by adding the extra option:
redhat-upgrade-tool --network 7.0 --instrepo http://ftp.plusline.de/centos/7.0.1406/os/x86_64/ --force
A successful run ends with this message: “Finished. Reboot to start upgrade.“
7 - 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).
cd /mnt/var/lib/rpm
rm __*
init 6
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.
cat /etc/centos-release
CentOS Linux release 7.0.1406 (Core)
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.
Source: http://linuxsysconfig.com/2014/07/upgrade-to-centos-7/
Just follow that, I've done it already and it worked for me.