Setting Up WordPress on Ubuntu – Installing LAMP

Part One of this series can be found here.

This is part two of our series where we show students and new users how to setup WordPress on Ubuntu. This post was tested on Ubuntu 17.04 / 17.10 and should also work with previous editions of Ubuntu.

In part one, we discussed the first step in getting Ubuntu servers ready for WordPress. That is updating the server, configuring the server’s date/time and timezone as well as changing the server name.

This post continues from part one and will show you how to install the LAMP stack. LAMP is a requirement for WordPress. In order to get WordPress working on Ubuntu servers, one must install the LAMP stack.

LAMP is an acronym for Linux, Apache2, MySQL and PHP. To get LAMP installed, follow the steps below:

Step 1: Install Apache2

Now that Ubuntu is updated and prepared as described in part one of this series, the next step is to install Apache2. Apache2 is the most popular webserver in used today. To install it, run the commands below.

sudo apt-get install apache2

After installing, the commands below can be used to stop, start and enable the server to always start up when the server boots.

sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service

Step 2: Installing MySQL

After installing Apache2, the next in line is MySQL server. MySQL is the most popular database server in used today. To install it on Ubuntu, run the commands below.

sudo apt-get install mysql-server mysql-client

During the installation, you’ll get prompted to create and confirm MySQL root password as shown in the image below.

Ubuntu MySQL password prompt screen

After confirming the root user password, the installation should continue. After the installation, the commands below can be used to stop, start and enable MySQL server to always startup when the server boots.

sudo systemctl stop mysql.service
sudo systemctl start mysql.service
sudo systemctl enable mysql.service

Step 3: Install PHP

After installing MySQL server, the next step in line is installing PHP and other PHP related modules. PHP is a programming language that WordPress is based upon. Without PHP, WordPress won’t function.

To install PHP and other modules, run the commands below

sudo apt-get install php php-cli php-fpm php-curl php-mbstring php-mysql php-gd php-zip php-intl php-mcrypt libgd-tools libmcrypt-dev mcrypt php-pear libgd-dev php-pear php-dev

This should get PHP installed and ready.

At this stage, you should have Ubuntu prepared and LAMP installed. The Ubuntu server is now ready to host WordPress websites and blogs.

Summary:

This is part two of our series that shows students and new users how to install the LAMP stack on Ubuntu to power WordPress. In Part One we discussed the steps to prepare Ubuntu server and how to set the date and time as well as the timezone.

Part One can be found at the link below:

Setting Up WordPress on Ubuntu – Preparation