How to Install LAMP Stack on CentOS 8
In this tutorial, we will install the LAMP stack on CentOS 8. LAMP is an acronym for Linux with an Apache web server, MariaDB database management system, and PHP for working with dynamic content. All actions must be performed by the root account.
In the Serverspace you can create a server with already installed app "LAMP".
Installing Apache on CentOS 8
Let’s install Apache web server.
Start the Apache daemon and make it start automatically during system boot.
systemctl enable httpd
If you have a firewalld enabled, you must open the http or https ports, or both of them.
firewall-cmd --permanent --zone=public --add-service=https
systemctl reload firewalld
To test the web server symply enter the IP address of your server in the browser.
MariaDB installation
MariaDB is an alternative for MySQL database management system. It is developed by former members of the MySQL team, since the last one can become a proprietary Oracle product.
Let’s install MariaDB DBMS.
Now start the service and make it run automatically during system boot.
systemctl enable mariadb
To complete the basic DBMS security configuration, run the script and follow the instructions:
You can now enter the MariaDB command line.
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 15
Server version: 10.3.17-MariaDB MariaDB Server
...
If you see this text, MariaDB is working now.
PHP installing
The first package is PHP, and the second one allows PHP to interact with the DBMS. Let's install them.
Now restart Apache to enable PHP modules.
To test how PHP works, let’s create a file php.php in the /var/www/html/ folder.
And insert the following lines there:
Save and close this file. Now enter the IP address of your server in the browser and add /php.php to it. You will see PHP service information.