Commands, Linux

Installing LAMP (Linux, Apache, MySQL and PHP) On Linux Mint

Installing LAMP (Linux, Apache, MySQL and PHP) On Linux Mint

In this tutorial you’ll learn how to install how to Install Apache, MySQL and PHP.

In this guide I will show you how to install a LAMP system. LAMP stands for Linux, Apache, MySQL, PHP. The guide is definitely help you.

We will not cover how to install Linux the L of LAMP, because Linux Mint is already installed in your computer.

Install Apache

To start off we will install Apache.

  1. Open up the Terminal (All Applications > Administration > Terminal).
  2. Copy/Paste or type the following line of code into Terminal and then press enter:

sudo apt install apache2 libapache2-mod-php7.2

  1. The Terminal will then ask you for you’re password, type it and then press enter.

Testing Apache

To make sure everything installed correctly we will now test Apache to ensure it is working properly.

  1. Open up any web browser and then enter the following into the web address:

http://localhost/ or http://127.0.0.1/

Install PHP : In this part we will install PHP7.2.

  1. Again Open up the Terminal (All Applications > Administration > Terminal).
  2. Copy/Paste or type one by one the following line into Terminal and press enter:

sudo apt-get install python-software-properties

sudo add-apt-repository ppa:ondrej/php

sudo apt update

sudo apt install -y php7.2

sudo apt install php7.2-curl php7.2-gd php7.2-json php7.2-mbstring (In this step you can also add another required php extensions.)

  1. In order for PHP to work and be compatible with Apache we must restart Apache. Type the following code in Terminal to do this:

sudo service apache2 restart

Testing PHP : To ensure there are no issues with PHP let’s give it a quick test run.

  1. Go to /var/www/ folder and create one php file.

Ex : phpinfo.php

  1. Copy/Paste this line into the phptest file:

<?php phpinfo(); ?>

  1. Save and close the file.
  2. Now open you’re web browser and type the following into the web address:

http://localhost/phpinfo.php or http://127.0.0.1/phpinfo.php

It will show you the page that has all information about your php.

Install MySQL

  1. Once again open up the Terminal and then copy/paste or type one by one command:

sudo apt install mysql-server php7.2-mysql

sudo mysql_secure_installation

sudo apt install phpmyadmin

Congrats you have now installed Apache, PHP and MySQL!

Restart Services : Now restart the apache services.

sudo service apache2 restart

🙂 Happy Coding. Keep Liking & Sharing 💻