Installing WordPress on CentOS 6.x

Let’s say you’ve got your new CentOS 6.x server up and running, with a minimal install. It is very easy to install the necessary items (including Apache, MySQL etc.) alongside WordPress to fully function.

First, let’s install the LAMP installer for CentOS 6.x With this script, you’ll get everything you need to turn your Linux box into a web server. Details on how to use it is available on

After this, we can easily get the wordpress installation and simply extract it.

tar -xzvf latest.tar.gz

Now get into MySQL using the password you’ve specified to

mysql -u root -p

Below, we’ll create a new database and new user to affiliate with.

CREATE USER wordpressuser@localhost;
SET PASSWORD FOR wordpressusername@localhost= PASSWORD("password");
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressusername@localhost IDENTIFIED BY 'password';

Of course, you’ll have to replace “wordpressuser” and “password” with yours.
After creating the necessary database, we tell wordpress itself about these.

cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php
vi ~/wordpress/wp-config.php

Open and edit the wp-config.php file according to change the database info as below (yet again, replace with yours)

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');

/** MySQL database username */
define('DB_USER', 'wordpressuser');

/** MySQL database password */
define('DB_PASSWORD', 'password');

Save and exit.
Now we should move our files to the user folder we've created with and change the files' owner.
cp -r ~/wordpress/* /home/username/public_html/
chown -R username:username /home/username/public_html/
chmod -R 755 /home/username/public_html/

Now visit your domain, or IP address on your browser. It will redirect you to the WordPress onscreen installation instructions. If it doesn’t, add “wp-admin/install.php” to the end. (like

And you’re done!

Also, if you want to import an XML file from your old WordPress blog or something, you’ll need to install the php-xml package.

yum install php-xml