This post is part of a step-by-step series on installing WordPress on Linux (CentOS 6)
After setting up a network wordpress site you may want to install some plugins. So in the network admin dashboard we click on
Plugins and search for some way to install it as we are used to with the regular wordpress site. But lo and behold there is no way to install new plugins. Instead we have to do it on the server side.
Locating the Plugins Directory
Go to the wordpress root directory. When I installed wordpress I put it as follows:
[ahmed@amayem ~]$ cd /var/testblog/
Let’s take a look inside:
[ahmed@amayem testblog]$ ls index.php wp-includes wp-activate.php wp-links-opml.php wp-admin wp-load.php wp-blog-header.php wp-login.php wp-comments-post.php wp-mail.php wp-config.php wp-settings.php wp-config-sample.php wp-signup.php wp-content wp-trackback.php wp-cron.php xmlrpc.php
The plugins directory should be under
[ahmed@amayem testblog]$ cd wp-content/plugins/ [ahmed@amayem plugins]$ ls akismet hello.php index.php
Looks good, it has the default plugins.
Downloading a Plugin
Go to WordPress Plugins and choose your desired plugin. I will go with WordPress MU Domain Mapping. Right click the download button and copy the link. Go back to your server console and use
wget to download the plugin:
[ahmed@amayem plugins]$ wget http://downloads.wordpress.org/plugin/wordpress-mu-domain-mapping.0.5.4.3.zip --2014-09-03 21:04:21-- http://downloads.wordpress.org/plugin/wordpress-mu-domain-mapping.0.5.4.3.zip Resolving downloads.wordpress.org... 188.8.131.52, 184.108.40.206 Connecting to downloads.wordpress.org|220.127.116.11|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 23667 (23K) [application/zip] wordpress-mu-domain-mapping.0.5.4.3.zip: Permission denied Cannot write to `wordpress-mu-domain-mapping.0.5.4.3.zip' (Permission denied).
Oops we need
sudo. Check here to see how to give a linux user sudo powers.
[ahmed@amayem plugins]$ sudo wget http://downloads.wordpress.org/plugin/wordpress-mu-domain-mapping.0.5.4.3.zip
Now let’s check it’s there:
[ahmed@amayem plugins]$ ls akismet hello.php index.php wordpress-mu-domain-mapping.0.5.4.3.zip
It’s there as a
.zip file. Let’s unzip it:
[ahmed@amayem plugins]$ sudo unzip wordpress-mu-domain-mapping.0.5.4.3.zip Archive: wordpress-mu-domain-mapping.0.5.4.3.zip wordpress-mu-domain-mapping.0.5.4.3 packaged creating: wordpress-mu-domain-mapping/ inflating: wordpress-mu-domain-mapping/Changelog.txt inflating: wordpress-mu-domain-mapping/domain_mapping.php inflating: wordpress-mu-domain-mapping/readme.txt inflating: wordpress-mu-domain-mapping/wordpress-mu-domain-mapping.pot inflating: wordpress-mu-domain-mapping/sunrise.php
Looks good, now let’s remove the zip file:
[ahmed@amayem plugins]$ ls akismet hello.php index.php wordpress-mu-domain-mapping wordpress-mu-domain-mapping.0.5.4.3.zip [ahmed@amayem plugins]$ sudo rm wordpress-mu-domain-mapping.0.5.4.3.zip [ahmed@amayem plugins]$ ls akismet hello.php index.php wordpress-mu-domain-mapping
Checking the Plugin Exists in the Dashboard
When you go back to your admin dashboard, refresh the plugins page and you should see that plugin there. Congratulations!
Network Activate the plugin
Before it starts working you will have to activate the plugin in the plugins page in the super user dashboard. For the MU plugin you might have to do the following steps before you see
Domain Mapping under settings.
Further Plugin-Specific Steps
Some plugins may have their own steps afterwards. In my example I used WordPress MU Domain Mapping, which has some more steps. I will continue them here.
Moving sunrise.php into wp-content
[ahmed@amayem plugins]$ cd wordpress-mu-domain-mapping/ [ahmed@amayem wordpress-mu-domain-mapping]$ ls Changelog.txt domain_mapping.php readme.txt sunrise.php wordpress-mu-domain-mapping.pot [ahmed@amayem wordpress-mu-domain-mapping]$ sudo mv sunrise.php ../../sunrise.php [ahmed@amayem wordpress-mu-domain-mapping]$ cd ../../ [ahmed@amayem wp-content]$ ls index.php plugins sunrise.php themes upgrade uploads
[ahmed@amayem wp-content]$ sudo vi ../wp-config.php
As per the instructions:
uncomment or add the SUNRISE definition line. If it does not exist please ensure it’s on the line above the last “require_once” command. define( ‘SUNRISE’, ‘on’ );
So to find this we will do a search by entering
/SUNRISE and pressing enter. Either you will find the string or get,
E486: Pattern not found: SUNRISE. If you haven’t found it then let’s search using
/require_once. You should find one match. To move to the next occurrence press
n. Once you are at the last match, move the cursor to the line above, and enter insert mode by pressing
i. Put in the following line:
define( 'SUNRISE', 'on' );
Exit insert mode using
ctrl+c then save by entering
Setting up the Domain Mapping IP
Domain Mapping Settings page, put in the ip address of your server. This is how you can get it:
[ahmed@amayem ~]$ ifconfig | grep inet [ahmed@amayem ~]$ ifconfig | grep inet inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host inet addr:127.0.0.1 P-t-P:127.0.0.1 Bcast:0.0.0.0 Mask:255.255.255.255 inet addr:18.104.22.168 P-t-P:22.214.171.124 Bcast:126.96.36.199 Mask:255.255.255.255 inet addr:188.8.131.52 P-t-P:184.108.40.206 Bcast:220.127.116.11 Mask:255.255.255.255
So for me the ip address would be:
18.104.22.168. Press on Save.
Setting up Your Server (Apache)
I am using Apache to serve my WordPress network. We need to tell Apache to forward all incoming requests that come on the ip we set above to our WordPress root directory. If you are running another site on the same server and there is only one ip then the problem can be solved by putting a virtual host for your other site. If you have more than one ip, then assign one just for your WordPress and the other for your other sites. Luckily I have two
ips. So I will assign the
254 ip to the network.
httpd.conf file for editing.
[ahmed@amayem ~]$ sudo vi /etc/httpd/conf/httpd.conf
go to the bottom by entering
NameVirtualHost *:80 is commented then uncomment it by removing the
# in the beginning.
<VirtualHost 22.214.171.124:80> DocumentRoot /var/testblog/ ServerName your.domain.com </VirtualHost>
Exit insert mode using
Ctrl+c then save by entering
:x. Restart Apache:
[ahmed@amayem ~]$ sudo apachectl restart
Now check it’s working by pointing your browser at that ip. Your network site should appear.
Commenting Out COOKIE_DOMAIN in wp-config.php
[ahmed@amayem ~]$ sudo vi /var/testblog/wp-config.php
Search by entering
/COOKIE. If you found nothing then you are in luck and don’t have to do anything. If you did then you have comment it by surrounding it with
Setting the ANAME of your User’s Domain
Go to the DNS record of your users domain, and add a record there that points to your WP Netork’s ip. You can either have the original domain point to the ip or make a subdomain point to the ip. I made a subdomain called test. It looked something like the following:
Here test is a subdomain. To make the domain point to that ip switch
Making the Domain Mapping
First make a new site by going to
Add New under
Sites in the Super Admin dashboard. After making it, we need to find the id of that site. Unfortunately blog id of the blogs is not shown in the table when you are viewing
All Sites. To find out the blog id just hover over the blog name to see the link. You should see something at the end that looks like this:
n is the blog id. We will need that number. Now go to Settings -> Domains. Put in the blog id and the domain mapping (the name of the domain you want to see your new site under), and save it. Now when you go back to Sites -> All Sites you should be able to see the domain mapping.