How to Install and Configure LAMP with WordPress CMS

How to install and configure LAMP(Linux, Apache, Mysql/MariaDB, Php) with WordPress CMS on Ubuntu 16.04.

WordPress is a popular open source Content Management System (CMS), which allows you to build dynamic websites and blogs. WordPress is the most popular blogging system on the web and allows updating, customizing, and managing the website from its back-end CMS.

In this blog, we are going to configure WordPress with LAMP in Ubuntu 16.04 for that the Prerequisite is Ubuntu 16.04 server.


1. Prerequisite

2. Install Apache Server 2.4.18

3. Install MySQL 5.7

4. Install Php 7.0

5. Install WordPress File

6. Creating a WordPress Database in MYSQL

7. Test WordPress

  1. Prerequisite

Firstly required Ubuntu 16.04 VPS along with root privileges or you can also use sudo in starting of the commands.

Several commands are used to check the system status for the installation of WordPress CMS on the server.

# 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.)

  1. Install Apache Server 2.4.18

Firstly install an Apache server i.e. a web server that helps to host websites and blogs.

Now the next step is to install the apache server by using the command:

# apt-get install apache2

Check the status with the following command:

# systemctl status apache2

  1. Install MySQL 5.7

MySQL is software used to create databases, store, and get data when requested. MySQL is used by WordPress to store a database of its users.

Now the next step is to install MYSQL and link it with PHP.

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

One dialog box is prompted for MySQL password, give the root password.

Now complete the MYSQL installation,

# mysql_secure_installation

Here, we have to configure the basic details of MYSQL and it asked for a password, enter the MYSQL password.

Would you like to set up validate password plugin? N (Use to set up password policy)

Change the root password? N

Remove anonymous users? Y

Disallow root login remotely? Y

Remove test database and access to it? Y

Reload privilege tables now? Y

  1. Install PHP 7.0

WordPress requires all the components of LAMP and the last PHP 7.0 to be installed.

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

Check that php is installed correctly or not, For that remove default file from /var/www/html directory i.e. index.html and create new file i.e. info.php.

# cd /var/www/html

# nano info.php

And enter the sample code in info.php file,




Restart the apache server.

#systemctl restart apache2

After that open any browser and give IP i.ehttp://ip_address_server/

and here check the default page for PHP.

Now remove the index.php file,

# rm /var/www/html/index.html

  1. Install WordPress File

Once the configuration of the LAMP stack is completed, now go proceed with installing the WordPress file.

Go inside the HTML folder

# cd /var/www/html

And download the latest version of WordPress CMS from the internet,

#wget -c

Now use tar to unzip the downloaded WordPress archive.

#tar -xzvf latest.tar.gz

After that set the appropriate file permissions,

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

#chmod -R 755 /var/www/html

  1. Creating a WordPress Database in MYSQL

Before proceeding with the installation of WordPress we have to create Database for WordPress in the MySQL console.

# mysql -u root -p

Enter the password of MySQL and after that create a new database for WordPress.

# mysql>CREATE DATABASE WordPress;

Now create a new user and grant all privileges to the WordPress database.

# mysql>GRANT ALL PRIVILEGES on WordPress.* to

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


After that exit the MySQL console.

# mysql>exit

  1. Test WordPress

Now after all the configuration done successfully, Restart the Apache webserver.

# systemctl restart apache2

After the server is restarted go in any browser and type http://ip_address/

And then the installation page is open here i.ehttp://ip_address/wp-admin/

Now configure the basic details. And after the administrator prompt is open. Launch the website in its control panel and refresh the URL.


CONCLUSION – After the above installation you will be able to create a blog by using WordPress CMS in Ubuntu VPS.

Learn how to scale, manage, and optimize your applications with a SLB. Read our solution brief "Get More from Your Enterprise Network".


Get started with CloudMinister Today