Tek Eye Logo

Tek Eye

CentOS 6 to CentOS 7 Upgrade Using Red Hat Upgrade Tool

NOTE: This article is for archived information purposes only. According to the CentOS Upgrade Tool web page, the tool is currently broken.

CentOS 7 Supports In-Place Upgrading from CentOS 6.x for 64-bit Versions

This article covers upgrading a minimal CentOS 6.x system to CentOS 7. Community Enterprise Operating System (CentOS) is a popular GNU/Linux Operating System (OS) for servers (including web servers) and workstations. Popular because it is a community based version of Red Hat Enterprise Linux (RHEL). CentOS is often an OS option when purchasing and setting up a Virtual Private Server (VPS). The current major version of CentOS is version 7. CentOS 7 can be installed via an in-place upgrade over CentOS 6. However, CentOS 7 is only a 64-bit OS and therefore the system being upgraded has to be running 64-bit CentOS 6.

To check if CentOS is 64-bit or 32-bit use the uname command with the -p option (p for processor):

[root@servername ~]# uname -p  
x86_64

The 64-bit CentOS will display x86_64 and 32-bit will display i686.

CentOS 6 to CentOS 7 Upgrade

Words of caution. If your system has been highly customised then performing an in-place upgrade from CentOS 6 to 7 may not be successful. In this case, as for upgrading a 32-bit system, a data backup, new CentOS 7 installation and data restore will be required. Do you need CentOS 7 now? There is also no need to rush to upgrade to CentOS 7. CentOS 6 will be receiving updates until the end of 2020. This article is for informational and test purposes only. You are responsible for you own actions and an in-place upgrade from CentOS 6 to CentOS 7 is probably more trouble than doing a fresh CentOS 7 install and data restore. For example upgrading a minimal CentOS 6.6. to CentOS 7 may not work according to this bug report.

The other consideration is whether the new CentOS 7 features will hinder operation of your system. The new features may require changes to the normal workflow or they may be incompatible with software that is being used on the system. Whilst the CentOS 7 Release Notes list some major changes the RHEL 7 Release Notes has a detailed discussion.

Backup Your Data

The most important step before performing any update or upgrade is to take a backup of all data. Performing a regular backup means that more than one copy of the data required is available to restore should anything go wrong. A copy of the last two or three backups should be available. Ideally stored on separate media in a safe place.

Practice Makes Perfect

Get familiar with the update and upgrade process. A good way to do this is to try it on a Virtual Machine (VM) on your local system. Ideally the VM will mimic the live system set-up. This article is based upon an upgrade from a minimal CentOS 6 system running on a VirtualBox VM on a Windows 8.1 system. CentOS running in a VM is similar to CentOS running as a VPS.

Update CentOS 6 to the Latest Point Release

Before upgrading a system from CentOS 6 to CentOS 7 the CentOS 6 system needs to be updated to the latest 6.x version and rebooted. The update is performed with the yum command:

[root@servername ~]# yum update

Full details of updating CentOS to the latest point release and rebooting can be found in the article CentOS Version Command and Update CentOS to New Version.

Install Upgrade Assistant

Create a repository (repo) file for the upgrade assistant. On the minimal installation of CentOS this can be done with the vi editor. The repo file will sit in /etc/yum.repos.d and named upgradetool.repo:

[root@servername ~]# vi /etc/yum.repos.d/upgradetool.repo

In vi type i to enter insert mode and add these lines to the new repo file:

[upg]
name=CentOS-$releasever – Upgrade Tool
baseurl=http://dev.centos.org/centos/6/upg/x86_64/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

Save the file by hitting the escape key (Esc) and type the write and quit command using :wq (colon and w and q keys).

Use yum to install the upgrade assistant:

[root@servername ~]# yum install redhat-upgrade-tool preupgrade-assistant-contents

If you get an error similar to the following it is likely you are trying to install the upgrade assistant on 32-bit CentOS. Only 64-bit CentOS 6 to CentOS 7 in-place upgrade is possible:

Error: Package: 1:redhat-upgrade-tool-0.7.22-3.el6.centos.noarch (upg)
Requires: preupgrade-assistant >= 1.0.2-4
Error: Package: preupgrade-assistant-contents-0.5.14-1.el6.centos.noarch (upg)
Requires: preupgrade-assistant (x86-64) >= 1.0.2-4

(Above error is seen if trying to install Red Hat Upgrade Tool on 32-bit CentOS 6.x)

Run the Pre-upgrade Assistant

The pre-upgrade utility, preupg, performs an upgrade analysis for the system.

View the pre-upgrade utility options using –help or -h:

[root@servername ~]# preupg -h

The list command should show CentOS6_7:

[root@servername ~]# preupg -l  
CentOS6_7

Run the command to perform the analysis (it does not do the upgrade, it will display a reminder about having backups available in case the upgrade fails):

[root@servername ~]# preupg -s CentOS6_7

Enter y to proceed. After the analysis the results are stored in the /root/preupgrade directory, in result.html and result.xml files and various subdirectories. All the contents of the _preupgrade _directory are also copied to an archive file.

Review the Pre-upgrade Results

If not moving the result files to a different system for review, then on a minimal system viewing the files in the command shell is difficult. The best approach is to install a text based web page viewer. The utility w3m is ideal.

[root@servername ~]# yum install w3m w3m-img w3m-el

(It is a good idea to install w3m before running the pre-update utility so that it can also be analysed.)

Pass w3m the result.html file and it is easier to view the pre-upgrade report.

[root@servername ~]# w3m preupgrade/result.html

w3m Showing CentOS Pre-upgrade Report

Use the report to determine any required action to deal with potential upgrade issues. The greater the amount of customisation to a system the larger the potential task of the post upgrade work. For additional information see the CentOS Upgrade Tool web page, in particular what the contents of the various directories are for, the meaning of the various results and the risk levels explanation.

Run the Red Hat Upgrade Tool

First import the CentOS 7 RPM key:

[root@servername ~]# rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

Run the upgrade:

[root@servername ~]# centos-upgrade-tool-cli --network 7
    --instrepo=http://mirror.centos.org/centos/7/os/x86_64

Answer y after the informational messages to continue (this is your chance to cancel the upgrade). Restart the system:

[root@servername ~]# reboot

The installation will complete, and, fingers-crossed, work.

Complete Any Further Steps Required

Any steps identified by the upgrade report will need completing and a full operational shakedown. If you decided not to do an in-place upgrade remember CentOS 6 will be supported until 2020, also consider a fresh install of CentOS 7 as an alternative to an in-place upgrade.

See Also

  • For a full list of all the articles on Tek Eye see the full site Index.

Archived Comments

IG on August 11, 2015 at 12:03 am said:

Hi, this isn’t working for me.

[root@localhost ~]# rpm -import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7
RPM version 4.8.0
Copyright (C) 1998-2002 – Red Hat, Inc.
This program may be freely redistributed under the terms of the GNU GPL

Usage: rpm [-aKfgpWHqVcdilsKiv?] [-a|–all] [-f|–file] [-g|–group] [-p|–package] [-W|–ftswalk] [–pkgid]
     [–hdrid] [–fileid] [–specfile] [–triggeredby] [–whatrequires] [–whatprovides] [–nomanifest]
     [-c|–configfiles]
[-d|–docfiles] [–dump] [-l|–list] [–queryformat=QUERYFORMAT] [-s|–state] [–nofiledigest] [–nomd5]
     [–nofiles] [–nodeps] [–noscript] [–comfollow] [–logical] [–nochdir] [–nostat] [–physical]
     [–seedot]
[–xdev] [–whiteout] [–addsign] [-K|–checksig] [–delsign] [–import] [–resign] [–nodigest]
     [–nosignature] [–initdb] [–rebuilddb] [–aid] [–allfiles] [–allmatches] [–badreloc] [-e|–erase +]
[–excludedocs] [–excludepath=] [–fileconflicts] [–force] [-F|–freshen +] [-h|–hash] [–ignorearch]
     [–ignoreos] [–ignoresize] [-i|–install] [–justdb] [–nodeps] [–nofiledigest] [–nomd5]
[–nocontexts] [–noorder] [–nosuggest] [–noscripts] [–notriggers] [–oldpackage] [–percent] [–prefix=]
     [–relocate==] [–replacefiles] [–replacepkgs] [–test] [-U|–upgrade +]
[–quiet] [-D|–define ‘MACRO EXPR’] [-E|–eval ‘EXPR’] [–macros=] [–nodigest] [–nosignature] [–rcfile=]
     [-r|–root ROOT] [–querytags] [–showrc] [–quiet] [-v|–verbose] [–version] [-?|–help]
[–usage] [–scripts] [–setperms] [–setugids] [–conflicts] [–obsoletes] [–provides] [–requires] [–info]
     [–changelog] [–xml] [–triggers] [–last] [–dupes] [–filesbypkg] [–fileclass] [–filecolor]
[–fscontext] [–fileprovide] [–filerequire] [–filecaps]

[root@localhost ~]# centos-upgrade-tool-cli -network 7
     -instrepo=http://mirror.centos.org/centos/7/os/x86_64
Usage: centos-upgrade-tool-cli [options]

centos-upgrade-tool-cli: error: SOURCE is required (–network, –device, –iso)

Tek Eye on August 12, 2015 at 10:09 am said:

Hi,

has the machine got web access to "http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7"?

Tibor on September 7, 2015 at 3:07 pm said:

Run the Red Hat Upgrade Tool

in the last step double "dash" in front of the keyWords are missing:

First import the CentOS 7 RPM key:

[root@servername ~]# rpm –-import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

Run the upgrade:

[root@servername ~]# centos-upgrade-tool-cli –-network 7 -–instrepo=http://mirror.centos.org/centos/7/os/x86_64

Stan on September 14, 2015 at 5:03 pm said:

Hello!

Thanks for the info. Just wanted to let you know that your double hyphen characters are being converted to n-dash characters.

Tek Eye on September 15, 2015 at 11:23 am said:

Cheers!

rohman on January 25, 2017 at 4:48 am said:

Continue with the upgrade [Y/N]? Y
getting boot images…

Downloading failed: invalid data in treeinfo: No option 'upgrade' in section: 'images-x86_64'

I have an error, how to fix this?

Arief Arovah on May 26, 2017 at 3:12 am said:

Yes Rohman, I get same error like you, Downloading failed: invalid data in treeinfo: No option upgrade in section: images-x86_64, How to fix this please?

Tek Eye on May 29, 2017 at 9:33 am said:

According to the CentOS Upgrade Tool web page, the tool is currently broken:

https://wiki.centos.org/TipsAndTricks/CentOSUpgradeTool

Therefore the choices are to stay with CentOS 6 (supported till 2020), or backup all your data and do a clean CentOS 7 install then restore your data.

Author:  Published:  Archived:

ShareSubmit to TwitterSubmit to FacebookSubmit to LinkedInSubmit to redditPrint Page

markdown CMS Small Logo Icon ↓markdown↓ CMS is fast and simple. Build websites quickly and publish easily. For beginner to expert.


Articles on:

Android Programming and Android Practice Projects, HTML, VPS, Computing, IT, Computer History, ↓markdown↓ CMS, C# Programming, Using Windows for Programming


Free Android Projects and Samples:

Android Examples, Android List Examples, Android UI Examples



Tek Eye Published Projects