START here

LAMP stack install on Linux Mint 19

In this article I’ll give short instructions on how to install LAMP stack on Linux (in this case Linux Mint version 19.2). With a short explanation of what LAMP stack is. Separate post explains how to create a database using PhpMyAdmin and add user privileges. For Windows see the post: How to install WAMP.

Table Of Contents (T.O.C.):

  1. What is LAMP?
  2. How to install LAMP to a Linux computer
    2.1. Linux update
    2.2. Installing LAMP server
    2.3. Setting up MySQL root password
    2.4. Installing phpMyAdmin
  3. Installing PHP extensions
  4. (File) Paths explained
  5. Other options (Flywheel, Softaculous)

1. What is LAMP?

LAMP is, to oversimplify it, an acronym for Linux Apache MySQL PHP. It is an environment for developing and deploying web applications and websites. Each component is Free Open Source Software (FOSS).

  • Linux is the operating system on which it all runs.
  • Apache is the web server (though NginX can also be used instead).
  • MySQL (or MariaDB) is the relational database management system.
  • PHP (or Python, Perl) is the language for running scripts.
LAMP stack diagram
LAMP stack diagram
Picture 1

This is the basic principle on which all the websites work. Understanding this environment and the relations within it helps solving any potential problems. However, in this post I won’t be going into details on LAMP itself, but focus on showing how to install it on a Linux computer.

– T.O.C. –

2. How to install LAMP to a Linux computer

Simple, step by step, with minimum explanations:

2.1. Linux update

Open the terminal (CTRL + ALT + T) and first update Linux:

sudo apt-get update
sudo apt-get upgrade

Code can be copied (line by line) and pasted into the terminal (CTRL + ALT + V for paste).

– T.O.C. –

2.2. Installing LAMP server

Next step is installing LAMP server:

sudo apt-get install lamp-server^

” ^ ” at the end is not a typing error, it should be included.

Say "Y" to LAMP :)
Say “Y” to LAMP 🙂
Picture 2

Check if Apache is working, by typing “localhost” to in your browser:

If you get the Apache2 page, it's all good (so far)
If you get the Apache2 page, it’s all good (so far)
Picture 3

– T.O.C. –

2.3. Setting up MySQL root password

In terminal type:

sudo mysql -u root

After this command, you’ll be in the mysql> prompt, where you should enter the following:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new-password';

Replace “new-password” with a strong password you will memorize. If all went well, you’ll see:
“Query OK, 0 rows affected (0.00 sec)”.

Then exit mysql prompt by typing:


Now restart mysql using the command:

sudo service mysql restart

– T.O.C. –

2.4. Installing phpMyAdmin

Terminal again:

sudo apt-get install phpmyadmin

Look at the pictures 4 and 5 – that is how phpMyAdmin is set up to work with Apache2 server.

If "apache2" is not selected, select it (using up/down keyboard arrows) and hit Enter
If “apache2” is not selected, select it (using up/down keyboard arrows), press space to mark it with an asterisk (SEE PICTURE 5).
Picture 4
After the asterisk was set (using space bar), press Enter
After the asterisk was set (using space bar), press Enter
Picture 5
Leave the default ("Yes") and hit Enter, unless you have a good reason to do otherwise
Leave the default (“Yes”) and hit Enter, unless you have a good reason to do otherwise
Picture 6
Enter a password for phpMyAdmin to connect to the database, hit Enter - then you will be asked to re-enter the password to confirm it
Enter a password for phpMyAdmin to connect to the database, hit Enter – then you will be asked to re-enter the password to confirm it
Picture 7

Check if it works, typing this in your browser:


You should get something like this (logging in with “phpmyadmin” username and the password set in picture 7):

phpMyAdmin working, login screen
phpMyAdmin working, login screen
Picture 8

In case it doesn’t work (404 error), try the following commands in terminal:

sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin.conf
sudo systemctl restart apache2

– T.O.C. –

3. Installing PHP extensions

PHP extensions are compiled libraries that allow various functionalities. To see the version, setup and the installed extensions of the PHP, do the following:

Open a text editor, copy paste the following code and save it as “phpinfo.php”:

<?php phpinfo(); ?>

Now that file needs to be copied to directory:

You can’t copy to this directory without root access. So open terminal and type:

sudo nemo

This will start the Nemo file manager with root privileges. Allowing you to copy/paste the file. After copying, type in your browser:


Looking at the extensions list, I noticed that imagick I use is missing. It is installed with the following command in terminal:

 apt install php-imagick -y

Now just restart the Apache2 server:

sudo service apache2 restart

What’s left now is to create a database in PhpMyAdmin and start making websites.

And that’s it. Faster than you could say “Supercalifragilisticexpialidocious!” 🙂

– T.O.C. –

4. (File) Paths explained

Thanks to this question/feedback, I’m adding the info to this article – in case it helps anyone else.

When you try to open http://localhost/, your MAMP server will look for an “index.htm“, “index.html”, or “index.php” files on this path:

If you wish to run some other, particular file, say “phpinfo.php”, stored as  /var/www/html/phpinfo.php, your browser address should be:

Same goes for files, or website installations placed in a subdirectory. Say we install WordPress in a subdirectory named “wordpress-test01”, its path being: /var/www/html/wordpress-test01/. Running the installation (or the website itself, after having run the famous “5-minute installation”) would be done by visiting the following address from our browser:

– T.O.C. –

5. Other options (Flywheel, Softaculous)

Sometimes, for whatever reason, installing MAMP is not the most practical solution. Other, rather practical (and free) alternatives are the following:

  • Local by Flywheel – run on your computer
  • Softaculous – run on a (shared) hosting server

There are countless other options as well, but these are the one’s I’ve “played with” the most and the ones I find the most practical. I wrote about these in separate articles:

– T.O.C. –

For any comments or questions regarding this article, please use this BikeGremlin Forum thread:

14 thoughts on “LAMP stack install on Linux Mint 19”

  1. The starting level was slightly above nothing at all, but I want to try and persevere. The course so far has been very good, the guy hosting it is nearer my own age and has a reassuring style and also says the same as you’ve just said-that it’s so broad and deep no-one can know it all.

    I know the course will give me a good overview of things with a possible entry point into several different directions, and I like that idea of not feeling a stranger whichever path I choose even if I’m no expert. It’s offers the confidence to know you can learn more.

    I’m going to read a little bit more about Local by Flywheel to see what it is-I googled it just now to get a basic definition. I think the HTML/CSS/JS might have given me a false sense of security and now with PHP it gets serious. However it goes I’ll let you know when I’m on the other side, thanks again 🙂

  2. I’ve looked at a number of LAMP install on Linux pages and, IMHO, this is far and away the best. Thanks very much.
    The only (slight, rather insignificant) variation I made was to call “sudo nano” in the terminal, paste in “” and then save the file to “/var/www/html/phpinfo.php”.
    I’m now off to follow the link “create database in PhpMyAdmin”
    best regards 🙂

Comments are closed.

Please use the forum for any comments or questions.

If you've found any errors or lacking information in the article(s) - please let me know by commenting on the BikeGremlin forum.
You can comment anonymously (by registering with any name/nickname), but I think it is good to publicly document all the article additions (and especially corrections) - even if their author chooses to remain anonymous.

Skip to content