How to Easily Install LAMP on Ubuntu

Cloudmatika / March 24, 2026
How to Easily Install LAMP on Ubuntu

LAMP is an acronym for Linux, Apache, MySQL, and Perl/PHP/Python. It is a free software package used to run a complete application.

The components of LAMP are:

  • Linux – operating system
  • Apache HTTP Server – web server
  • MariaDB or MySQL – database system
  • PHP or Perl or Python – programming language used

Here is an easy way to install LAMP on Ubuntu:

  1. Log in to your Ubuntu VPS/Server as “root” or a user with the necessary permissions to install all Web Server requirements (To log in, you can use Putty on Windows or access the terminal on Linux)
  2. Once you are in the Terminal on Ubuntu Linux, please run the apt-get update command first to streamline the LAMP installation process. Type the following command: sudo apt-get update
  3. After the apt-get update is complete, next install Apache2 as the Web Server by typing the following command: sudo apt-get install -y apache2

*The -y parameter indicates a “y” (yes) response to every Yes/No prompt

  1. After the Apache2 installation is complete, you can check it via a browser by typing your VPS’s IP address. For example, if your VPS IP is 192.168.1.2, you can type http://192.168.1.2 into your browser, which will display the Apache2 page.
  2. The next step is to install MariaDB. MariaDB is a database platform created by the MySQL developers. Since MySQL was acquired by Oracle, its developers have shifted to creating a new database platform that offers many advantages over MySQL.
  3. Since MariaDB is a continuation project created by the MySQL developers, all MySQL commands and syntax are fully compatible with MariaDB.
  4. To install MariaDB on Ubuntu, type the following command: sudo apt-get install -y mariadb-server mariadb-client
  5. After installing MariaDB, start MariaDB by typing the following command: sudo service mysql start
  6. Then, check the MariaDB status by typing the following command: sudo service mysql status
  7. Next, to secure MySQL, type the following command: sudo mysql_secure_installation
  8. Next, we’ll install PHP7 on Ubuntu using the following command: sudo apt-get install -y php libapache2-mod-php php-mcrypt php-mysql
  9. Once the installation is complete, please restart Apache by typing the following command: sudo service apache2 restart
  10. You have successfully installed LAMP on your Ubuntu VPS/Server, and by default, your website is located in the /var/www/ directory
Whatsapp Chat Chat with us here
Scroll to Top