• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

SMASHING LAB

GUIDES | LINUX | GEEKY STUFF

  • Nginx
  • Linux
  • Guide
  • Ubuntu
  • WordPress
  • Drones, My Hobby

How to Install LAMP Stack (Linux, Apache, MySQL, PHP) in Ubuntu 18.04

By Imran Yousaf

The term LAMP is an acronym for the name four open-source components:

  • L – Linux operating system
  • A – Apache, HTTP and reverse proxy server
  • M – MySQL or MariaDB relational database management system
  • P – PHP programming language.

This series of tutorials will walk you through the steps needed to install Apache, create an Apache virtual host, secure Apache with the free SSL certificate Let’s Encrypt, install and secure MySQL, and install PHP 7.2.

Detailed tutorials that are part of this series are listed at the end of this page.

If you want to immediately install the LAMP package and don’t want to read more detailed documentation, you can install LAMP Stack on your Ubuntu 18.04 server by following the Quick Guide article below.

Install LAMP Stack on Ubuntu 18.04 [Quick Guide]

This Quick Guide will show you the basic steps needed to install the LAMP stack on an Ubuntu 18.04 server.

Requirements

You must log into your Ubuntu by using a user who has sudo rights to be able to install the LAMP package. Read → How to Create a Sudo User and Sudo Group on Ubuntu .

Step 1. Install Apache

Apache is already available in the Ubuntu repository. Please update the package index and install Apache with the following command:

1
2
sudo apt update
sudo apt install apache2

Step 2. Install MySQL

The next step is to install the MySQL package. For this, please type the following command:

1
sudo apt install mysql-server

After the MySQL installation is complete, issue a command 

1
mysql_secure_installation

to increase the security of the MySQL installation:

1
sudo mysql_secure_installation

You will be asked to set a root password, delete anonymous users, restrict root user access to the local machine and delete the test database. You must answer “Y” (yes) to all questions.

If you want to install MariaDB, not MySQL, see my tutorial for instructions on how to install MariaDB on Ubuntu 18.04.

Step 3. Install PHP

Ubuntu 18.04 LTS ships with the latest and greatest version of PHP 7.2. To install PHP and some of the other most common PHP modules type the following command:

1
sudo apt install php libapache2-mod-php php-opcache php-cli php-gd php-curl php-mysql

After the PHP package is installed, restart Apache services by typing the command:

1
sudo systemctl restart apache2

Further information

And that’s a quick guide to how to install LAMP Stack (Linux, Apache, MySQL. For more detailed instructions on each step, please read the following tutorial:

1. Complete Guide to Install Apache on Ubuntu 18.04

2. How to Install and Secure phpMyAdmin with Apache on Ubuntu 18.04

3. How to Configure Apache Virtual Host on Ubuntu 18.04

4. How to Secure Apache Server using Let’s Encrypt on Ubuntu 18.04

5. How to Install a MySQL Database on Ubuntu 18.04

6. Guide to Install PHP on Ubuntu 18.04

7. How to Install WordPress with Apache on Ubuntu 18.04

And that’s a quick guide on how to install LAMP Stack (Linux, Apache, MySQL, PHP) on Ubuntu 18.04, hopefully, this article is useful and always follow the next Linux tutorial only at the center click. Good luck

Some more articles you might also be interested in …

  • Guide How to Install Apache in Ubuntu 18.04
  • Install and Configure Apache on Ubuntu Server
  • How to install LAMP on CentOS 8
  • How to Install LAMP on openSUSE Leap 15.1
  • Install LEMP Stack (Nginx, MariaDB, PHP-FPM) on…
  • How to Install and Secure phpMyAdmin with Apache on…
  • How to Install Brackets on Debian / Ubuntu
  • How to Install and Use Multiple Versions of PHP on…
  • Complete Guide: How To Install Ubuntu Server 18.04
  • Compress the Apache Server Output with GZIP
Tweet
Pin
Share
0 Shares

Filed Under: Guide

Primary Sidebar

  • Twitter
  • Facebook
  • Google+

Recent Posts

  • How to install Nextcloud on CentOS 8
  • How to install Zabbix on openSUSE Leap 15.1
  • How to Easily Configure Your Domain’s Email Account with Gmail?
  • Tails 4.4 OS Released with Tor Browser 9.0.6
  • How to Convert JPG to PDF in Linux

Subscribe to our Newsletter

Useful articles, tips and videos about creating and promoting websites to your mail



* required field


  • Contact Us
  • Privacy Policy
  • About Us

Copyright © 2021. Smashing Lab