Upgrading CentOS 6.5 to CentOS 7.2

作者: wiflish 分类: 软件 发布时间: 2016-05-17 08:18 ė 6没有评论

I just recently had the job of upgrading a clients CentOS server from 6.5 to 7.2, this can be a little daunting at first but running some tests first in a VM worked well so I was OK to go. Here’s how I did it.

Please note that major upgrades can cause data loss, or things can go wrong so before you start make a backup of your server. Then if things go wrong you can revert to save point

Step 1: Backup and update

In the past to update like this you had to reinstall the new CentOS then restore all your programs and data but now with CentOS 7 we can do an inlace upgrade, that being said thing can still go wrong so first make a backup of your sever once that is done we can proceed.

After you have made your backup run an update

I had problems with getting Apache and MySQL and PHP to start after the upgrade so I would remove them now and reinstall them after the upgrade so in a terminal

Don’t forget to save your configs files to restore them after the upgrade.

Step 2: Add the prerequisites

First thing to do is install the upgrade repo so as the root user you need to make a new file in ‘/etc/yum.repos.d/upgradetool.repo’ I use nano but you can use whatever text editor you are used to:

Then add these line to the file

Once done save this file. First we are going to install the pre-upgrade tool and run it to show us any potential problems, so in your terminal

 

Step 3: Verifying the upgrade

Once that has installed run the pre-upgrade check to look for any potential problems, now you don’t have to do this be it’s better to check than not to. So in your terminal

Which gives you a warning and confirmation like

So as we have already make a backup we would type ‘y’ to proceed. Next it will run some checks and give us a out like:

Now you can read the file with the potential upgrade risks but I didn’t all seemed to go well but it doesn’t do any harm as you might have custom programs that will cause problems as all mine were installed from the repos I just went on to the next step which is to import the CentOS 7 repo key so in your terminal

 

Step 4: Starting the upgrade

Then we have to run the upgrade tool, which doesn’t do the upgrade it just downloads the updates needed to do the upgrade, that happens when we reboot the server so in your terminal

 

Step 5: Reboot the server

Once that has finished we are ready to do the upgrade so bit can be a bit hairy because if you are doing this on a remote server then you might not be able to see the boot process unless you have access a online console. The applying of updates will happen while the server is booting and can take 10-15 minutes so if you are doing this blind it can be a bit of a nail bitting moment, but if you have already practiced this like I did in a VM then you should have confidence in it working OK. Thant said if your machine doesn’t come back online i 30 minutes then you may need to restore from your backup (you did do that backup now didn’t you?). So in your terminal

After waiting for about 10 minutes try logging in, if you can’t try again in 10 more minutes and if you still can’t in 30 minutes then you may have to restore to your save point and start again.

Step 6: Check for post upgrade problems

OK if you are still reading this you made it and have successfully logged into your server lets check our version with

And you should see

Run a update

if you get errors saying  ‘libpcre.so.0 is missing’ then try reinstalling pcre.

and if that didn’t work then try symlinking the newer pcre file to the old one with

Reinstall all Apache, MySQL and PHP. Now I didn’t do this, I took the opportunity to install Nginx and MariaDB and compile my own PHP so I will do this in the next few posts.

I have to go now so I hope this has helped someone.

If you want to leave a comment please do and I will try my best at answering.

本文出自 Wiflish's Blog,转载时请注明出处及相应链接。

本文永久链接: http://wiflish.fyard.com/archives/353

发表评论

电子邮件地址不会被公开。 必填项已用*标注

您可以使用这些HTML标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Ɣ回顶部