How to Install WordPress on CentOS 5 in five minutes flat

Ok, so you need to install WordPress on a CentOS or Red Hat server, and the boss has only given you five minutes, then read on because here you can do it in less...

This how to assumes that you have a clean installed CentOS 5 or Red Hat server, but it will probably work just fine with Fedora as well. If you already have MySQL or Apache installed then you might need to make provisions for the existing setup to avoid any conflict.

So without further waffle, here it is. Fire up a root shell and continue:

Install the required system packages

yum -y install mysql-server httpd php php-mysql unzip wget

chkconfig httpd on
chkconfig mysqld on

/etc/init.d/mysqld start
/etc/init.d/httpd start

Create a WordPress database and MySQL User

NB this assumes that your mysql root user has no password, which is generally considered a bad idea for production systems, although for the purposes of this howto this is sufficient to get you up and running.

echo 'CREATE DATABASE wordpress;' | mysql
echo "GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost' IDENTIFIED BY 'an-awesome-password';" | mysql
echo "FLUSH PRIVILEGES;" | mysql

Download Wordpress

cd /var/www/html
# remove superfluous directory
mv wordpress/* ./
rmdir wordpress/
# wordpress needs these to be writable by the webserver
mkdir wp-content/uploads wp-content/cache
chown apache:apache wp-content/uploads wp-content/cache

Configure WordPress

# copy default config
cp wp-config-sample.php  wp-config.php

# set username / password
# make sure you change your password to something more awesome
sed -i -e 's@putyourdbnamehere@wordpress@' wp-config.php
sed -i -e 's@usernamehere@wordpress@' wp-config.php
sed -i -e 's@yourpasswordhere@an-awesome-password@' wp-config.php

That's it. Stop the clock. The server configuration is complete, and your job is safe. Now fire up your web browser and complete the online configuration:



— Andrew

Next entry

Previous entry

Related entries

Similar entries


  1. Matt
    Matt on 05/22/2010 1:39 a.m.

    you missed a bit:

  2. Tyson
    Tyson on 08/11/2010 5:55 p.m.

    Awesome! Took me way less than 5 minutes. The sed string you searched has changed to the following:database_name_here
    Fantastic info, thank you very much!

  3. sg
    sg on 11/01/2010 6:19 p.m.

    This is a great post. Terse + Complete = Fast.
    Thank you.

  4. ActionJack
    ActionJack on 11/27/2010 4:44 p.m.

    Hi just referenced your article in my poost Wordpress 0 to 60 installation in 5 minutes flat at it's #Devops friendly with puppet and kickstart code snippets included. Thanks for your hardwork on this.

  5. exone
    exone on 12/02/2010 4:54 p.m.

    PHP doesn't seem to work,
    CentOS 5. Should work right?

  6. carbonytte
    carbonytte on 12/22/2010 12:09 p.m.

    just helping Adlibre owner here.
    @exone, as long as you install the stuff Adlibre mentioned, you should be on the right track. If the error is something like PHP not installed or not active, most probably you need to restart your httpd to make sure php would work. "service httpd restart" :)

  7. Kaustubh P
    Kaustubh P on 01/28/2011 2:06 a.m.

    Great, that was a hit! Keep up the good work!

  8. john maclean
    john maclean on 05/08/2011 5:14 p.m.

    you make it look too easy. it is thanks to you ;-)

  9. Andrew
    Andrew on 06/01/2011 10 p.m.

    @Matt, thanks. I'll update the blog post to enable modrewrite.


Pingbacks are open.

Post your comment

Site theme originally by