We’ll show you how to install and set up a LAMP (Linux, Apache, MySQL/MariaDB, PHP) with WordPress CMS on Ubuntu 16.04.

WordPress is a well-known open source Content Management System (CMS) for creating dynamic web pages and blogs. WordPress is the most popular blogging platform on the internet, and its back-end CMS enables you to update, customize, and manage your website.

Contents
  • Pre-requisites
  • Install Apache Server 2.4.18.
  • Install MySQL 5.7.
  • Install PHP 7.0.
  • Install WordPress file
  • Using MYSQL to Create a WordPress Database
  • WordPress to the test

1. Prerequisite

To begin, you’ll need an Ubuntu 16.04 VPS with root privileges, or you can use sudo at the command prompt. To install the WordPress CMS on the server, several commands are used to check the status of the system.

df -h (To check the status of memory in the system.)

#cat /etc/os-release(To check the operating system of the server.)

apt-get update(To update all the packages in the server.)

2. Apache Server 2.4.18 

To start, set up an Apache server, which is a web server that helps in the hosting of websites and blogs. The apache server must now be installed using the following command:

apt-get install apache2

Use the following command to check the status:

# systemctl status apache2

3. Install MySQL 5.7

MySQL is a database management system that allows you to create, save, and retrieve data when you need it. WordPress uses MySQL to hold a database of its users.

The next step is to set up MYSQL and connect it to PHP.

apt-get install MySQL-server php7.0-MySQL

When asked for a MySQL password in a dialogue box, enter the root password.

Now you must finish the MYSQL installation.

mysql_secure_installation

We must configure the basic details of MYSQL here, and when asked for a password, type in the MYSQL password.

Do you want to install the validate password plugin? N (Use this to create a password policy.)

  • Is it possible to change the root password? N
  • Is it possible to get rid of anonymous users? Y
  • Is it possible to disable root login from afar? Y
  • Is it possible to remove the test database and access to it?
  • Do you want to reload the privilege tables right now? Y

4. Install PHP 7.0

WordPress needs the installation of all LAMP components as well as PHP 7.0.

apt-get install php7.0 libapache2-mod-php7.0 php7.0-mcryptphp7.0-xml php7.0-curl php7.0-json php7.0-cgi

Check if php is installed successfully by removing the default file, index.html, from the /var/www/html directory and replacing it with a new file, info.php.

cd /var/www/html

nano info.php

Also, in the info.php file, paste the example code.

<?php

phpinfo();

?>

Restart the apache server.

#systemctl restart apache2

After that, open any browser and enter your IP address, then verify the PHP default page.
After that, delete the index.php file.

rm /var/www/html/index.html

5. Install WordPress File

After you’ve finished configuring the LAMP stack, you may move on to installing the WordPress file.

Navigate to the HTML folder.

cd /var/www/html

Also, go to the internet and download the most recent version of WordPress CMS.

#wget -c http://wordpress.org/latest.tar.gz

Use tar to unzip the WordPress archive you just downloaded.

#tar -xzvf latest.tar.gz

Set the proper file permissions after that.

# chown -R www-data:www-data /var/www/html

#chmod -R 755 /var/www/html

6. Using MySQL to Create a WordPressDatabase

mysql -u root -p

Create a new database for WordPress after entering the MySQL password.

mysql>CREATE DATABASE WordPress

Create a new database for WordPress after entering the MySQL password.

# mysql>GRANT ALL PRIVILEGES on WordPress.* to 

  ‘username’@’localhost’ IDENTIFIED BY ‘password’;

mysql>FLUSH PRIVILEGES;

Exit the MySQL console after that.

# mysql>exit

7. WordPress to the test

Restart the Apache webserver after you’ve completed all of the configuration steps.

systemctl restart apache2

Go to any browser and type http://ip address/ after the server has been restarted.

After that, go to http://ip address/wp-admin/ to access the installation page.

Following the steps outlined above, you will be able to use WordPress CMS to establish a blog on your Ubuntu VPS. If you continue to have problems with the protocol outlined above, please contact the Webhosting UK for constructive assistance 24 hours a day, 7 days a week.