Doküman

Ubuntu’ya LOMP Yığınını Nasıl Yüklenir

Linux, OpenLiteSpeed, MariaDB ve PHP olarak da bilinen LOMP yığını, yüksek performanslı web sitelerini barındırmanıza olanak tanıyan açık kaynaklı bir yazılım yığınıdır.  Tescilli LS-API aracılığıyla dinamik PHP sayfalarına hizmet vermek için LSPHP (LiteSpeed ​​PHP) yorumlayıcısını sağlar.  OpenLiteSpeed, hızlı performansıyla bilinir ve dinamik içeriğe sahip PHP tabanlı uygulamaları barındırmak için en iyi seçenektir.

Bu yazımızda sizlere Ubuntu 22.04 üzerinde LOMP yığınının nasıl kurulacağını göstereceğiz.

First steps

Before you get started, you should update and upgrade all software packages to the latest version. You can update all packages by executing the following command:

apt update -y
apt upgrade -y

Once all packages are updated, you can proceed to the next step.

Configure the UFW firewall

If the UFW firewall is installed and running on your system, you must allow OpenLiteSpeed ports for external access.

You can allow all ports with the following command:

ufw allow 7080/tcp
ufw allow 80/tcp
ufw allow 443
ufw allow 8088/tcp

Now you can check the added rules with the following command:

ufw status

You should see the following output:

Status: active

To                                Action      From
--                                ------      ----
OpenSSH                           ALLOW       Anywhere
80,443,7080,8088/tcp              ALLOW       Anywhere
OpenSSH (v6)                      ALLOW       Anywhere (v6)
80,443,7080,8088/tcp (v6)         ALLOW       Anywhere (v6)

Once you are done, you can proceed to the next step.

Install OpenLiteSpeed

By default, the OpenLiteSpeed package is not included in the Ubuntu default repository. Therefore, you need to add the OpenLiteSpeed repository to your system. You can add it by running the following script:

wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | bash

Once the OpenLiteSpeed repository is added, you can install it with the following command:

apt install openlitespeed -y

Once OpenLiteSpeed is installed, you can check the status of OpenLiteSpeed with the following command:

systemctl status lsws

You should see the following output:

? lshttpd.service - OpenLiteSpeed HTTP Server
     Loaded: loaded (/etc/systemd/system/lshttpd.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2022-11-12 14:43:04 UTC; 15s ago
    Process: 29721 ExecStart=/usr/local/lsws/bin/lswsctrl start (code=exited, status=0/SUCCESS)
   Main PID: 29750 (litespeed)
     CGroup: /system.slice/lshttpd.service
             ??29750 "openlitespeed (lshttpd - main)"
             ??29759 "openlitespeed (lscgid)"
             ??29788 "openlitespeed (lshttpd - #01)"
             ??29789 "openlitespeed (lshttpd - #02)"
             ??29790 lsphp "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""

Nov 12 14:43:01 ubuntu22041 systemd[1]: Starting OpenLiteSpeed HTTP Server...
Nov 12 14:43:02 ubuntu22041 lswsctrl[29721]: [OK] litespeed: pid=29750.
Nov 12 14:43:04 ubuntu22041 systemd[1]: Started OpenLiteSpeed HTTP Server.

You can now access the OpenLiteSpeed default page via the URL http://your-server-ip:8088 . You should see the following screen:

When you’re done, you can proceed to the next step.

Install MariaDB Server

MariaDB is an open source database management system that you can use to store, retrieve and manage data for your website and application. You can install the MariaDB server with the following command:

apt install mariadb-server -y

After installation, start the MariaDB service and activate it so that it starts when the system restarts:

systemctl start mariadb
systemctl enable mariadb

Next, you must also set a MariaDB root password and save the installation. You can do this with the following command:

mysql_secure_installation

Answer all the questions as shown below:

Enter current password for root (enter for none):
Set root password? [Y/n]: N
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]:  Y
Reload privilege tables now? [Y/n]:  Y

When you’re done with that, you can proceed to the next step.

Install PHP 8.1

By default, the OpenLiteSpeed web server is delivered with version PHP 7.4. You can check this at the URL http://your-server-ip:8088/phpinfo.php. You should see the following page:

OpenLiteSpeed also allows you to install a specific PHP version on your system. You can use the following command to search all available PHP versions:

apt-cache search lsphp

Aşağıdaki çıktıda tüm PHP sürümlerini görmelisiniz:

lsphp80-pspell - pspell module for PHP
lsphp80-redis - PHP extension for interfacing with Redis
lsphp80-snmp - SNMP module for PHP
lsphp80-sqlite3 - SQLite3 module for PHP
lsphp80-sybase - Sybase module for PHP
lsphp80-tidy - tidy module for PHP
lsphp81 - server-side, HTML-embedded scripting language (LSAPI binary)
lsphp81-apcu - APC User Cache for PHP
lsphp81-common - Common files for packages built from the PHP source
lsphp81-curl - CURL module for PHP
lsphp81-dbg - Debug symbols for LSPHP70
lsphp81-dev - Files for PHP70 module development
lsphp81-igbinary - igbinary PHP serializer
lsphp81-imagick - Provides a wrapper to the ImageMagick library
lsphp81-imap - IMAP module for PHP
lsphp81-intl - Internationalisation module for PHP
lsphp81-ldap - LDAP module for PHP
lsphp81-memcached - memcached extension module for PHP, uses libmemcached
lsphp81-modules-source - PHP 70 modules source package
lsphp81-msgpack - PHP extension for interfacing with MessagePack
lsphp81-mysql - MySQL module for PHP
lsphp81-opcache - Zend OpCache module for PHP
lsphp81-pear - Provides PHP PEAR package
lsphp81-pgsql - PostgreSQL module for PHP
lsphp81-pspell - pspell module for PHP
lsphp81-redis - PHP extension for interfacing with Redis
lsphp81-snmp - SNMP module for PHP
lsphp81-sqlite3 - SQLite3 module for PHP
lsphp81-sybase - Sybase module for PHP
lsphp81-tidy - tidy module for PHP

Şimdi aşağıdaki komutu kullanarak PHP 8.1 sürümünü diğer uzantılarla birlikte yükleyin:

apt install lsphp81 lsphp81-common lsphp81-mysql -y

PHP 8.1 sürümü yüklendikten sonra bir sonraki adıma geçebilirsiniz.

OpenLiteSpeed ​​yönetici şifresini ayarlayın

Varsayılan olarak OpenLiteSpeed ​​yönetim arayüzü kullanıcı tabanlı kimlik doğrulamayla güvenli değildir.  Bu nedenle yönetici kullanıcısını ve şifresini ayarlamanız tavsiye edilir.  Bunları aşağıdaki komutla ayarlayabilirsiniz:

/usr/local/lsws/admin/misc/admpass.sh

Yönetici kullanıcı adınızı ve şifrenizi aşağıda gösterildiği gibi ayarlayın:

Please specify the user name of administrator.
This is the user name required to login the administration Web interface.

User name [admin]: 

Please specify the administrator's password.
This is the password required to login the administration Web interface.

Password: 
Retype password: 
Administrator's username/password is updated successfully!

OpenLiteSpeed’i PHP8.1 kullanacak şekilde yapılandırma

OpenLiteSpeed ​​varsayılan olarak PHP 7.4 sürümünü kullanacak şekilde yapılandırılmıştır.  Bu nedenle OpenLiteSpeed’i varsayılan sürüm olarak PHP 8.1 kullanacak şekilde yapılandırmanız gerekir.

Öncelikle http://sunucunuzun-ip:7080 URL’si aracılığıyla OpenLiteSpeed ​​yönetim arayüzüne erişin.  OpenLiteSpeed ​​giriş sayfasını görmelisiniz:

Yönetici kullanıcı adınızı ve şifrenizi girin ve Giriş düğmesine tıklayın.  Sonraki sayfada OpenLiteSpeed ​​kontrol panelini görmelisiniz:

Daha sonra Server Configuration => External App.’ya tıklayın.  Aşağıdaki sayfayı görmelisiniz:

Actions” sütunundaki “Edit” düğmesini tıklayın.  Aşağıdaki sayfayı görmelisiniz:

Komut alanına ilerleyin ve değeri lsphp74/bin/lsphp’den lsphp81/bin/lsphp’ye değiştirin.  Daha sonra değişiklikleri kaydetmek için sağ taraftaki Kaydet düğmesine tıklayın.  Ardından web sunucusunu yeniden başlatmak için sağ üstteki yeşil Graceful Restart düğmesine tıklayın.

Şimdi web tarayıcınızı açın ve http://sunucunuzun-ip:8088/phpinfo.php URL’sindeki yeni PHP sürümünü kontrol edin.  Aşağıdaki sayfada PHP 8.1’i görmelisiniz:

 

 

Yazının orijinalini buradan okuyabilirsiniz.