How to install WordPress Multisite on Centos VPS with Apache

how-to-install-wordpress-multisite-on-centos-vps-with-apache

Today we will guide you through the installation process of WordPress Multisite on your Centos VPS. The WordPress Multisite option became available with WordPress 3.0. This feature allows you – the website administrator – to create multiple websites without the need of installing separate WordPress instances, creating separate home directories or separate databases. Or, you can allow other users to create their own websites on your WordPress installation.


Although these websites don’t have their separate root directories or databases, they do have a separate uploads directories as well as tables in the database. All of the users in the network (multisite) can also share themes and plugins amongst themselves. All in all, pretty handy feature if you have the needs described above.

In this article I assume you have either set your server up with a full CentOS6 template (LAMP stack installed), or you have already installed fully working LAMP or LEMP stack on your Centos VPS.

If that’s not the case, then before beginning you can check out this LAMP stack tutorial and simply go on with this tutorial, or refer to this full wordpress LEMP stack tutorial and after that continue the installation from here.

Ok, enough talk, let’s do some work.

First, let’s create the apache virtual directive. To do that, edit the apache config file as follows:

# vim /etc/httpd/conf/httpd.conf

ServerAdmin admin@yourdomain.tld
DocumentRoot /var/www/html/yourdomain.tld
ServerName yourdomain.tld
ErrorLog /var/log/httpd/yourdomain.tld-error_log
CustomLog /var/log/httpd/yourdomain.tld-access_log common

Then, we will download the latest version of wordpress in your root directory and set it up just like any other regular install. Type the following:

or, if you prefer .zip over .tar.gz, type:

# cd /var/www/html/yourdomain.tld && wget http://wordpress.org/latest.zip
# unzip -qq latest.zip
# mv wordpress/* .
# rmdir wordpress
# rm -f latest.zip

Set the rightful owner of the root directory by executing:

# chown -R $(ps auxf | grep -v grep | grep http | tail -1 | awk {'print $1'}): /var/www/html/yourdomain.tld

Copy the sample config file:

# cp -pv /var/www/html/yourdomain.tld/wp-config-sample.php /var/www/html/yourdomain.tld/wp-config.php

Now, at this point we will create the necessary database and set the relevant information in the config file. Log in to mysql as user root and execute:

# mysql -uroot -p

mysql> create database wordpressDB
mysql> grant all on wordpressDB.* to WPuser@localhost identified by "sEcReT_pASsWoRd"
mysql> \q

Let’s edit the wp-config.php file. Use your favorite text editor:

# vim /var/www/html/wordpress/wp-config.php

/** The name of the database for WordPress */
define('DB_NAME', 'wordpressDB');

/** MySQL database username */
define(‘DB_USER’, ‘WPuser’);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘sEcReT_pASsWoRd’);

Then, visit your domain or ip address in a browser and set the needed information to finish the installation:

Site Title: yourdomain.tld

This step is important for further use of the multisite network. If you want the sites to be created as subdomains (site1.yourdomain.tld, site2.yourdomain.tld etc) then fill this field with the domain only (without “www” in front of it, because you will probably not like it if the websites’ urls are something like site1.www.yourdomain.tld).

If you want the sites to be created as subdirectories, then you can also enter www.yourdomain.tld as the user websites will have the url www.yourdomain.tld/site1)

After you fill all of the required fields, click Install.

Now the installation of wordpress is over. Before logging in we need to make another change in the wp-config.php file in order to enable the multisite option.

To do that, find this line => /* That’s all, stop editing! Happy blogging. */ <= in your wp-config.php file and just above it add the following lines:

# vim /var/www/html/yourdomain.tld/wp-config.php

/* My multisite config starts here */
define('WP_ALLOW_MULTISITE', true);

Now you can log in with the credentials you set up and install the multisite feature. Once logged in, go to

Tools >> Network Setup

Select the preferred address option for your websites. This can not be changed later.

NOTE: If you want to use the ‘Sub-domains’ option, you will need a wildcard DNS record for your domain. Please contact us (or your provider) if you don’t know how to set the wildcard DNS record.

Next, choose your Network Title, enter your email address and click Install.

Follow the instructions and after you make a backup of the .htaccess and wp-config.php files, edit them as suggested and save the files.

Click on the Log In link again to log in and you’re ready to go! And that’s it. We have just installed WordPress Multisite on your Centos VPS server.

To create a new site go to My Sites >> Network Admin >> Dashboard.

Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install this for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Leave a Comment