A VPS is the standard upgrade when conventional shared hosting won’t meet your needs. The catch, and most hosts try not to make this clear, is that you’re then on the hook for all configuration, upgrades, and maintenance. And as an added bonus, many hosts offer default VPS installs configured as though they’re deliberately trying to make administration difficult.

For a recent project hosted on one of our VPSes, I was planning to use Kohana, which requires PHP5. Despite the fact that PHP5 was released in 2004, it wasn’t installed on the VPS in question. As the VPS was running Plesk, any changes to the PHP installation would have to be made carefully so as not to demolish our hosted sites, but research revealed the Atomic Rocket Turtle Repository, designed exactly for upgrading machines such as mine. Except that yum wasn’t even installed.

The procedure was as follows:

Install yum

Note: If you’re following along at home, instead of just copy pasting my terminal commands, you should probably make sure your rpm -Uvh calls are requesting contemporary versions

First, install a key from the CentOS mirrors so rpm will work:
rpm –import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-4

Then, try and fail to install yum in order to get a full list of missing dependencies:
rpm -Uvh http://mirror.centos.org/centos/4/os/i386/CentOS/RPMS/yum-2.4.3-3.el4.centos.noarch.rpm

Next, install each listed dependency with a call to rpm -Uvh

Finally, install yum by re-running the rpm command above

(based on instructions here)

Set up the Atomic Rocket Turtle repository

wget -q -O – http://www.atomicorp.com/installers/atomic.sh | sh

Upgrade PHP

yum upgrade php

Reinstall Ioncube Loader

(Note: As we weren’t using the Ioncube Loader, everything worked without this step. Except that we were getting notices in our logs saying it was missing.)

yum install php-ioncube-loader

Set up new (default) php.ini

mv /etc/php.ini /etc/php.ini.php4
mv /etc/php.ini.rpmnew /etc/php.ini

Restart Plesk

/etc/init.d/psa stopall
/etc/init.d/psa startall
/etc/init.d/psa restart

Miraculously, Plesk restarted successfully and all my applications were fully functional under the new install of PHP5.

I could’ve stopped here, but because the VPS had been running for a few years, and yum hadn’t been installed, I knew that basically everything (if not literally everything) on the server was out of date. Research and testing aside, the above took less than 10 minutes. The below (upgrading everything) took several hours of troubleshooting.

Upgrade everything server-wide

yum upgrade

(Note: This might take a while. I made sure to archive the output, because when anything goes wrong, the clues will show up here.)

Set up new MySQL configuration

(Note: At this point, Plesk wouldn’t restart because MySQL (just upgraded from 4 to 5) was totally broken.)

mv /etc/my.cnf /etc/my.cnf.old
mv /etc/my.cnf.rpmnew /etc/my.cnf

Install new Plesk package to support openssl upgrade

(Note: Now MySQL worked, but Plesk was still broken.)

If you update from an old vesion of openssl, you’re probably going to run into a bug, the quick solution to which you can find here.

Update MySQL databases

(Note: Plesk would restart, but I couldn’t log in.)

mysqlcheck –check-upgrade –all-databases –auto-repair -uadmin -pyouradminpassword