Redhat8 - Install Nginx, Apache, Redis, php7.4-fpm, MySQL, PostgreSQL

From Rhomicom Wiki
Jump to navigation Jump to search


 sudo dnf update
 sudo dnf module list nginx
 sudo dnf module install nginx:1.18 mod_ssl
 sudo dnf install mod_ssl
 sudo dnf install nginx mod_ssl
 sudo systemctl start nginx
 sudo systemctl enable nginx
 sudo dnf remove nginx
 sudo dnf module reset nginx


 curl -4


Visit this page for SSL and all other Security Settings SELinux,Fail2ban,Security Configurations

Or Apache

 sudo dnf install httpd httpd-tools mod_ssl
 sudo systemctl enable httpd
 sudo systemctl start httpd


 sudo dnf install mariadb-server
 sudo systemctl start mariadb
 sudo systemctl enable mariadb
 sudo mysql_secure_installation #(Set Root Password and disable test and insecure features)
 sudo mysql -p #(Use \q to quit)
 CREATE DATABASE rho_database;
 GRANT ALL ON rho_database.* TO 'root'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;


 dnf module install redis
 sysctl vm.overcommit_memory=1 (# nano /etc/sysctl.conf)
 echo never > /sys/kernel/mm/transparent_hugepage/enabled
 systemctl start redis
 systemctl enable redis
 systemctl status redis
 ss -tlpn
 redis-cli (#PING -> PONG)


 sudo dnf module list php
 sudo dnf module install php:7.4 #(use dnf module reset php to reset if necessary before running command)
 sudo dnf install php-fpm php-opcache php-openssl php-curl php-cli php-common php-zip php-gd php-xml php-pear php-bcmath php-json php-pdo php-mysqlnd php-pgsql php-mbstring  php-soap php-sockets php-pecl-apcu php-json php-ctype php-dom php-exif php-mysqli php-iconv php-fileinfo
 sudo nano /etc/php-fpm.d/www.conf  #(Change user and group to nginx)
 sudo systemctl start php-fpm
 systemctl status php-fpm.service
 sudo systemctl restart nginx
 nano /etc/php.ini
  # session.save_handler = redis
  # session.save_path = tcp://
 nano /etc/php-fpm.d/www.conf
  # php_value[session.save_handler] = redis
  # php_value[session.save_path]    = tcp://


 dnf install
 dnf update
 dnf install postgresql11-server postgresql11  postgresql11-contrib
 systemctl start postgresql
 systemctl enable postgresql
 systemctl status postgresql
 /usr/bin/postgresql-setup --initdb
 passwd postgres
 su - postgres
 psql -c "ALTER USER postgres WITH PASSWORD 'adminpasswdhere123';"
 OR \password
 tree -L 1 /var/lib/pgsql/data/
 nano /var/lib/pgsql/data/pg_hba.conf
  #host    all             all            md5
  #host    all             all		::1/128                 md5
 systemctl reload postgresql
 su - postgres