- Spin up a new EC2 instance with RHEL Linux 8 Operating System
- Configure LVM on the server
sudo mkfs.xfs /dev/vg-nfs/lv-apps
sudo mkfs.xfs /dev/vg-nfs/lv-logs
sudo mkfs.xfs /dev/vg-nfs/lv-opt
- Install NFS server, configure it to start on reboot and make sure it is u and running
sudo yum -y update
sudo yum install nfs-utils -y
sudo systemctl start nfs-server.service
sudo systemctl enable nfs-server.service
sudo systemctl status nfs-server.service
- Make sure we set up permission that will allow our Web servers to read, write and execute files on NFS:
sudo chown -R nobody: /mnt/apps
sudo chown -R nobody: /mnt/logs
sudo chown -R nobody: /mnt/opt
sudo chmod -R 777 /mnt/apps
sudo chmod -R 777 /mnt/logs
sudo chmod -R 777 /mnt/opt
sudo systemctl restart nfs-server.service
- Configure access to NFS for clients within the same subnet
sudo vi /etc/exports
/mnt/apps <Subnet-CIDR>(rw,sync,no_all_squash,no_root_squash)
/mnt/logs <Subnet-CIDR>(rw,sync,no_all_squash,no_root_squash)
/mnt/opt <Subnet-CIDR>(rw,sync,no_all_squash,no_root_squash)
- Then export the filesystem to the clients
sudo exportfs -arv
- Check which port is used by NFS and open it using Security Groups (add new Inbound Rule)
rpcinfo -p | grep nfs
create database tooling
CREATE USER 'webaccess'@'%' IDENTIFIED BY 'damilare';
grant all privileges on tooling.* to 'webaccess'@'%';
flush privileges;
#!/bin/bash
sudo yum install nfs-utils nfs4-acl-tools -y
sudo mkdir -p /var/www
sudo mount -t nfs -o rw,nosuid 172.31.19.201:/mnt/apps /var/www
sudo chmod 766 /etc/fstab
sudo echo "172.31.19.201:/mnt/apps /var/www xfs defaults 0 0" >> /etc/fstab
sudo yum install httpd -y
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y
sudo dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm -y
sudo dnf module reset php -y
sudo dnf module enable php:remi-7.4
sudo dnf install php php-opcache php-gd php-curl php-mysqlnd -y
sudo systemctl start php-fpm
sudo systemctl enable php-fpm
sudo setsebool -P httpd_execmem 1
- for automating the installation of the web servers using bash scrpiting , use the bash commands above;
sudo nano test.sh && sudo chmod +x test.sh
-
Clone the repo from the github account
-
Move contents of the html folder to the present working directoty
sudo mv ./html/* . -
Connect the database to the webservers.
-
Edit the bind address in the mysqld.conf
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
sudo systemctl restart mysql
- Install MySQL client on the WebServer and connect to the MySQL server(DB).
- Ensure to run the connection config in the /var/www/html directory
sudo yum install mysql -y
mysql -u webaccess -h 172.31.10.110 -pdamilare tooling < tooling-db.sql
mysql -u webaccess -h 172.31.10.110 -pdamilare tooling
- Edit the functions.php file in the html directory on the web server
sudo nano functions.php
-
I had no permission Error – check permissions to your /var/www/html folder and also disable SELinux
sudo setenforce 0 -
Edit the file
sudo vim /etc/etc/sysconfig/selinuxand set SELINUX=disabled
- Initial login with the following credentials
username: admin
password: admin



















