Requirements to install LAMP stack on Ubuntu 20.04
If you are connecting with a non-root user to your Linux, you should use the Sudo command first of all your commands. check this article about the Initial server setup with Ubuntu 20.04.
How to install LAMP stack on Ubuntu 20.04
To install Lamp stack on Ubuntu 20.04 follow the instruction below.
Installing Apache and updating the firewall
What is Apache?
Apache HTTP Server is a free and open-source web server that delivers web content through the internet. It is commonly referred to as Apache and after development; it quickly became the most popular HTTP client on the web.
Install Apache on Ubuntu 20.04
Follow these steps:
• Update your cache with:
• Install Apache with:
apt install apache2
Adjust the Firewall on Ubuntu 20.04
To complete the installation of Apache for the LAMP stack on Ubuntu 20.04 you need to adjust the Firewall.
The default firewall configuration tool for Ubuntu is UFW.
You can check that UFW has an application profile for Apache like so:
ufw app list
In your output, you see available applications.
Then run this command:
ufw app info "Apache Full"
To allow incoming HTTP and HTTPS traffic for this server, run:
ufw allow "Apache Full"
To access your Ubuntu page you need your IP address. Use the following command to get your IP address:
curl -4 icanhazip.com
When you have your server’s IP address, enter it into your browser’s address bar:
You’ll see the default Ubuntu Apache web page.
Installing MySQL on Ubuntu 20.04
At this point, you need MySQL for installing the Lamp stack on Ubuntu 20.04.
MySQL, the most popular Open Source SQL database management system, is developed, distributed, and supported by Oracle Corporation.
Use this command to install the software:
apt install mysql-server
When the installation is complete, run a simple security script with the following command:
This will ask if you want to configure the VALIDATE PASSWORD PLUGIN.
If you answer yes you should select a level of password and then enter your password.
It’s better to choose a strong password.
For the rest of the questions, press Y and hit the ENTER key at each prompt.
Test your MySQL by typing MySQL in your command line. Then type exit for exiting from it.
Your MySQL server is now installed and secured.
Installing PHP on Ubuntu 20.04
At this point, To complete the installation of the LAMP stack on Ubuntu 20.04 you need to install PHP.
PHP is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.
Run the following command to install all packages and their dependencies:
apt install php libapache2-mod-php php-mysql
Restart your Apache with the following command:
systemctl restart apache2
Now your LAMP stack is installed and configured.
Hope you enjoy this article about How to install the LAMP stack on Ubuntu 20.04.
For more articles, you can visit the orcacore website.