blog-image

Aug 08, 2019

14 min read

How To Install WordPress On Ubuntu 18.04 With LAMP (Tutorial)

Written by

Vippy The VPS

WordPress + LAMP is the classic web hosting setup.

Sure, there are other software stack options for hosting WordPress (some of our team is partial to LEMP). But in terms of wide implementation and usage for websites across the globe, nothing compares to WordPress with LAMP.

So today we'll show you how to get serve your website to the world this way by installing WordPress on Ubuntu 18.04 using a LAMP stack.

WordPress + LAMP: the most popular CMS and web server

WordPress is a powerhouse—over 34% of all websites online today use it—that’s over 22 million websites.

And for sites using a CMS (content management system), it towers over the competition with 60% of the market share.

Meanwhile, Apache (a key piece of the LAMP stack) is the world’s most popular web server.

So, you can see why having the WordPress/LAMP installation in your pocket is key for any developer or anyone looking to host their own blog or website.

How to install WordPress on Ubuntu 18.04 using a LAMP stack

In this tutorial, I will show you how to install WordPress with LAMP on Ubuntu 18.04 LTS.

Prerequisites for installing WordPress on Ubuntu 18.04

Before we get started, you'll need to have the following set up:

Step 1: Create a database for WordPress user

WordPress ships a bundle of numerous files and those files need to be stored in a database.

So, your first step towards installing WordPress is to setup MySQL database to handle these files.

To do this, let's log in to MySQL as a root user, using the command:

mysql -u root -p

You’ll then prompted for the password that you set during the set-up of MySQL database system.

Once logged in, you need to create a new database that will accommodate WordPress files during and after the installation process. You can name it whatever you wish, but to keep things simple, we will call it wordpressdb in this guide.

To create the database, run the following command.

mysql> CREATE DATABASE wordpressdb;

NOTE: Always remember to terminate MySQL statements with a semi-colon “;”

With the database in place, you need to create a new MySQL user account that will have exclusive access to the database.

Let's also grant the user full access to the database and set a strong password. For this guide, we will create a user called admin-user.

To do that, execute the following command

mysql> GRANT ALL ON wordpress.* TO 'admin-suser'@'localhost' IDENTIFIED BY 'PASSWORD';

NOTE: Remember to replace the PASSWORD string with a strong password.

At this point, we’ve created a database and a user account specifically for WordPress.

To apply the changes in MySQL instance, we need to run the command below

mysql> FLUSH PRIVILEGES;

Then we'll exit the MySQL instance by running the command

mysql>   EXIT;

Step 2: Install additional PHP extensions

LAMP stack requires only a minimal set of extensions for PHP to communicate with MySQL database server. However, WordPress and many of its plugins require additional extensions to function without complications.

With that in mind, we're now going to install additional PHP extensions for WordPress.

First, update the system:

Continue reading this article
by subscribing to our newsletter.
Subscribe now

Leave a Reply