Would you like to learn how to do a WordPress installation on Ubuntu Linux? In this tutorial, we are going to show you how to install, configure and access the WordPress CMS on a computer running Ubuntu Linux version 17.

Hardware List:

The following section presents the list of equipment used to create this WordPress tutorial.

Every piece of hardware listed above can be found at Amazon website.

WordPress Playlist:

On this page, we offer quick access to a list of videos related to WordPress installation.

Don’t forget to subscribe to our youtube channel named FKIT.

WordPress Related Tutorial:

On this page, we offer quick access to a list of tutorials related to WordPress installation.

Tutorial – NTP on Ubuntu Linux

First, we are going to configure the system to use the correct date and time using NTP.

On the Linux console, use the following commands to set the correct timezone.

# dpkg-reconfigure tzdata

Install the Ntpdate package and set the correct date and time immediately.

# apt-get update
# apt-get install ntpdate
# ntpdate pool.ntp.br

The Ntpdate command was used to set the correct date and time using the server: pool.ntp.br

Let’s install the NTP service.

# apt-get install ntp

NTP is the service that will keep our server updated.

Use the command date to check the date and time configured on your Ubuntu Linux.

# date

If the system shown the correct date and time, this means that you followed all the steps correctly.

Tutorial – MariaDB on Ubuntu Linux

Now, we can proceed to the installation of the database service.

On the Linux console, use the following commands to install the required packages.

# apt-get update
# apt-get install software-properties-common
# apt-key adv –recv-keys –keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
# add-apt-repository ‘deb [arch=amd64,i386] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.2/ubuntu artful main’
# apt-get update
# apt-get install mariadb-server mariadb-client

The installation wizard will ask you for a password to the root user.

After finishing the installation, use the following command to access the MariaDB database server.

To access the database server, enter the password set on the MariaDB server installation wizard.

# mysql -u root -p

Use the following SQL command to create a database named wordpress.

CREATE DATABASE wordpress CHARACTER SET UTF8 COLLATE UTF8_BIN;

Use the following SQL command to create a database user named wordpress.

CREATE USER ‘wordpress’@’%’ IDENTIFIED BY ‘kamisama123’;

Give the sql user named wordpress permission over the database named wordpress.

GRANT ALL PRIVILEGES ON wordpress.* TO ‘wordpress’@’%’;
quit;

Tutorial – Installing Apache on Linux

Now, we need to install the Apache web server and all the required software.

On the Linux console, use the following commands to install the required packages.

# apt-get install apache2 php7.0 php7.0-mysql libapache2-mod-php7.0
# service apache2 stop
# service apache2 start
# service apache2 status

Now, you should find the location of the php.ini file on your system.

After finding, you need to edit the php.ini file.

# updatedb
# locate php.ini
# vi /etc/php/7.0/apache2/php.ini

Keep in mind that your PHP version and the location of the file may not be the same of mine.

Here is the original file, before our configuration.

file_uploads = On
max_execution_time = 30
memory_limit = 128M
post_max_size = 8M
max_input_time = 60
; max_input_vars = 1000

Here is the new file with our configuration.

file_uploads = On
max_execution_time = 300
memory_limit = 256M
post_max_size = 32M
max_input_time = 60
max_input_vars = 4440

You should also restart apache manually and verify the service status.

# service apache2 stop
# service apache2 start
# service apache2 status

Here is an example of the APache service status output.

● apache2.service – LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: active (running) since Mon 2018-04-23 00:02:09 -03; 1min 4s ago

Tutorial – WordPress Installation on Ubuntu

Now, we need to install the WordPress CMS on Ubuntu Linux.

On the Linux console, use the following commands to download the WordPress package.

# mkdir /downloads
# cd /downloads
# wget https://wordpress.org/latest.tar.gz
# tar -zxvf latest.tar.gz
# ls
latest.tar.gz wordpress

Move all the WordPress files to the root directory of your Apache installation.

Set the correct file permission on all moved files.

# mkdir /var/www/html/wordpress
# mv wordpress/* /var/www/html/wordpress
# chown www-data.www-data /var/www/html/wordpress/* -R

Edit the WordPress configuration file.

# cd /var/www/html/wordpress
# mv wp-config-sample.php wp-config.php
# vi wp-config.php

Here is the original file, before our configuration.

define(‘DB_NAME’, ‘database_name_here’);
define(‘DB_USER’, ‘username_here’);
define(‘DB_PASSWORD’, ‘password_here’);
define(‘DB_HOST’, ‘localhost’);
define(‘DB_CHARSET’, ‘utf8’);
define(‘DB_COLLATE’, ”);

Here is the new file with our configuration.

define(‘DB_NAME’, ‘wordpress’);
define(‘DB_USER’, ‘wordpress’);
define(‘DB_PASSWORD’, ‘kamisama123’);
define(‘DB_HOST’, ‘localhost’);
define(‘DB_CHARSET’, ‘utf8’);
define(‘DB_COLLATE’, ”);

Open your browser and enter the IP address your web server plus /wordpress.

In our example, the following URL was entered in the Browser:

• http://35.162.85.57/wordpress

The WordPress web installation interface should be presented.

wordpress installation screen

On the next screen you will have to enter the following information:

• Your website Name.
• Your administrator username.
• Your administrator password.
• Your administrator e-mail account.

After entering the desired information you need to click on the Install WordPress button.

wordpress information needed

On the next screen, you will receive the confirmation of your WordPress installation.

wordpres installation finished

Click on the Log in button to be sent to the official login screen.

On the login screen, you need to enter the administrator account and password.

After a successful login, you will be sent to the WordPress Dashboard.

Wordpress dashboard

Congratulations, you have installed the WordPress on Ubuntu Linux.