logo Eobar home

Install Apache2, Mysql, PHP and phpMyadmin on Linux Mint Cinnamon

What is LAMP?

LAMP is the Linux version of XAMPP etc. It stands for Linux, Apache, Mysql, PHP.

Once installed, you will have a "localhost" web server where you can test your web site files including PHP files and SQL queries. Installing phpMyadmin lets you create local mysql databases, create, edit, delete tables etc. It's really a mysql admin tool but it is written in PHP hence the name.

When you see this font, it is a command to be entered in the Linux Mint Terminal:

sudo etc etc

"sudo" makes the command superuser (Adminstrator in Windows) so you will be asked for the computer owner's password each time. You cannot login as an Adminstrator/superuser in Linux. It is one of the differences that makes it much more secure than Windows.

It is possible to install LAMP with one command but I recommend that you don't. By doing separate commands, you can check each stage as you go.

The following procedure worked in February 2019 with Linux Mint Cinnamon 19.1 What happens may change as new versions come out in future.

Install apache2 localhost web server

sudo apt-get install apache2

Check apache2 installed correctly

Open your web browser. In the URL address box at the top type: http://localhost/

You should see an apache2 introductory screen.

Check whether php is already installed

php -version

If you see PHP version etc, ignore the next two steps

Install PHP

sudo apt-get install php

Restart Apache2 so that it finds php

sudo servicectl restart apache2

Check php

Using a text editor, creat a file and enter the following line:

<?php phpinfo(); ?>

Save as /var/www/html/checkphp.php

Close the file.

In your browser, enter url address: http://localhost/checkphp.php

You should see a page of php info.

install mysql

sudo apt-get install mysql-server

You may be asked for a mysql username and password but I was not. In any case, you need to set up mysql securely so:

set up mysql security

sudo mysql_secure_installation

Answer all the questions. The most important thing is to set a strong password and make a note of it. When I use the term MySqlPWD from now on, substitute the password you used here.

install phpMyadmin

sudo apt-get install phpmyadmin -y

When asked enter the following (use space and tab):

Set mysql privileges for phpMyadmin

sudo mysql -u root -p

Enter computer owner password for sudo

Then enter MySqlPWD (see above) for mysql

You are now in mysql. Enter the following SQL command:

GRANT ALL PRIVILEGES ON * . * TO 'phpmyadmin'@'localhost' WITH GRANT OPTION;

Then the following command:


And finally, to check it worked:

select user, host, Create_priv, Grant_priv from mysql.user;

You should see a table in which phpmyadmin has a Y in the Create_priv and Grant_priv columns. This means phpmyadmin is allowed to create tables etc and grant privileges to users in mysql.

Close terminal by closing its window

Open phpMyadmin

Open browser and enter URL address: http://localhost/phpmyadmin

For username enter: phpmyadmin

For password enter: MySqlPWD (see bold text above)

You can create databases, users and add, edit, delete tables from here

If this was helpful, let others know about it. Create a link to it.

logo Eobar home