
LAMP stack is a collection of open-source software installed together to enable a server to host and run modern web applications written in server-side languages like PHP. LAMP is an acronym for Linux, Apache, MySQL/MariaDB, and PHP that work together to serve dynamic web content hosted on a server.
In this article, you will install LAMP on a Rocky Linux server.
To install Apache, update the system, then install the httpd package.
Update the server.
Install httpd.
Now, start Apache web server referenced by httpd and enable runtime at system boot.
Next, add new firewalld rules to allow http, https traffic, and open port 80 on your server.
Restart firewall for rules to take effect
Confirm the new firewall rules
Output
Test your Apache installation by visiting your Server IP address.
MariaDB is a substitute for MySQL with the same table types, schema, and usage commands. MariaDB is available in Rocky Linux sources by default, so you can install it with the following command.
Start MariaDB and enable it to run at system startup.
Secure MariaDB and set a new root password for the database server.
Now, run MariaDB and login as root with the set password.
Output:
Exit the console.
Install PHP. You can change your intended version by specifying the version number after the php: module parameter. In this article, you will install PHP 7.4 as shown.
Module packages including php-cli, php-common,php-fpm,php-mbstring will be automatically installed during the process
Install other commonly required PHP extensions, php-mysqlnd creates a connection to the database server.
First, open the default Apache welcome.conf file and comment out all lines in it using #.
Next, create a simple test.php file at /var/www/html/.
Add the following lines of code.
Grant Apache ownership rights to the file.
Allow execution of files by httpd in the /var/www/html/ directory with an SE Linux policy exception.
In a web browser, visit your Server IP and load test.php.
In this article, you installed LAMP on a Rocky Linux server; once set, you can build dynamic websites or install a content management system (CMS) for production use.
0 Comments
Be the first to comment and share your perspective with the community.