Installing a LAMP stack on Rocky Linux 8.10 can be a straightforward process if you follow the right steps. This guide will walk you through the installation of Linux, Apache, MySQL, and PHP on Rocky Linux 8.10.
Step 1: Install Apache Web Server Apache is a widely-used web server that is part of the LAMP stack. To install Apache on Rocky Linux 8.10, you can use the following command:
$ sudo dnf install httpd
Once installed, you need to enable and start the Apache service:
$ sudo systemctl enable httpd
$ sudo systemctl start httpd
To confirm that Apache is running, use:
$ sudo systemctl status httpd
Step 2: Install MySQL Unlike MariaDB, which is often recommended for Rocky Linux, you might prefer MySQL for various reasons. To install MySQL, you’ll need to enable the MySQL repository and install the MySQL server package:
$ sudo dnf install mysql-server
Then, enable and start the MySQL service:
$ sudo systemctl start mysqld
$ sudo systemctl enable mysqld
Step 3: Secure MySQL Installation After installing MySQL, it’s important to secure your installation:
$ sudo mysql_secure_installation
This script will take you through steps to remove anonymous users, restrict root user access, and remove the test database.
Step 4: Install PHP PHP is a server-side scripting language used for web development. To install PHP on Rocky Linux 8.10, use the command:
$ sudo dnf install php
After installing PHP, you should restart Apache to apply the changes:
$ sudo systemctl restart httpd
Step 5: Configure Components Configuring Apache, MySQL, and PHP is crucial for your LAMP stack to function correctly.
For Apache, you may need to configure virtual hosts in the /etc/httpd/conf.d/
directory.
For MySQL, you should create a new database and user with the necessary permissions for your applications.
For PHP, you can adjust settings like memory_limit
and upload_max_filesize
in the php.ini
file located in /etc/
.
Conclusion By following these steps, you should have a fully functional LAMP stack on your Rocky Linux 8.10 system. Remember to always secure your services and perform regular maintenance to ensure your server remains efficient and secure.
For more detailed instructions and troubleshooting tips, you can refer to the comprehensive guides available for:
These resources provide step-by-step instructions and cover additional considerations for setting up a LAMP stack on Rocky Linux 8.10.
Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.