Installing Percona Server on a CentOS VPS
We’re speed freaks here at VPS.NET. We’re constantly tweaking kernels, services, and optimizing our code to make sure things are faster than you can even imagine. Nobody likes a slow site — especially not Google. So, a fast site can not only keep users on your site longer, but also help you attract new traffic.
One of the newest tools we’ve started using to increase the speed of sites is a drop in MySQL replacement, Percona Server. Percona’s been around quite awhile, and like us, they’re also obsessed with speed. They’ve developed a drop in replacement that is compatible with MySQL databases and also cPanel servers.
We’ve found that while MySQL works amazingly well for most sites, sites that see over 20-30 visitors online at a time, Percona accels. Performance is more consistent, while also being sometimes upwards of 30-40% faster. Percona has published benchmarks themselves, which we’ve found to be inline with our own tests. Enough about it the server though, lets get to installing it!
Since almost all of our users will already have MySQL installed, we’ll start with removing it first. We can remove the MySQL service, without effecting the existing databases. Our first step will be to stop the running services to avoid corruption:
/etc/init.d/httpd stop ; /etc/init.d/exim stop ; /etc/init.d/pure-ftpd stop ; /etc/init.d/cpanel stop ; /etc/init.d/crond stop ; /etc/init.d/mysql stop ; /etc/init.d/exim stop ;
Next we’ll want to find out what MySQL packages are currently installed. We can do that by running the following command:
yum list installed | grep -i mysql
In almost all circumstances, we’ll see something like the following:
root@server1 [/]# yum list installed | grep -i mysql
MySQL-bench.x86_64 5.0.92-0.glibc23 installed
MySQL-client.x86_64 5.0.92-0.glibc23 installed
MySQL-devel.x86_64 5.0.92-0.glibc23 installed
MySQL-server.x86_64 5.0.92-0.glibc23 installed
MySQL-shared.x86_64 5.0.92-0.glibc23 installed
We can then remove the packages, as they’ll no longer be necessary. As a note, when we remove these packages the databases will still be intact, however, when performing any service maintenance, it is always wise to backup all data. We can remove the packages by running the following command:
yum remove MySQL*
We can now work towards installing Percona. First we’ll need to add the repository:
rpm -Uvh http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpm
We can now install the RPMs by running the following command:
yum install Percona-Server-client-51 Percona-Server-server-51
After successful installation, it is safe to restart all services.
/etc/init.d/httpd start ; /etc/init.d/exim start ; /etc/init.d/pure-ftpd start ; /etc/init.d/cpanel start ;/etc/init.d/crond start ; /etc/init.d/mysql start ; /etc/init.d/exim start
Some users may need to recompile PHP in order for dynamic pages to work properly. cPanel users will want to login to WHM, and go to the Update preferences. From there, simply choose for cPanel to never update MySQL. It should be noted that you will be responsible for maintaining Percona in the future, and will be required to manually update it.
Enjoy the increased performance, and we’ll continue to do what we can to make sure your website is online and fast. If you’re using Percona, you may want to look into using LiteSpeed, which is another way to increase the speed and stability of your site, and is available from VPS.NET for $14 a month.