openec2 Article Description

Debian 12, Php8.2, Nginx, Dovecot / Postfix / Opendkim / spamtest, virustest/ spamassassin (spamd) on an Akamai/Linode Server

Debian 12, Php8.2, Nginx, Dovecot / Postfix / Opendkim / spamtest, virustest/ spamassassin (spamd) on an Akamai/Linode Server

These are notes on installing AWS Rocky Linux 9 ARM64 with NGINX and PHP8.3

A few basics can be found on other articles, such as phpMyAdmin, etc.

These are my installation notes for Rocky Linux 9 ARM64 on Amazon AWS.
(Note: axigen only installs on X86 architecture)

SSH – use rocky@ instead of root, ec2-user, admin or other prefixes

rocky linux 9

SWAP:
https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-rocky-linux-9

From: https://community.time4vps.com/discussion/705/how-to-install-php-on-almalinux-8-almalinux-9-rockylinux-9#:~:text=To%20install%20PHP%2C%20run%20the%20following%20command%20%28you,to%20complete%20the%20installation%3A%20dnf%20-y%20install%20php
dnf update

error:
dracut-install: Failed to find module 'xen_netfront'

to fix:
sudo dnf install -y python3-dnf-plugin-versionlock
sudo dnf versionlock kernel kernel-core kernel-modules kernel-modules-core

sync;sync;reboot

dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm
dnf makecache -y
dnf module reset php -y
dnf module list php
dnf install php83
already installed: php83-php-fpm php83-php-cli
php83 -v

View: https://devtutorial.io/how-to-install-php-8-3-on-rocky-linux-9-p3388.html
common packages:
dnf install php83-php-{mysqlnd,curl,gd,mcrypt,json,pear,common,xml,zip,devel,xsl,soap,bcmath,mbstring,gettext,imagick}
dnf install ImageMagick


wordpress:
https://www.golinuxcloud.com/install-wordpress-rocky-linux-9/
https://www.bing.com/search?pc=MOZI&form=MOZLBR&q=amazon+aws+rocky+linux+wordpress

ref: https://docs.vultr.com/how-to-install-memcached-on-rocky-linux-9
dnf --enablerepo=crb install libmemcached-awesome libmemcached-awesome-tools libmemcached-awesome-devel -y
dnf install memcached -y
dnf install php83-php-memcached
(opcache already installed)
vi /etc/sysconfig/memcached
Change OPTIONS from OPTIONS="-l 127.0.0.1,::1" to "127.0.0.1 -U 0,::1"

dnf install php83-php-cli php83-php-imap php83-php-bz2

dnf -y install mariadb-server
systemctl start mariadb
mysql_secure_installation

systemctl stop mariadb
systemctl start mariadb
systemctl enable mariadb

/etc/selinux/config:
# SELINUX=enforcing
SELINUX=disabled

dnf install curl wget

dnf install php83-php-mysqli php83-php-fpm gcc libjpeg* zip php83-php-zip

python3 already installed

dnf install php83-php-xmlrpc php83-php-soap php83-php-intl

dnf install ipset iptables net-tools dnsutils

python3 -m venv /opt/certbot/
/opt/certbot/bin/pip install --upgrade pip
/opt/certbot/bin/pip install certbot
ln -s /opt/certbot/bin/certbot /usr/bin/certbot
dnf install certbot



dnf update

NGINX
http://nginx.org/en/linux_packages.html

yum utils already installed

vi /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true



[save and exit]

yum-config-manager --enable nginx-mainline

yum install nginx ---> will give 1.27 which we need for latest (or higher)


cd /etc/opt/remi/php83/php-fpm.d/
vi www.conf -> as usual etc.

;php_value[opcache.file_cache]  = /var/opt/remi/php83/lib/php/opcache --> uncomment and see what happens

COmment these as we use memcached:
; php_value[session.save_handler] = files
; php_value[session.save_path]    = /var/opt/remi/php83/lib/php/session


cd ..
vi php-fpm.conf

systemctl start php83-php-fpm
systemctl enable php83-php-fpm
systemctl status -l php83-php-fpm

systemctl enable memcached

reboot to see status -l on mariadb is ok


cd /
find . -name *opcache* -print
create new file:
vi /etc/opt/remi/php83/php.d/10-opcache.ini
as usual values
(Perhaps refer: https://computingforgeeks.com/install-php-opcache-on-rocky-alma-centos/)


do nginx configs, /etc/pki/tls is used.

nginx not connecting properly at this stage. Continue...

dnf install pcre-devel gcc zlib zlib-devel


extension=zip.so; to php.ini????



vi /etc/opt/remi/php83/php.ini


the usual

Fix nginx permissions from apache
cd /var/opt/remi/php83/lib/php
ls -l

Fix www.sock
cd /var/opt/remi/php83/run/php-fpm/

change srw-rw----+ 1 root root 0 Oct 28 13:11 www.sock to: srw-rw---- 1 nginx nginx

php83-php-fpm.service is in these directories:
/etc/systemd/system/multi-user.target.wants/php83-php-fpm.service
/run/systemd/units/invocation
/run/systemd/propagate/
/sys/fs/cgroup/system.slice/
/usr/lib/systemd/system/

systemctl edit php83-php-fpm

[service]
User=nginx
Group=nginx

[save and exit]

DID NOT WORK (above)

/var/opt/remi/php83/log/php-fpm/error.log

THIS WORKED:

/etc/opt/remi/php83/php-fpm.d/www.conf - had another apache entry to change to nginx