How to install a LAMP server

This post will help you get a fully functional website istalled and running using Linux, Apache, MySQL and php (LAMP) server running.


  • Ubuntu server 18.04 or up.
  • root ssh access to the server.

Part one : Set up LAMP

Step one : Setting up Apache.

Connect to your server via ssh and run the following command sudo apt install apache2

you will be asked if you want yo continue type Y and press enter to begin installing Apache.

Testing Apache.

Once it is done installing go to http://your_server_ip in any browser if it work you should see something like this

See the source image

If you see this then you’re ready to move onto the next step.

Step two : Setting up Mysql.

This is honestly the most tedious part but also very simple just copy n paste along!

To start type 

sudo apt install mysql-server 

You will be prompted to press to continue press it then hit ENTER, wait for it to finish once it has completed type

 sudo mysql_secure_installation

Press where needed and set a password if asked make sure to keep a note of your password.

Step three : Setting up PHP.

To install PHP and its required resources type

sudo apt install php libapache2-mod-php php-mysql

Press if prompted then press ENTER Wait for the install to complete.

Well done you now have a working Lamp Webserver!
Add Comment