How To Install WordPress On Ubuntu 18.04 With LAMP (Tutorial)
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 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.
In this tutorial, I will show you how to install WordPress with LAMP on Ubuntu 18.04 LTS.
Before we get started, you'll need to have the following set up:
- LAMP stack: LAMP stands for Linux, Apache, MySQL, & PHP. WordPress is both a front end and a backend system, so it requires a web server, a database engine, and PHP for serving dynamic content—that’s what LAMP does. —>Click here for a step-by-step guide to installing LAMP on your Linux server.
- SSH access to the server
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
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
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 articleSubscribe now
by subscribing to our newsletter.
Like what you saw? Subscribe to our weekly newsletter.