In this post, we describe how to install and configure multiple WordPress sites with the latest WordPress version on CentOS 7 in a single WordPress instance. A little background of WordPress, WordPress started in 2003 by Matt Mullenweg with a single bit of code to enhance the typography of blogging. Since then, it has grown to be the largest self-hosted blogging tool in the world, used on millions of sites and seen by tens of millions of people every day.
This tutorial explains the process of installing WordPress 4.0 on CentOS 7.0 in the form of a simple-to-follow guide. We will be using CentOS 7.0 server, so you should set up a basic CentOS 7.0 server installation before you continue with this tutorial. The system should have a static IP address. I use
126.96.36.199 as my IP address in this tutorial and
multisite.wpbullet.com as the hostname. You must have a LAMP server installed with CentOS 7.0 as mentioned in the tutorial to continue further.
1. Database Setup
We will start by creating the database for the WordPress 4.0 installation as follows:
mysql -u root -p
Here we are adding database=wordpressdb user=wordpressuser and password=wordpresspassword:
CREATE DATABASE wordpressdb; CREATE USER [email protected] IDENTIFIED BY 'wordpresspassword'; GRANT ALL PRIVILEGES ON wordpressdb.* TO [email protected]; FLUSH PRIVILEGES; exit
2. Installation of WordPress 4.0
We will first make a directory temp in which I will the download the latest version of the WordPress as listed below. Also, we need to allow the web server itself to write to this directory. We can do this by assigning group ownership of this directory to our web server. This will allow the web server to create files and directories under this directory, which will permit us to upload content to the server. Proceed like this:
mkdir temp cd temp yum install wget unzip net-tools wget http://wordpress.org/latest.zip unzip -q latest.zip -d /var/www/html/ chown -R apache:apache /var/www/html/wordpress chmod -R 755 /var/www/html/wordpress mkdir -p /var/www/html/wordpress/wp-content/uploads chown -R :apache /var/www/html/wordpress/wp-content/uploads cd /var/www/html/wordpress/ cp wp-config-sample.php wp-config.php nano wp-config.php
At this point we set up the config file for the wordpress folder
[...] // ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'wordpressdb'); /** MySQL database username */ define('DB_USER', 'wordpressuser'); /** MySQL database password */ define('DB_PASSWORD', 'wordpresspassword'); [...]
Further moving ahead if you wish to work with images, install plugins and site update with SSH credentials then we will install:
3. Multiple site configuration
Now we will proceed with the multiple site configuration, for this we need to add these lines to our wp-config.php file just above the /* That’s all, stop editing! Happy blogging. */ line.
[...] /* Multisite */ define('WP_ALLOW_MULTISITE', true); /* That's all, stop editing! Happy blogging. */ [...]
4. Apache Mod Rewrite Configuration
We will modify the apache virtual host file for WordPress to get it allowed for .htaccess overrides. For this we will edit the virtual host file and add the entries as:
...] # Further relax access to the default document root:
# # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.4/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride All [...]
Change the value from AllowOverride None to AllowOverride All, next restart the service:
service httpd restart
.htaccess File Update
Now we will create .htaccess file in document root, it will allow Apache to rewrites:
We need the web server to be the group owner though, so we should adjust the ownership as follows:
chown apache /var/www/html/wordpress/.htaccess
If you want WordPress to automatically update this file with rewrite rules, you can ensure that it has the correct permissions to do so by using:
chmod 664 /var/www/html/wordpress/.htaccess
If you want to update this file manually for the sake of a small security gain, you can allow the web server only read privileges by typing:
chmod 644 /var/www/html/wordpress/.htaccess
In this case, we are using the permission 644.
Now proceed to the web installation of WordPress 4.0. Go to the URL
Now give the values as I gave in my case
Site Title = WordPress-testsite Admin Email = [email protected] Username = admin Admin password = wpbullettest Confirm Admin Password = wpbullettest
The above values will differ in your case, you can give any values of your choice. After giving the values press InstallWordpress:
Join over 20,000 users and get our best content
Each week we send 1 email to 20,000 smart entrepreneurs just like you. Enter your email below to join the crew.
Thank you for subscribing.
Something went wrong.