Install and Setup A WordPress Multisite Environment

Install and Setup A WordPress Multisite on Ubuntu

WordPress itself is powerful enough to help you create not only a high-performance blog but also a fully-functioning static or dynamic website. The scope of use does not end here; you can create membership portals, forms, QnA sites, and run a WordPress Multisite network on Ubuntu. 

Yes, a multisite network on Ubuntu. 

The core WordPress files are capable enough to let you turn your single WordPress installation into a fully-functioning multisite network with a few tweaks in the code. For this tutorial, I will go through the LAMP stack installation, WordPress installation and then I will setup the WordPress multisite network on Ubuntu.

About the authorVashishtha Kapoor is a Digital Marketing enthusiast and has over 5 years of experience in SEO, PPC, Website Management and WordPress development. Vashishtha writes about WordPress customizations, website designing, technology trends, and ad-tech topics.

PART 1: Installing LAMP Stack on Ubuntu

To install and setup your WordPress multisite network, first deploy an Ubuntu VPS.

After deploying an Ubuntu 18.04 VPS, SSH into your server as root and run the following commands.

Update and upgrade the packages. This will upgrade all the modules on your VPS to the latest version. The process will take a few minutes so you can go get a coffee and wait till the packages are updated and upgraded.

Install apache2

Whenever it asks for Yes or No, simply press “Y” and then press “ENTER”

MySQL is one of the essential requirements to be able to host a WordPress or multisite network on your Ubuntu server.

Perform a secure installation of MySQL server and set up the essential preliminary factors.

setup VALIDATE PASSWORD plugin? – No
New Password for database root – YOURTOUGHPASSWORD
Re-enter New Password for database root – YOURTOUGHPASSWORD
Remove anonymous users – Y
Disallow root login remotely – Y
Remove test database and access to it – Y
Reload privileges table now – Y

Login to your MySQL server as root with the new password

By default, the root user uses auth_socket plugin. You need to change that for the root user to be able to login using the MySQL native password.

mysql>

Make root use mysql_native_password with the following command. Replace the password with your own tough password.

mysql>

Check if the auth_socket is replaced with mysql_native_password with the command below.

mysql>

Reload the privileges table and exit from the mysql console

mysql>

The latest version of PHP is recommended when hosting a WordPress multisite on your Ubuntu server.

The following command will install the ‘sofware-properties-common’ package which allows us to modify the existing apt repositories via add-apt-repository.

Call the required repositories for php on your VPS

Install all the required modules of php7.4-fpm

You need now to make sure that the apache server serves php files and its priority is on top. To do this, you need to edit the dir.conf file inside /etc/apache2/mods-enabled/ using the below command.

The file should look like this.

<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>

Add index.php to the front of the list under DirectoryIndex initiative.

<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>

Save and exit the file with CTRL + X , followed by Y and ENTER.

Reload the apache2 process

Navigate to /var/www and remove the default html folder

Create a new folder for your domain. The name of the folder is your choice. Replace the domain.com with your own domain name and run the command.

Give permissions to the www-data user on the directory /var/www/domain.com with the following command.

To setup the virtual host and map your domain to /var/www/domain.com, create your own domain.conf in /etc/apache2/sites-available/

Replace domain with your domain name and run the command given below.

Paste the following content and replace your_domain with your domain name and domain.com with the name of folder you created earlier. 

<VirtualHost *:80>
ServerAdmin [email protected]
ServerName your_domain
ServerAlias www.your_domain
DocumentRoot /var/www/domain.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<Directory /var/www/domain.com>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

Install and Setup A WordPress Multisite on Ubuntu

Read more: How To Create Custom WordPress Templates

Test your apache virtual host configuration 

Enable domain.conf site to resolve on port 80 and server content from /var/www/domain.com

Disable the default site configuration file and remove it from sites-available folder

To make sure the install and setup of your WordPress is smooth, restart the apache server and test your configuration again

Install and Setup A WordPress Multisite on Ubuntu

Create a PHP file on your server to test if it is working properly.

Paste the following content in the editor.

Save and exit the file with CTRL + X , followed by Y and ENTER.

Check the configuration by opening http://yourdomain.com/info.php in your browser.

It should return a page like this with details of your php configuration.

php configuration for WordPress

Remove the info.php and index.html text files we created to test if apache2 is working properly.

Two more parts until you’re done setting up your WordPress multisite network.

Part 2: Installing WordPress on LAMP Stack

Now you’re all set to install WordPress on your VPS/. But first, let’s set up the database for your WordPress installation.

Login to MySQL as root with the password.

Type your password and press ENTER

We’re now using the MySQL console which will allow us to create our database. Replace yourdatabasename with your desired database name.

mysql>

Create a database user and set the password for it using the following command. Replace dbuser with your desired username and password with a strong password.

mysql>

You can not access the database unless you grant permissions to the newly created user on the database. Grant permissions with this command:.

mysql>

Reload the privileges table and exit the MySQL console. 

mysql>

mysql>

We have now set up the database and prepared it to be configured to a WordPress site. All you need now is to upload the WordPress core files in the document root of your domain. 

Install zip and unzip as a preliminary feature to be able to unzip WordPress. 

Change your directory to /var/www/domain.com/ 

Once you’re in the document root of your domain, use the wget command to download the latest version of WordPress. The following command will download a file titled latest.zip to the current working directory.

Extract latest.zip and delete the zip file

Now, you should see a folder named wordpress in your document root. You have to move all content that is inside this folder to your document root. 

Remove the wordpress folder

Rename wp-config-sample.php to wp-config.php

Install and Setup A WordPress Multisite on Ubuntu

Open wp-config.php using the nano editor

Change the values marked with bold. You need to type the database name, database user and database password here.

Save and exit the file with CTRL + X , followed by Y and ENTER.

Enable rewrite module and restart apache2 so that permalinks will work properly. Otherwise, you will be entertained by a “404 not found” result on any post or page in WordPress.

Open yourdomain.com in your browser and complete the installation of WordPress.

wordpress on lamp stack

Choose your preferred language and click continue. 

wordpress on lamp stack

On successful completion, you will see the SUCCESS screen. Click login and you will land into your WordPress dashboard. 

wordpress on lamp stack

You’re almost done setting up your WordPress multisite network on Ubuntu!

PART3: Configure and set up Multisite Network

Use nano editor to edit the wp-config. php file

Add the below line after define( ‘DB_COLLATE’, ” );

Go to Tools >> Network Setup

wordpress on lamp stack

Configure the way you want your multisite network on Ubuntu to be set up. 

wordpress on lamp stack

Once you’re sure that you want sites to use a sub-domain or a sub-directory, choose a Network Title, add an Network Admin email and click INSTALL.

Note: You would need a wildcard * A record if you want your multisite network to use the sub-domain option. However, no DNS change would be required in case of a multisite network using sub-directories.

When you click install, the setup wizard will ask you to change the wp-config.php and .htaccess file like this. 

Install and Setup A WordPress Multisite on Ubuntu

Read more: 10 Must-Have WordPress Plugins For 2020

Edit wp-config.php with the nano editor and add the code above the line reading /* That’s all, stop editing! Happy publishing. */:

Save and exit the file with CTRL + X , followed by Y and ENTER.

Likewise, edit the .htaccess file, replace the whole content of the .htaccess file 

# add a trailing slash to /wp-admin

Save and exit the file with CTRL + X , followed by Y and ENTER.

Once you’re done editing the wp-config.php and .htaccess files, login to your WordPress site.

You should now be able to create multiple site in your WordPress multisite network from 

Read more: Top CSS Frameworks For Web Development In 2020

My Sites >> Network Admin >> Sites

Install and Setup A WordPress Multisite on Ubuntu

Enjoy your WordPress Multisite Network on Ubuntu

There it is! Now that you’ve properly installed and setup your WordPress Multisite network on Ubuntu, you can now enjoy efficient managing for your blogs or websites. By doing this, you are able to have more control and maximize the potential of using WordPress and your own server. How are you deciding to use your multisite network?

(Visited 54 times, 1 visits today)

Share this post with your friends

Share on facebook
Share on twitter
Share on linkedin