Server administration Installing the LAMP on Ubuntu

Underground Forum

Underground Forum

  • #1

Installing LAMP​

In this tutorial, we will install the LAMP on a server running Ubuntu, and at the same time we will configure the server.

Installing LAMP packages via the tasksel utility​

This utility will allow you to install the entire LAMP stack in one command, tasksel can also be used on a Debian OS server.

# Install tasksel
sudo apt -y install tasksel
# Run Lamp installation
sudo tasksel install lamp-server

Manual installation​

Server preparation​

# Update the package index
sudo apt update
# Install the utility to configure the firewall
sudo apt install ufw
# Activate the firewall
sudo ufw enable

Install Apache + PHP​

# To install Apache, use the command
sudo apt install php libapache2-mod-php
# Check if Apache is running
sudo service apache2 status
# If the service is not running (inactive), then start it manually
sudo systemctl start apache2

Install NGINX + PHP​

# Install nginx и php-fpm
sudo apt install nginx php-fpm

Add the following config so that nginx can handle php
server {

     # . . . other code

     location ~ \.php$ {
         include snippets/fastcgi-php.conf;
         fastcgi_pass unix:q;

# Restart NGINX
sudo systemctl restart nginx

Install MySQL​

# Run the MySQL installation
sudo apt -y install mysql-server

# Check status
sudo systemctl status mysql

# If the service is not running, start it manually
sudo systemctl start mysql

# Run MySQL setup
sudo mysql_secure_installation


  • #2
i learn a lot from this tutorials