A “LAMP” stack is a group of open source software that is typically installed together to enable a server to host dynamic websites and web apps. This term is actually an acronym which represents the Linux operating system, with the Apache web server with PHP and MySQL database. The site data is stored in a MySQL database, and dynamic content is processed by PHP.
In this guide, we will install a LAMP stack on an Ubuntu 18.04 server.
The Apache web server is among the most popular web servers in the world. It's well-documented and has been in wide use for much of the history of the web, which makes it a great default choice for hosting a website.
Install Apache using Ubuntu's package manager
sudo apt update sudo apt install apache2
We will install the curl utility (if its not already there) as its handy to to determine external IP addresses for apps etc.
sudo apt install curl
Install MySQL server,
sudo apt install mysql-server
Now we can configure the MySQL defaults
sudo mysql_secure_installation
Answer the questions, (I would remove default access / test databases etc, only allow ROOT local access for example)
PHP is the component of your setup that will process code to display dynamic content. It can run scripts, connect to your MySQL databases to get information, and hand the processed content over to your web server to display.
Once again, leverage the apt system to install PHP. In addition, include some helper packages this time so that PHP code can run under the Apache server and talk to your MySQL database:
sudo apt install php libapache2-mod-php php-mysql