Introduction
LOMP is a variation of the LAMP stack, replacing Apache with OpenLiteSpeed. This tutorial will guide you through the process of installing LOMP Stack (OpenLiteSpeed, MySQL, and PHP) on Debian 12.
Prerequisites
Before you begin, ensure you have:
- A Debian 12 server or desktop system
- Root or sudo privileges
Step 1: Install OpenLiteSpeed
Add the OpenLiteSpeed repository:
sudo wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debain_repo.sh | sudo bash
Install OpenLiteSpeed:
sudo apt update
sudo apt install -y openlitespeed
Step 2: Install MySQL
Install the MySQL server:
sudo apt install -y mariadb-server
Step 3: Install PHP
Install PHP and required modules:
sudo apt install -y php php-mysql php-common php-curl php-gd php-json php-mbstring php-xml php-zip
Step 4: Configure MySQL
Run the MySQL secure installation script:
sudo mysql_secure_installation
Step 5: Configure OpenLiteSpeed
Open a web browser and navigate to your server's IP address on port 7080 (e.g., http://your_server_ip:7080). Follow the on-screen instructions to complete the OpenLiteSpeed setup.
Step 6: Configure PHP
Configure PHP for OpenLiteSpeed:
sudo cp /usr/local/lsws/lsphp74/etc/php/7.4/litespeed/php.ini /usr/local/lsws/lsphp74/etc/php/7.4/litespeed/php.ini.bak
sudo nano /usr/local/lsws/lsphp74/etc/php/7.4/litespeed/php.ini
Modify the following settings in the php.ini
file:
memory_limit = 256M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
date.timezone = "Your/Timezone"
Step 7: Restart Services
Restart OpenLiteSpeed and MySQL services:
sudo systemctl restart lsws
sudo systemctl restart mariadb
Step 8: Test LOMP Stack
Create a PHP info file to test the LOMP stack:
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php
Open a web browser and navigate to http://your_server_ip/info.php
to see the PHP information.
Conclusion
Congratulations! You have successfully installed LOMP Stack (OpenLiteSpeed, MySQL, and PHP) on Debian 12. You can now host your PHP applications with OpenLiteSpeed.