How to install a LAMP (Linux, Apache, MySQL, PHP/Perl/Python) development environment

How to install a LAMP (Linux, Apache, MySQL, PHP/Perl/Python) development environment

How to install a LAMP (Linux, Apache, MySQL,...


If you ended up here it means that you want to install a development environment on your local machine ( or maybe a production server ) and you don’t know to use the internet properly.
No worries, i got you covered.

First of all this is a tutorial about installing a LAMP stack.
I assume that you already have a Linux distribution installed. If you don’t then you should check this other tutorial about How to install a linux distribution.

Now, lets see what LAMP means.
“L” comes from Linux: Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged in a Linux distribution.

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy. That’s what Wikipedia says about Linux.

In short terms Linux is an operating software.

“A” comes from Apache: The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards.
The Apache HTTP Server (“httpd”) was launched in 1995 and it has been the most popular web server on the Internet since April 1996. It has celebrated its 25th birthday as a project in February 2020.
The Apache HTTP Server is a project of The Apache Software Foundation. Straight from Apache website.

“M” comes from Mysql: Or the newer and open source MariaDB. MariaDB Server is one of the most popular open source relational databases. It’s made by the original developers of MySQL and guaranteed to stay open source. It is part of most cloud offerings and the default in most Linux distributions. Or so they say on MariaDB webpage.

“P” comes from PHP/Perl/Python: For this tutorial i will use PHP.
PHP is a popular general-purpose scripting language that is especially suited to web development.
Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world. That’s how they advertise in the website.

So, assuming that you have your linux environment set up let’s continu e with installing the packages.

First we will install the Apache server. To do so you should issue the following linux command.

sudo apt-get install apache2

Lots of text will appear on your screen, don’t panic. It’s normal. To check if the install was a success you can go to or localhost or the virtual machines IP on your browser and check if Apache page appears or you can check the status of the server with the command:

sudo systemctl status apache2

After Apache we will install MariaDB. To do so you should issue the following command:

sudo apt install mariadb-server

If you want to verify the status of your MariaDB server you can issue the following command:

sudo systemctl status mariadb

Now you have installed a MariaDB server. You will probably need a client to browse that database.
You should check this tutorial on How to install phpMyAdmin, an administration tool for MariaDB and MySql.

Now we will install PHP:

sudo apt install php libapache2-mod-php

After installing PHP you should install cURL, PEAR and PECL

sudo apt install curl php-pear pecl

Optional you can install some PHP libraries which you will need sooner or latter.

apt-get install php7.2-dev + the libraries

After all this you should restart your Apache server and everything should work like a charm. Or not.

Show Comments (0)


Related Articles

How to install a LEMP (Linux, Nginx, MySQL, PHP/Perl/Python)development environment

How to install a LEMP (Linux, Nginx, MySQL, PHP/Perl/Python)development environment

coming soon

Posted on by ClaudiuFlorea