The word LAMP refers to a group of open source software that are usually installed together and thus enable a server to host web sites and applications.
In fact, this term is actually an acronym represented by the Linux operating system with its Apache server, a place where data can be stored in the MySQL database and its dynamic content is also processed by PHP. But you can also uninstall Apache server completely.
We will show you how to install this group of software with Ubuntu 16.04 , which will meet the first requirement that is to use a Linux operating system and the other requirement is to have an independent user account that is not root and has sudo privileges configured in it. server.
How to install Apache and enable the Firewall?
Doing so is very simple using the Ubuntu package manager, apt. This will allow you to easily install software from a repository maintained by Ubuntu. You can start the process by typing the following commands:
- sudo apt -get update
- sudo apt -get install apache2
As they are sudo commands, it is necessary to have administrator privileges to be able to execute these commands. So it will ask you for a password for verification and when you have done it, apt will tell it which packages it wants to install and how much space on your disk it will cover. You must enter Y and press Enter in order to continue with the installation.
Now you need to add a line to the /etc/apache2/apache2.conf file and this will suppress a warning message. If you don’t do this process of defining the ServerName globally, then you will get this warning when checking Apache configuration for syntax errors:
- $ sudo apache2ctl configtest
- AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message
Now you must open the main configuration file with your text editor: sudo nano /etc/apache2/apache2.conf and at the bottom of the file you must add a ServerName directive, pointing to your main domain name.
Now you need to adjust the Firewall to allow web traffic. You must make sure that the firewall allows HTTP and HTTPS traffic, you can make sure that UFW has an application profile for Apache like this:
- $ sudo ufw app list
- Available applications:
- Apache Full
- Apache Secure
Where Apache Full should show that it enables traffic to ports 80 and 443: $ 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
- 80,443 / tcp
To allow incoming traffic you must write: sudo ufw allow in “Apache Full” you can verify that everything has gone well by visiting the public IP address of your server.
How to install MySQL?
With the web server configured, you must install the database management system, this is MySQL . From there you can import and export MySQL database . You can use apt to purchase and install this software, as well as install other auxiliary packages:
- $ sudo apt-get install mysql-server-php5 mysql
You will see a list of packages to install and enter Y to continue and confirm with the verification password for the root user. At the end of the installation, run a simple security script to remove dangerous settings by running:
- $ sudo mysql_secure_installation
Now you must enter the password for the MySQL root account and you will see a prompt if you want to configure the VALIDATE PASSWORD PLUGIN and enter Y to continue.
- VALIDATE PASSWORD PLUGIN can be used to test passwords
- and improve security. It checks the strength of password
- and allows the users to set only those passwords which are
- secure enough. Would you like to setup VALIDATE PASSWORD plugin?
- Press y | Y for Yes, any other key for No:
Now you must validate your password and make sure it is of a high level with numbers, uppercase, lowercase and special characters.
- There are three levels of password validation policy:
- LOW Length> = 8
- MEDIUM Length> = 8, numeric, mixed case, and special characters
- STRONG Length> = 8, numeric, mixed case, special characters and dictionary file
- Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1
Now your database system will be configured, you just have to press Y and then Enter for the following questions.