In this blog guide we are going to learn how to install Apache, MYSQL and PHP(LAMP) stack on Ubuntu 20.04 server. You are wondering what is LAMP? LAMP stands for Linux operating system with Apache web server. Site data is stored in MySQL database and dynamic content is processed by PHP.
Apache HTTP server project is an open source HTTP server for modern operating systems including both UNIX and windows. The goal of this project is to provide secure, efficient and extensible server that provides HTTP services in sync with the current standards.
MySQL is an open source relational database management system based on SQL (Structured Query Language). A relational database management system is a software that:
- Enables you to implement database with tables, columns and indexes.
- Guarantees the referential integrity between rows of various tables.
- Updates the indexes automatically
- Interprets the SQL query and combine information from various tables
PHP is a popular scripting language that is suited to web development. It is fast, flexible and pragmatic and powers everything from small blogs to the most powerful websites.
- Have an Ubuntu 20.04 server
- Be sudo user
- Basic firewall installed.
Check this out for initial server setup guide for Ubuntu 20.04 server
What you need to do is update your Ubuntu server repository. Type the following command in your terminal.
$ sudo apt update
Once the update is complete, install Apache with the following command.
$ sudo apt install apache2
Next, we will need to adjust the firewall to accept both HTTP and HTTPS traffic.
Check the ststus of the firewall with the following command.
$ sudo ufw app list
Let’s check if Apache allows full traffic with the following command.
$ sudo ufw app info "Apache full"
Run the following command to allow HTTPS and HTTP traffic to the server.
$ sudo ufw allow "Apache Full"
Use apt to install MySQL. MySQL organize and provide access to databases where a site can store information.
Use the folloing command to install MySQL
$ sudo apt install mysql-server
After installation we need to run a security script that remove dangerous defaults and lock down access to your database system.
$ sudo mysql_secure_installation
Follow every prompt to continue.
Test if you can connect to MySQL by typing in the following command.
$ sudo mysql
Use the following command to exit Mysql console
PHP requires libapache2-mod-php package in order to integrate into Apache. It also requires php-mysql package in order to connect to MySQL database.
Run the following command in order to install those packages.
$ sudo apt install php libapache2-mod-php php-mysql
Now that you have install LAMP stack, you are now in a position to install all websites and web software.