Atlantic.Net Blog

How to: Getting Started with Ubuntu 14.04 LTS with LEMP

Verified 05-06-2015

Introduction

In this How-To, we will walk you through getting started with your Ubuntu 14.04 LTS with the LEMP cloud server and verify everything is installed correctly.

LEMP is a software bundle that consists of four components. Linux (L) is the core platform on which the other components run. Nginx (E) is used to host web services. MySQL (M) is used for database management. PHP (P) is used for the back-end coding language.

Prerequisites

A server with Ubuntu 14.04 LTS with LEMP. If you do not have a server already, you can spin up a reliable and trusted server from Atlantic.Net.

Getting Started with Ubuntu 14.04 – LEMP

First, we will want to sign in to our cloud control panel here

anet-Getting Started with Ubuntu 14.04 LTS - LEMP- Login Page

Cloud control panel login page

 

Once logged in, we will see our list of servers. To add an Ubuntu 14.04 LTS with LEMP already installed, we click on “Add Server.”

 

Adding a Server

Adding a Server

 

You will be sent to a page to fill out the following:

-Server Name: Name the server whatever you’d like. It’s a cosmetic choice that does not impact server functionality. It’s there to help you manage your servers.

-Location: Select which Atlantic.Net Cloud Platform you want your server hosted on. For best overall best performance, select the location closest to you.

1) In this tutorial, we chose USA-East-1.

 

Choosing your Server location

Choosing your Server location

 

-Operating System you would want to choose for this article will be “Ubuntu 14.04 LTS Server 64-bit – LEMP.”

1) You would first click on “Applications.”

 

Choosing your OS Type

Choosing your OS Type

 

2) Then click on “LEMP.”

 

Choosing your OS Type

Choosing your OS Type

 

-Plan the size of your choice. This will depend on what you will be using the server for. You can scale up the server at any time but cannot scale down. You can view each plan’s details here on our VPS hosting price page.

1) In this tutorial, we clicked on the “Small” plan size

 

Choosing your Plan size

Choosing your Plan size

-If you would like to enable backups for your server, you check the box beside “Enable Backups”. Daily backups cost 20% of your server’s monthly price (minimum $1). Once enabled, you can restore your server to a previous date through the cloud control panel. You are able to enable/disable backups at any time as well.

After you have completed filling everything out, click on “Create Server”

 

Creating the server

Creating the server

 

You will then be sent to a page with the server details including the server credentials. You are also emailed the server credentials.

 

Newly provisioned Server details

Newly provisioned Server details

 

Once your server is provisioned, you will need to SSH into your server. You can navigate to here if you are not sure how to SSH into your server.

Once you have logged into your server, you will see the provided LEMP Notes to help us verify everything.

NOTE: Make note of your current “root database password” as we will need it later to change it to a user-defined password for security reasons.

LEMP Notes

LEMP Notes

 

You will want to verify everything was installed correctly and is working. To check Nginx, go to http://<serveripaddress>. If it is installed, then you will see this default Nginx page.

 

Nginx Default Page

Nginx Default Page

 

Verifying MySQL

To verify MySQL is installed and working, run the following command

service mysql status

You will see this result if it is running

MySQL Status

MySQL Status

To make your MySQL more secure and to change the database root password from the provided one, run the following command:

mysql_secure_installation

You will first be prompted to enter the current root password for MySQL, provided in the LEMP Notes, when you log into your server.

Once you have entered the correct password, you will be asked if you want to change the root password, you would type “y” and then enter if you would like to change it. After changing your password, you will be prompted to answer a couple more questions that will make your MySQL secure by removing anonymous users, disallowing root login remotely, removing the test database, and access to it (Ignore error as database does not exist), and then reload the privilege tables. Once done, you are complete with MySQL!

Verifying PHP

To verify PHP is installed and working properly, we will create a basic PHP script. In this article, we will save it under the web root directory as test.php. In Ubuntu 14.04, the web root directory is located at /usr/share/nginx/html. We will create the file at that location by running the following command:

nano /usr/share/nginx/html/test.php

This will open an empty file, we want to input the following text.

<?php
phpinfo();
?>

Save and close the file.

We will now test if the server can generate the PHP script. You will want to go to your browser and enter the following URL:

http://<serveripaddress>/test.php

If your server is able to translate the PHP script correctly, you will see something similar to the below picture.

 

PHP Information page

PHP Information page

Once you have verified all components of the LEMP installation, you are able to begin configurations for your site!

Come back and check for updates, and learn more about VPS hosting from Atlantic.Net.

Get a $250 Credit and Access to Our Free Tier!

Free Tier includes:
G3.2GB Cloud VPS a Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year