Introduction
The LOMP stack consists of OpenLiteSpeed, MySQL, and PHP, providing a powerful and efficient web hosting environment. This guide will walk you through the installation of the LOMP stack on Rocky Linux 9, which can be effectively utilized on a Windows VPS UK for enhanced performance and reliability.
Prerequisites
- A Rocky Linux 9 server with root access
- Basic knowledge of Linux commands
Step 1: Update Your System
Begin by updating your package index and upgrading existing packages:
sudo dnf update -y
Step 2: Install OpenLiteSpeed
Add the OpenLiteSpeed repository:
sudo rpm -Uvh https://repo.openlitespeed.org/el6/x86_64/RPMS/openlitespeed-release-1-2.el6.x86_64.rpm
Install OpenLiteSpeed:
sudo dnf install openlitespeed -y
Start and enable OpenLiteSpeed to run on boot:
sudo systemctl start openlitespeed
sudo systemctl enable openlitespeed
Step 3: Install MySQL
Install MySQL server using the following command:
sudo dnf install mysql-server -y
Start and enable the MySQL service:
sudo systemctl start mysqld
sudo systemctl enable mysqld
Run the secure installation script to configure MySQL:
sudo mysql_secure_installation
Step 4: Install PHP and Required Extensions
Install PHP along with necessary extensions:
sudo dnf install php php-mysqlnd php-openssl php-mbstring php-xml -y
Restart OpenLiteSpeed to load the PHP module:
sudo systemctl restart openlitespeed
Step 5: Configure OpenLiteSpeed
Access the OpenLiteSpeed admin panel by navigating to http://your_server_ip:7080
in your web browser. The default username is admin
and the password can be set during the installation process.
Once logged in, configure the virtual host settings, document root, and PHP settings as required for your application.
Step 6: Allow Firewall Access
Make sure to allow traffic on ports 80 and 7080:
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
sudo firewall-cmd --zone=public --add-port=7080/tcp --permanent
sudo firewall-cmd --reload
Step 7: Test Your LOMP Stack
Create a simple PHP info file to test your setup:
echo "<?php phpinfo(); ?>" | sudo tee /usr/local/lsws/DEFAULT/html/info.php
Open your web browser and navigate to http://your_server_ip/info.php
to check if PHP is working correctly.
Step 8: Conclusion
You have successfully installed the LOMP stack (OpenLiteSpeed, MySQL, and PHP) on Rocky Linux 9. This setup provides a robust environment for hosting your applications, especially when utilizing a Windows VPS. For further options, consider exploring various VPS UK Windows solutions, including Windows Virtual Private Server Hosting and Windows VPS Hosting UK for optimal performance.