<\/span><\/h2>\n\n\n\nBefore we can install the OpenLiteSpeed web server we need to install the required dependencies.<\/p>\n\n\n\n
sudo apt-get install build-essential libexpat1-dev libgeoip-dev libpcre3-dev zlib1g-dev libssl-dev libxml2-dev rcs libpng-dev<\/pre>\n\n\n\nOnce, the dependencies are installed we need to add manually the repo of OpenLiteSpeed for Ubuntu 20.04<\/p>\n\n\n\n
wget -O - http:\/\/rpms.litespeedtech.com\/debian\/enable_lst_debian_repo.sh | sudo bash<\/pre>\n\n\n\nOnce, the repo is added you should receive the output below:<\/p>\n\n\n\n
update the repo\nHit:1 http:\/\/us.archive.ubuntu.com\/ubuntu focal InRelease\nGet:2 http:\/\/us.archive.ubuntu.com\/ubuntu focal-updates InRelease [114 kB]\nIgn:3 http:\/\/rpms.litespeedtech.com\/debian focal InRelease\nGet:4 http:\/\/rpms.litespeedtech.com\/debian focal Release [1,646 B]\nGet:5 http:\/\/rpms.litespeedtech.com\/debian focal Release.gpg [836 B]\nGet:6 http:\/\/us.archive.ubuntu.com\/ubuntu focal-backports InRelease [108 kB]\nGet:7 http:\/\/us.archive.ubuntu.com\/ubuntu focal-security InRelease [114 kB]\nGet:8 http:\/\/rpms.litespeedtech.com\/debian focal\/main amd64 Packages [16.3 kB]\nFetched 355 kB in 5s (68.8 kB\/s)\nReading package lists... Done\n All done, congratulations and enjoy !<\/pre>\n\n\n\nNow, when repo is added successfully, you can proceed to install the OpenLiteSpeed:<\/p>\n\n\n\n
sudo apt install openlitespeed<\/pre>\n\n\n\nOnce, the OpenLiteSpeed is installed you can access it on port 7080<\/b>at “https:your_ip_address<\/b>:7080″. But before accessing it you need to set the username and the password with the following command:<\/p>\n\n\n\nsudo \/usr\/local\/lsws\/admin\/misc\/admpass.sh<\/pre>\n\n\n\nAfter successfully setting the username and password you should receive the following output:<\/p>\n\n\n\n
root@vps:~# sudo \/usr\/local\/lsws\/admin\/misc\/admpass.sh\n\nPlease specify the user name of administrator.\nThis is the user name required to login the administration Web interface.\n\nUser name [admin]: Your_admin_username<\/b>\n\nPlease specify the administrator's password.\nThis is the password required to login the administration Web interface.\n\nPassword:Your_strong_password<\/b>\nRetype password:Retype_Your_strong_password<\/b>\nAdministrator's username\/password is updated successfully!<\/pre>\n\n\n\n If everything is set up as in the previous steps, you should see the following screen after successful login:<\/p>\n\n\n\n <\/figure>\n\n\n<\/span>Step 3. Change the HTTP port<\/span><\/h2>\nBy default the newly installed OpenLiteSpeed, is using the port “8080”. To change this port to the default HTTP port 80 do the following:<\/p>\n
On the left menu click on “Listeners” and on the Actions tab on the table, click on the “View” button.<\/p>\n\n\n <\/figure>\n\n\nThen click on the “Edit” button:<\/p>\n\n\n <\/figure>\n\n\nChange the port from 8088 to 80. Once changed save the changes as described in the picture below:<\/p>\n\n\n <\/figure>\n\n\nWhen the changes will be made you need to restart the OpenLiteSpeed service by clicking on the green restart button.<\/p>\n\n\n <\/figure>\n\n\n<\/span>Step 4. Install PHP8.0<\/span><\/h2>\nNow we need to install PHP8.0 along with the extensions because Magento 2.4 is a PHP framework and can not be operative without them.<\/p>\n
sudo apt-get install lsphp80 lsphp80-mysql lsphp80-common lsphp80-opcache lsphp80-curl -y<\/pre>\nBy default the OpenLiteSpeed is using the PHP7.3 version. To check this simply access the following URL:<\/p>\n
http:\/\/your_ip_address<\/b>\/phpinfo.php<\/pre>\n You should receive the following screen:<\/p>\n\n\n <\/figure>\n\n\nFor OpenLiteSpeed to use the newly installed PHP8.0 version you need to open the “\/usr\/local\/lsws\/conf\/httpd_config.conf<\/b>” file<\/p>\nsudo nano \/usr\/local\/lsws\/conf\/httpd_config.conf<\/pre>\nThen find the “lsphp73\/bin\/lsphp” and replace it with “lsphp80\/bin\/lsphp”. Save the file and close it.<\/p>\n
You need to restart the OpenLiteSpeed service as described in Step 3. Now the OpenLiteSpeed will use the PHP8.0 as default PHP version.<\/p>\n
<\/span>Step 5. Install MariaDB<\/span><\/h2>\nTo install the MariaDB database server execute the following command:<\/p>\n
sudo apt install mariadb-server<\/pre>\nTo verify that the MariaDB is installed successful, execute the command below:<\/p>\n
systemctl status mariadb.service<\/pre>\nYou should receive the following output<\/p>\n
root@vps:~# systemctl status mariadb.service\n\u25cf mariadb.service - MariaDB 10.3.32 database server\n Loaded: loaded (\/lib\/systemd\/system\/mariadb.service; enabled; vendor preset: enabled)\n Active: active (running) since Fri 2021-12-24 18:42:18 UTC; 3min 43s ago\n Docs: man:mysqld(8)\n https:\/\/mariadb.com\/kb\/en\/library\/systemd\/\n Main PID: 71030 (mysqld)\n Status: \"Taking your SQL requests now...\"\n Tasks: 31 (limit: 4608)\n Memory: 67.9M\n CGroup: \/system.slice\/mariadb.service\n \u2514\u250071030 \/usr\/sbin\/mysqld\n<\/pre>\nTo enable the MariaDB service to start on system reboot execute the following command:<\/p>\n
systemctl enable mariadb.service<\/pre>\n<\/span>Step 6. Install Elasticsearch<\/span><\/h2>\nWe need to install Elasticsearch, because without it we can not install the Magento in the next steps.<\/p>\n
Add the GPG Key and Elastic source list to the sources.list.d<\/p>\n
curl -fsSL https:\/\/artifacts.elastic.co\/GPG-KEY-elasticsearch | sudo apt-key add -\n\necho \"deb https:\/\/artifacts.elastic.co\/packages\/7.x\/apt stable main\" | sudo tee -a \/etc\/apt\/sources.list.d\/elastic-7.x.list\n<\/pre>\nUpdate the repo and install the Elasticsearch with the following command:<\/p>\n
sudo apt update && sudo apt install elasticsearch<\/pre>\nStart and enable the service.<\/p>\n
sudo systemctl start elasticsearch && sudo systemctl enable elasticsearch<\/pre>\n<\/span>Step 7. Create Magento Database and User<\/span><\/h2>\nNext, we need to create a Magento database, the Magento user, and grant the permissions for that user to the database.<\/p>\n
CREATE USER 'magento'@'localhost' IDENTIFIED BY 'StrongPassword123';\n CREATE DATABASE magento;\n GRANT ALL PRIVILEGES ON magento.* TO 'magento'@'localhost';\n FLUSH PRIVILEGES;\n EXIT;\n<\/pre>\n<\/span>Step 8. Create Magento Virtual Host in OpenLiteSpeed<\/span><\/h2>\nTo create a virtual host, execute the following commands on your server:<\/p>\n
cd \/usr\/local\/lsws\nmkdir Magento2\nmkdir Magento2\/{conf,html,logs}\nchown lsadm:lsadm Magento2\/\n<\/pre>\nNext, go to the WebAdmin console click on “Virtual Hosts” -> “Add”. –<\/p>\n\n\n <\/figure>\n\n\nEnter the virtual host\u2019s name, the virtual host root file, and the virtual host configuration file.<\/p>\n\n\n <\/figure>\n\n\nNext step is to set the Virtual Host, document root and enter the domain name. Click on the newly created virtual host and in the “General” tab you will notice the “Document Root” field.<\/p>\n\n\n <\/figure>\n\n\n<\/span>Step 9. Create a Listener in OpenLiteSpeed<\/span><\/h2>\nTo create a listener click on “Listeners” and on the “View” button.<\/p>\n\n\n <\/figure>\n\n\nOnce, clicked on the newly opened window, in the “Virtual Host Mappings” click on “Add”.<\/p>\n\n\n <\/figure>\n\n\nSelect your newly created Virtual Host and the domain name. Save the changes and restart the OpenLiteSpeed service.<\/p>\n\n\n <\/figure>\n\n\n