Open Source Software Technical Articles

Want the Best of the Wazi Blogs Delivered Directly to your Inbox?

Subscribe to Wazi by Email

Your email:

Connect with Us!

Current Articles | RSS Feed RSS Feed

How to upgrade a badly out-of-date version of CentOS

  
  
  

When you update the packages on a badly outdated server, the challenge is to do the upgrades without breaking anything. When dealing with a CentOS installation that's two or three versions behind the current release, a direct upgrade simply isn't the safest option.

CentOS uses the yum utility for its package management. For the most part yum is a great tool for software management and updating existing software titles, but it's not your best choice for a distribution upgrade tool. If you attempt to run the yum upgrade command on a CentOS install that is too old, you're likely to experience numerous software dependency errors from yum trying to access dead repositories, and that will inhibit your ability to update or install software.

Instead of running yum upgrade in scenarios like this, you're better off performing a clean install of the latest CentOS version. With this approach you start with a clean, vanilla installation instead of one that has likely been tweaked heavily over time, and likely do so in less time that it would take to upgrade the old server through multiple CentOS version upgrade paths.

I also advocate using a separate hardware server for the clean installation, rather than relying on the existing server hardware. Doing so minimizes downtime – once the new hardware is running, you can simply swap it with the old hardware to complete the transition. Backing up the old server, wiping its hard drives, installing a fresh operating system, and then hoping the backup files are intact isn't a prudent way to upgrade any server. Because if something goes wrong, you're looking at the potential for additional downtime while you begin troubleshooting the problem. So by keeping the original server intact, you have a fallback plan should the restore files end up being corrupted or you run into other problems.

Before you install the new CentOS release on your new server, however, you need to take a few additional steps.

Back up the old server

First, back up important settings and data from the old CentOS installation. I recommend using the following tools for the task.

mysqldbcopy is one of the best methods for backing up and restoring a MySQL database. Use mysqldbcopy to back up your server's MySQL databases by following the guide provided in this article on MySQL utilities.

cPanel is both a solid control panel and a reliable way to back up your web server's settings. Install it on the server you wish to upgrade. To start a backup, browse to your server's IP address and log in. Start cPanel, and in the Files section, click on Backup Wizard.

Select the Backup button in the middle of the page. I suggest you choose the partial backup option in order to back up your home directory structure and email separately so that you can restore them separately. You can use cPanel to back up MySQL too, but I've found that mysqldbcopy provides a more reliable database backup.

Using cPanel to back up your home directory will back up most of your application settings for you. However if you have additional applications that don't store settings within your home directory structure, you will need to use browse to that specific application's settings directory, then use the tar command to back up those specific settings. Once the application is installed on the new server, use tar's extract option to restore the settings.

Set up the new server

Once all of the critical server data is backed up from the old machine, it's time to prepare the new server.

To get the current version of CentOS, visit the CentOS download page and download the minimal CD to your installation media. Run the install from the text installer. When it asks to install or upgrade an existing system, press the tab key, browse to the end of the line that contains "vmlinuz," and enter in the word text. This will give you the option of running the installer from a command prompt. I recommend sticking to the minimal ISO install, without a GUI, for a server environment.

Once your server is running a clean new copy of CentOS, log in, open a terminal, and install Apache and MySQL with the command yum install httpd mysql-server mysql. Start both services with the commands:

service httpd start
service mysqld start

Also make sure both services start up automatically when the server is restarted in the future with the commands:

chkconfig –levels 235 mysqld on
chkconfig httpd on

You can then log in to MySQL and set up passwords:

mysql -u root
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new-password');
SET PASSWORD FOR 'root'@'localhost.localdomain' = PASSWORD('new-password');
SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('new-password');

With MySQL installed and running, use the instructions in the MySQL Utilities article mentioned previously to restore your database onto the new server.

After Linux, Apache, and MySQL, the fourth pillar of the LAMP stack is PHP. Install it with yum install php php-mysql, then restart Apache with the command service httpd restart.

To verify that PHP is running properly, create a PHP test file in /var/www/html/info.php with the following code:

<?php
phpinfo();
?>

Browse to the URL of the info.php file and, if everything is working correctly, you should see a page with all of your PHP info.

PHP information

Now you can install all the apps that were on the old server and then restore your server configuration. Mount the media containing your installed-software.log file to reinstall your legacy applications from the old server:

yum -y install $(cat /mounted-backup-location/installed-software.log)

Next, visit the cPanel Backup Wizard on the new server, but this time click on Restore and repeat the steps you took to back up your home and mail data. You will be prompted to browse for the files on your local workstation, then asked to click on the upload button in the middle of the page.

Summary and considerations

While taking so many steps to update an old CentOS installation may seem unnecessary at first, this approach can save you days of frustration, as it avoids the yum upgrade method, which is prone to problems. A clean installation with restored applications and settings wins over a messy upgrade path every time.




This work is licensed under a Creative Commons Attribution 3.0 Unported License
Creative Commons License.

Comments

Not only is it Marilyn's chosen odour, Chanel Hardly any. 5, for example some other iconic omega replica, collateralled the spot during the talent society. During 1959 Andy Warhol, some sort of well known on his own, managed a number of ten silkscreens within the Chanel Hardly any. 5 product, as just stated making it feel like any parfum that will covet. Any parfum these days provides a good product every last 33 minutes as well as being the top end reselling parfum worldwide. Models also sign up that will use it, and also current spokesperson is certainly Nicole Kidman, these days reportedly among the many optimum money making post models for that reason. Any offers are based on Baz Luhrman's Moulin Rouge, a good video clip wherein (potentially possibly not coincidentally), Nicole will pay for gratitude that will Marilyn Monroe during vocal singing her own adaptation for Marilyn's "Diamonds would definitely be a Female's Perfect Friend". Coco Chanel's Important Way Triumphs. Gabrielle “Coco” gucci replica came into this world during 1883, whilst from a step amusingly the same as many ladies at this time your sweetheart maintained of having happen to be launched a long time subsequently. Your sweetheart open your girlfriend earliest millinery purchase during 1912, reselling effortless tailor-made dresses meant for the sexes, and even perfume, jewelry together with textiles. Coco Chanel theorized that women have to dress in perfume wheresoever these were going to get kissed. Apart from your girlfriend Hardly any. 5 perfume chanel replica bags at the same time generated fashionable classics when using the Chanel cardigan, any cartier replica Meet and also little black dress, these days a good staple in the majority of unique wardrobes. During the '70s, Coco created bell underside together with pea leather coats for girls. chanel replica did the trick before your sweetheart was killed during 1971, exiting Karl Lagerfeld during your girlfriend stead that will when the venture fashionable for Chanel 
Posted @ Wednesday, July 30, 2014 1:38 AM by mnaywa
Post Comment
Name
 *
Email
 *
Website (optional)
Comment
 *

Allowed tags: <a> link, <b> bold, <i> italics