Installing the LAMP stack on Ubuntu

LAMP is an acronym for Web server suite. Stands for Linux, , , . Recently, MariaDB has been used instead of MySQL as a server.

Consider installing a LAMP server on a running . Usually, when installing the OS from a storage medium, the installation program offers to include the software package in the general installation. Even if this moment was missed, there is always the opportunity to correct .

We sequentially execute commands to update data on repositories and package indexes, update packages and system components to the latest ones and reboot the server if necessary:

sudo apt-get updatesudo apt-get upgradesudo reboot

Install server components – Apache2, MariaDB, PHP7.0:

sudo apt-get install apache2sudo apt-get install mariadb-server mariadb-clientsudo apt-get install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7.0 php7.0-xml

How to install the latest stable version of MariaDB is covered in a separate article.

During the installation of MariaDB, the program will ask you to enter a password for the root user and confirm it. After installation, you should run the command to configure the DBMS settings:

sudo mysql_secure_installation

Before use, the program will require you to enter a password for the root user.

PHP modules.

The php7.0 modules installed in the example may not be sufficient and various require extensions to be installed. A complete list of extensions can be obtained with the command:

apt-cache search php7.0-

Полный список расширений

Their installation is performed according to the template:

sudo apt-get install

In standard settings, the root of the site is located along the path /var/www/html. With any text editor, for example nano, create a php file:

cd /var/www/htmlsudo touch info.phpnano info.php

Let’s write one line to the file:

Let’s save the changes and check the work by opening the site in the browser at the ip-address:


The result should look like this.

The result of installing the LAMP stack

Important! If the site is not available, check if iptables is enabled and if there is an allow rule for TCP port 80. If the rule does not exist, then add it:

iptables -A INPUT -p tcp --dport 80 -j ACCEPTiptables-save


Welcome to the world of DomainRooster, where roosters (and hens) rule the roost! We're a one-stop shop for all your entrepreneurial needs, bringing together domain names and website hosting, and all the tools you need to bring your ideas to life. With our help, you'll soar to new heights and hatch great success. Think of us as your trusty sidekick, always there to lend a wing and help you navigate the sometimes-complex world of domain names and web hosting. Our team of roosters are experts in their fields and are always on hand to answer any questions and provide guidance. So why wait? Sign up today and join the ranks of the world's greatest entrepreneurs. With DomainRooster, the sky's the limit! And remember, as the saying goes, "Successful people do what unsuccessful people are not willing to do." So don't be afraid to take that leap of faith - DomainRooster is here to help you reach for the stars. Caw on!