WordPress Installation Guide: Install and Configure Latest WordPress on Ubuntu Linux

This WordPress installation guide helps you to install and configure the latest WordPress on an Ubuntu Linux box. It covers Apache, MariaDB, PHP and WordPress configurations.

WordPress Installation Guide

This installation guide covers the following.

  1. Installation and configuration of Apache2
  2. Installation and configuration for MariaDB
  3. Installation and configuration of PHP and Apache modules.
  4. WordPress apache configurations with a domain name.
  5. Accessing the WordPress dashboard.

Follow the steps given below for the complete WordPress setup on Ubuntu 16.04

Install and Configure Apache 2

Step1: Login to the server and update the package repos.

Step 2: Install apache2

Step 3: Execute the following command to disable anonymous directory listing.

Step 4: Start, enable and check the status of apache2

Install and Configure MariaDB

Step 1: Install Marais DB database server and client

Step 2: Use the following commands to Start,  Stop, enable and check the status of MariaDB service.

Step 3: Setup the root admin password for the database using mysql_secure_installation command. It will prompt you for setting up the new password.

Use the following options for the prompt.

Step 4: Restart the database server for the changes to take effect.

Setup and Configure PHP

Step 1: Install PHP 7 and its related modules.

Step 2: Open  /etc/php/7.0/apache2/php.ini file

Add the following contents to the file.

Configure Database For WordPress

Step 1: Login to the database using the password you set for root.

Step 2: Create a database named “wordpress-db”

Step 3: Create a new databases user named “wordpress-admin” and set a custom password. This user will be used in the WordPress configuration.

Step 4: Grant all privileged on wordpress-db for wordpress-admin user. Replace the password you set for wordpress-admin.

Step 5: Flush all privileges and exit the db shell.

Setup and Configure WordPress

Step 1: Download latest WordPress

Step 2: Untar the WordPress files

Step 3: Move the WordPress folder to /var/www/html folder.

Step 4: Change the ownership of the wordpress folder to www-data

Step 5: Change the folder and file permissions using the following command. Folders should have 755 permission and files should have 644 permission.

You can check if the permissions have been applied using the following command.

Configure Apache For WordPress

Step 1: Create a new Apache configuration named wp-site.conf for the WordPress site.

Add the following configuration to the file and save it. Replace yourdomain with you custom domain name.

Step 2: Enable wp-site.conf

Step 3: Enable the apache rewrite module.

Step 4: Restart the apache server.

Configure WordPress

Step 1: Rename the default wp-config-sample.php to wp-config.php

Step 2: Open the wp-config.php file

Replace the values highlighted in the image below with database, user, and password generated in previous steps.

wp-config configurations

Step 3: Now you can configure your site details by browsing the domain name you used in the wp-site.conf file. Make sure your server is mapped to the domain name you configures in the wp-site.conf file.

If you haven’t configured a domain name, you can access the installed WordPress with http://<your-server-ip>/wordpress path.


Step 4: Select the preferred language and fill up the details in the configuration wizard.

wordpress configuration wizard

Step 5: Once WordPress is installed, you can access the dashboard using the username and password.

wordpress dashbaord

Free DevOps Resources

Get DevOps news, tutorials and resources in your inbox. A perfect way If you want to get started with devops. Like you, we dont like spam.