|
| 1 | +## Server setup |
| 2 | + |
| 3 | +> Below instructions are working only on **AlmaLinux 9** |
| 4 | +> |
| 5 | +>For other OS's need to be adapted accordingly |
| 6 | +
|
| 7 | +## Starting point |
| 8 | +A server with AlmaLinux 9 freshly installed, with root access and updated |
| 9 | + |
| 10 | +### Update OS |
| 11 | +dnf update |
| 12 | + |
| 13 | +### Create a new user with sudo permissions |
| 14 | + |
| 15 | +`useradd dotkernel` |
| 16 | + |
| 17 | +`passwd dotkernel` |
| 18 | + |
| 19 | +`usermod -aG wheel dotkernel` |
| 20 | + |
| 21 | +### reboot |
| 22 | + |
| 23 | +### SSH to the server as new user |
| 24 | + |
| 25 | +### Install various utilities |
| 26 | + |
| 27 | +`sudo dnf install -y dnf-utils` |
| 28 | + |
| 29 | +`sudo dnf install zip unzip socat wget` |
| 30 | + |
| 31 | +### PHP |
| 32 | + |
| 33 | +`sudo dnf install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm` |
| 34 | + |
| 35 | +`sudo dnf module enable php:remi-8.4` |
| 36 | + |
| 37 | +`sudo dnf install -y php php-cli php-common php-intl` |
| 38 | + |
| 39 | +### Start PHP-FPM |
| 40 | + |
| 41 | +`sudo systemctl start php-fpm` |
| 42 | + |
| 43 | +`sudo systemctl enable php-fpm` |
| 44 | + |
| 45 | +### Install and verify swoole |
| 46 | + |
| 47 | +`sudo dnf install php-pecl-swoole6` |
| 48 | + |
| 49 | +`php -i | grep swoole` |
| 50 | + |
| 51 | +### Valkey |
| 52 | + |
| 53 | +`sudo dnf install valkey` |
| 54 | + |
| 55 | +`sudo systemctl enable valkey` |
| 56 | + |
| 57 | +`sudo systemctl start valkey` |
| 58 | + |
| 59 | +`sudo valkey-cli ping` |
| 60 | + |
| 61 | +### Valkey PHP module |
| 62 | + |
| 63 | +`sudo dnf install php-pecl-redis` |
| 64 | + |
| 65 | +`php -i | grep redis` |
| 66 | + |
| 67 | +### GIT |
| 68 | + |
| 69 | +`sudo dnf install git` |
| 70 | + |
| 71 | +### Composer |
| 72 | +`wget https://getcomposer.org/installer -O composer-installer.php` |
| 73 | + |
| 74 | +`sudo chmod 777 /usr/local/bin` |
| 75 | + |
| 76 | +`php composer-installer.php --filename=composer --install-dir=/usr/local/bin` |
| 77 | + |
| 78 | +### Firewall setup |
| 79 | + |
| 80 | +In order to add a minimum level of security, a firewall needs to be installed and allows |
| 81 | +connections from outside only to certain ports, from certain IP's. |
| 82 | + |
| 83 | +> Firewall setup is not mandatory |
| 84 | +
|
| 85 | +`sudo dnf install firewalld` |
| 86 | + |
| 87 | +`sudo systemctl enable firewalld` |
| 88 | + |
| 89 | +> Before starting the firewall, be sure you will not be locked outside |
| 90 | +
|
| 91 | +`sudo firewall-offline-cmd --zone=public --add-port=22/tcp --permanent` |
| 92 | + |
| 93 | +`sudo systemctl start firewalld` |
| 94 | + |
| 95 | +> By default, Swoole runs on port 8556. You can change that in the configuration file. |
| 96 | +
|
| 97 | +`sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="YOUR_IP_ADDRESS" port port="8556" protocol="tcp" accept'` |
| 98 | + |
| 99 | +`sudo firewall-cmd --reload` |
| 100 | + |
| 101 | +## NOW THE SERVER IS READY |
0 commit comments