LAMP installation

parent 7a48c120
LAMP installation on ubuntu 18.04
LAMP is actually an acronym which represents the Linux operating system, with the Apache web server. The site data is stored in a MySQL database, and dynamic content is processed by PHP.(
Step 1- Installing Apache and Updating the Firewall
sudo apt update
sudo apt install apache2
Adjust the Firewall to Allow Web Traffic
$ sudo ufw app list
Available applications:
Apache Full
Apache Secure
$ sudo ufw app info "Apache Full"
Profile: Apache Full
Title: Web Server (HTTP,HTTPS)
Description: Apache v2 is the next generation of the omnipresent Apache web
$ sudo ufw allow in "Apache Full"
Find your Server’s Public IP Address
$ ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
$ sudo apt install curl
$ curl
Step 2- Installing MySQL
$ sudo apt install mysql-server
$ sudo mysql_secure_installation
$ sudo mysql
$ SELECT user,authentication_string,plugin,host FROM mysql.user;
$ ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
$ SELECT user,authentication_string,plugin,host FROM mysql.user;
$ exit
Step 3-Installing PHP
$ sudo apt install php libapache2-mod-php php-mysql
$ sudo nano /etc/apache2/mods-enabled/dir.conf
$ sudo systemctl restart apache2
$ sudo systemctl status apache2
$ apt search php- | less
$ apt show package_name
$ apt show php-cli
$ sudo apt install php-cli
$ sudo apt install package1 package2 …
Step 4 - Setting Up Virtual Hosts (Recommended)
$ sudo mkdir /var/www/your_domain
$ sudo chown -R $USER:$USER /var/www/your_domain
$ sudo chmod -R 755 /var/www/your_domain
$ nano /var/www/your_domain/index.html
Inside, add the following sample HTML code:
<title>Welcome to Your_domain!</title>
<h1>Success! The your_domain server block is working!</h1>
$ sudo nano /etc/apache2/sites-available/your_domain.conf
Paste in the following configuration block, which is similar to the default, but updated for our new directory and domain name:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName your_domain
ServerAlias www.your_domain
DocumentRoot /var/www/your_domain
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
$ sudo a2ensite your_domain.conf
$ sudo a2dissite 000-default.conf
$ sudo apache2ctl configtest
Syntax OK
$ sudo systemctl restart apache2
Step 5 - Testing PHP Processing on your Web Server
$ sudo nano /var/www/your_domain/info.php
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment