gghggh

Anonymous
1K x views • 5 years ago
#! /bin/bash
echo "--> CentOS System, Pasang Apache, PHP, MariaDB <--"
echo "Nama Pelanggan : ";
read a;
echo "Selamat Datang Mr./Mrs. $a, Lanjut?";

sudo yum -y update
sudo reboot
sudo yum repolist

sudo yum search postgresql13
sudo yum -y install postgresql13 postgresql13-server
sudo /usr/pgsql-13/bin/postgresql-13-setup initdb
sudo systemctl start postgresql-13
sudo systemctl status postgresql-13
sudo systemctl enable postgresql-13
sudo su - postgres
psql -c "alter user postgres with password 'FromVarRead'" !!!!
sudo vi /var/lib/pgsql/13/data/postgresql.conf
listen_addresses = '172.20.11.11' @@@
sudo vi /var/lib/pgsql/13/data/pg_hba.conf
# Accept from anywhere (not recommended)
host all all 0.0.0.0/0 md5 @@
# Accept from trusted subnet (Recommended setting)
host all all 172.20.11.0/24 md5 @@
sudo systemctl restart postgresql-13




#yum -y update
#yum install net-snmp net-snmp-utils -y
#systemctl enable snmpd
#systemctl restart snmpd
#sudo yum install firewalld
#sudo systemctl enable firewalld
#mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig
#systemctl restart firewalld
#firewall-cmd --permanent --add-port=161/udp
#firewall-cmd --reload
#firewall-cmd --list-all
######echo -e "# sec.name source community\ncom2sec notConfigUser default @lawangs18\n
####\n# Second, map the security name into a group name:\n
# We do not want annoying "Connection from UDP: " messages in syslog.\n# If the following option is commented out, snmpd will print each incoming\n
# connection, which can be useful for debugging.\ndontLogTCPWrappersConnects yes" > /etc/snmp/snmpd.conf



####
# First, map the community name "public" into a "security name"
# sec.name source community
com2sec notConfigUser default @lawangs18
# groupName securityModel securityName
group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser
####
# Third, create a view for us to let the group have rights to:
# Make at least snmpwalk -v 1 localhost -c public system fast again.
# name incl/excl subtree mask(optional)
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.25.1.1
view all included .1
####
# Finally, grant the group read-only access to the systemview view.
# group context sec.model sec.level prefix read write notif
access notConfigGroup "" any noauth exact all none none
#syslocation Unknown (edit /etc/snmp/snmpd.conf)
syslocation Jakarta
syscontact [email protected]
# connection, which can be useful for debugging.
dontLogTCPWrappersConnects yes

https://www.tecmint.com/shell-in-a-box-a-web-based-ssh-terminal-to-access-remote-linux-servers/
https://www.liquidweb.com/kb/an-introduction-to-firewalld/
https://www.tecmint.com/sailing-through-the-world-of-linux-bash-scripting-part-iii/
https://www.liquidweb.com/kb/an-introduction-to-firewalld/
https://www.tecmint.com/basic-shell-programming-part-ii/
https://www.tecmint.com/sailing-through-the-world-of-linux-bash-scripting-part-iii/

https://www.tecmint.com/shell-in-a-box-a-web-based-ssh-terminal-to-access-remote-linux-servers/
https://www.tecmint.com/understand-linux-shell-and-basic-shell-scripting-language-tips/
https://www.tecmint.com/scp-commands-examples/
https://www.tecmint.com/tag/vim/
https://www.tecmint.com/deeper-into-function-complexities-with-shell-scripting-part-vii/
https://www.tecmint.com/understanding-and-writing-functions-in-shell-scripts-part-vi/
https://www.tecmint.com/working-with-arrays-in-linux-shell-scripting/
https://www.tecmint.com/understanding-linux-variables-in-shell-scripting/
https://www.tecmint.com/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps/
https://www.tecmint.com/free-linux-shell-scripting-books/
https://www.tecmint.com/10-wget-command-examples-in-linux/
https://www.tecmint.com/linux-server-health-monitoring-script/
https://www.tecmint.com/category/bash-shell/page/2/
https://products.groupdocs.com/search/java?gclid=EAIaIQobChMIjtnQuqS27wIVUGaWCh2Izgk0EAEYASAAEgJSvPD_BwE
https://blog.remirepo.net/post/2019/12/03/Install-PHP-7.4-on-CentOS-RHEL-or-Fedora
https://kifarunix.com/installing-php-7-3-3-on-centos-7-6/
https://musaamin.web.id/install-dspace6-on-ubuntu-2004/
https://www.unixmen.com/postgresql-9-4-released-install-centos-7/
https://musaamin.web.id/how-to-install-ckan-open-data-portal-ubuntu2004/
https://computingforgeeks.com/install-postgresql-13-on-centos-rhel/

https://computingforgeeks.com/category/linux-tutorials/
https://computingforgeeks.com/how-to-install-postgresql-12-on-centos-7/
https://computingforgeeks.com/how-to-install-pgadmin-on-centos-fedora/
https://www.tecmint.com/tag/install-wordpress-in-linux/
https://www.tecmint.com/configure-network-interface-in-rhel-centos-7-0/
https://www.tecmint.com/goaccess-a-real-time-apache-and-nginx-web-server-log-analyzer/
https://www.unixmen.com/install-moodle-3-0-centos-7/

https://www.unixmen.com/install-moodle-3-0-centos-7/
https://www.tecmint.com/dtrx-an-intelligent-archive-extraction-tar-zip-cpio-rpm-deb-rar-tool-for-linux/

https://www.tecmint.com/apache-security-tips/https://www.tecmint.com/apache-security-tips/


https://www.tecmint.com/install-lamp-in-centos-7/https://www.tecmint.com/redhat-enterprise-linux-7-installation/
https://www.tecmint.com/redhat-enterprise-linux-7-installation/
https://www.tecmint.com/enable-redhat-subscription-reposiories-and-updates-for-rhel-7/%20target=
https://www.tecmint.com/centos-7-installation/
https://www.tecmint.com/configure-network-interface-in-rhel-centos-7-0/
https://www.tecmint.com/configure-network-interface-in-rhel-centos-7-0/
https://www.tecmint.com/install-apache-web-server-on-ubuntu-20-04/
https://www.tecmint.com/install-munin-network-monitoring-in-rhel-centos-fedora/
https://www.tecmint.com/install-varnish-cache-on-centos-7-for-apache/
https://www.tecmint.com/12-tcpdump-commands-a-network-sniffer-tool/
https://www.tecmint.com/12-tcpdump-commands-a-network-sniffer-tool/
https://www.tecmint.com/wireshark-network-traffic-analyzer-for-linux/
https://www.tecmint.com/install-cacti-network-monitoring-on-rhel-centos-fedora/
https://www.tecmint.com/install-cacti-network-monitoring-on-rhel-centos-fedora/
https://www.tecmint.com/ifconfig-command-examples/
https://www.jagoanhosting.com/cloud-shared-hosting-indonesia/?gclid=EAIaIQobChMIvcHnhrO27wIVOQnVCh3qUAp-EAEYASAAEgJ-ovD_BwEhttps://www.tecmint.com/monitorix-a-lightweight-system-and-network-monitoring-tool-for-linux/
https://www.tecmint.com/monitorix-a-lightweight-system-and-network-monitoring-tool-for-linux/
https://www.tecmint.com/tag/linux-tricks/
https://www.tecmint.com/tag/linux-tricks/page/18/
https://www.tecmint.com/category/python/page/2/
https://www.tecmint.com/protect-apache-using-mod_security-and-mod_evasive-on-rhel-centos-fedora/
https://www.tecmint.com/tag/lamp/
https://www.tecmint.com/apache-virtual-hosting-in-centos/
https://www.tecmint.com/install-cpanel-whm-in-rhel-centos/
https://www.tecmint.com/create-multiple-ip-addresses-to-one-single-network-interface/
https://www.youtube.com/c/musaamin/videos
https://www.tecmint.com/install-nagios-in-linux/
https://www.tecmint.com/install-nagios-in-linux/
https://www.tecmint.com/install-nagios-in-linux/

https://www.tecmint.com/install-and-configure-zabbix-monitoring-on-debian-centos-rhel/
https://www.tecmint.com/install-and-configure-zabbix-monitoring-on-debian-centos-rhel/

https://www.tecmint.com/install-cacti-network-monitoring-on-rhel-centos-fedora/
https://www.tecmint.com/install-cacti-network-monitoring-on-rhel-centos-fedora/
https://www.niagahoster.co.id/ebook/panduan-digital-marketing?gclid=EAIaIQobChMIhf7JsKS27wIVVWaWCh3BUALpEAEYASAAEgJfCfD_BwE#
https://www.niagahoster.co.id/ebook/panduan-digital-marketing?gclid=EAIaIQobChMIhf7JsKS27wIVVWaWCh3BUALpEAEYASAAEgJfCfD_BwE#
https://www.niagahoster.co.id/ebook
https://www.niagahoster.co.id/ebook
https://www.niagahoster.co.id/ebook/mengapa-harus-bisnis-online
https://www.niagahoster.co.id/ebook/mengapa-harus-bisnis-online



-----------------------------

#! /bin/bash
echo "pasang webserver db"
-----------------------------------

#! /bin/bash
echo "--> Updating CentOS System, then install snmp"
yum -y update
yum install net-snmp net-snmp-utils -y
systemctl enable snmpd
systemctl restart snmpd
sudo yum install firewalld
sudo systemctl enable firewalld
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig
systemctl restart firewalld
firewall-cmd --permanent --add-port=161/udp
firewall-cmd --reload
firewall-cmd --list-all


echo -e"#### \n
# First, map the community name "public" into a "security name" \n
\n
# sec.name source community \n
com2sec notConfigUser default @lawangsewu18 \n
\n
#### \n
# Second, map the security name into a group name: \n
\n
# groupName securityModel securityName \n
group notConfigGroup v1 notConfigUser \n
group notConfigGroup v2c notConfigUser \n
\n
#### \n
# Third, create a view for us to let the group have rights to: \n
\n
# Make at least snmpwalk -v 1 localhost -c public system fast again. \n
# name incl/excl subtree mask(optional) \n
view systemview included .1.3.6.1.2.1.1 \n
view systemview included .1.3.6.1.2.1.25.1.1 \n
view all included .1 \n
\n
#### \n
# Finally, grant the group read-only access to the systemview view. \n
\n
# group context sec.model sec.level prefix read write notif \n
access notConfigGroup "" any noauth exact all none none \n
\n
\n
\n
syslocation Jakarta \n
syscontact [email protected] \n
dontLogTCPWrappersConnects yes" > /etc/snmp/snmpd.conf



echo -e "# sec.name source community \n
com2sec notConfigUser default @lawangsewu18 \n
# groupName securityModel securityName \n
group notConfigGroup v1 notConfigUser \n
group notConfigGroup v2c notConfigUser \n
#### \n
# Third, create a view for us to let the group have rights to: \n
# Make at least snmpwalk -v 1 localhost -c public system fast again. \n
# name incl/excl subtree mask(optional) \n
view systemview included .1.3.6.1.2.1.1 \n
view systemview included .1.3.6.1.2.1.25.1.1 \n
view all included .1 \n
#### \n
# Finally, grant the group read-only access to the systemview view. \n
# group context sec.model sec.level prefix read write notif \n
access notConfigGroup "" any noauth exact all none none \n
#syslocation Unknown (edit /etc/snmp/snmpd.conf) \n
syslocation Jakarta \n
syscontact [email protected] \n
# connection, which can be useful for debugging. \n
dontLogTCPWrappersConnects yes" > /etc/snmp/snmpd.conf


echo -e "# sec.name source community\ncom2sec notConfigUser default @lawangs18\n
####\n# Second, map the security name into a group name:\n
# groupName securityModel securityName\ngroup notConfigGroup v1 notConfigUser\ngroup notConfigGroup v2c notConfigUser\n
####\n# Third, create a view for us to let the group have rights to:\n# Make at least snmpwalk -v 1 localhost -c public system fast again.\n
# name incl/excl subtree mask(optional)\n#view systemview included .1.3.6.1.2.1.1\n#view systemview included .1.3.6.1.2.1.25.1.1\n
view all included .1\n
####\n# Finally, grant the group read-only access to the systemview view.\n# group context sec.model sec.level prefix read write notif\n
access notConfigGroup "" any noauth exact all none none\n
# It is also possible to set the sysContact and sysLocation system\n# variables through the snmpd.conf file:\nsyslocation Jakarta\nsyscontact [email protected]\n
# We do not want annoying "Connection from UDP: " messages in syslog.\n# If the following option is commented out, snmpd will print each incoming\n
# connection, which can be useful for debugging.\ndontLogTCPWrappersConnects yes" > /etc/snmp/snmpd.conf




============

https://computingforgeeks.com/how-to-install-postgresql-13-on-centos-7/
https://computingforgeeks.com/how-to-install-postgresql-13-on-centos-7/

4.2. PostgreSQL 13 has been released for general public use and for Production use. PostgreSQL runs on all major Linux operating systems and has been ACID-compliant since 2001. Additionally it has powerful add-ons such as the popular PostGIS geospatial database extender. This guide will walk you through the installation of PostgreSQL 13 on CentOS 7.

Add PostgreSQL Yum Repository to CentOS 7

The PostgreSQL Yum Repository will integrate with your normal systems and patch management, and provide automatic updates for all supported versions of PostgreSQL throughout the support lifetime of PostgreSQL. Run the following commands to add PostgreSQL 13 repository to your CentOS 7 Linux machine.


sudo yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
I recommend you perform system reboot after adding the repository.
sudo yum -y update
sudo reboot

Install PostgreSQL 13 on CentOS 7
After successfully adding the repository, you can proceed to install PostgreSQL 13 on CentOS 7.
Confirm the list of enabled repositories.

sudo yum repolist
sudo yum search postgresql13
Now install PostgreSQL 13 packages on your CentOS 7.
sudo yum -y install postgresql13 postgresql13-server

Initialize and start database service

After fresh installation of PostgreSQL 13 on CentOS 7 initialization is required.

$ sudo /usr/pgsql-13/bin/postgresql-13-setup initdb
Initializing database ... OK

sudo systemctl start postgresql-13
Check the service status to confirm it is running.
systemctl status postgresql-13

Enable the service to start when the system is reboted.
sudo systemctl enable postgresql-13
sudo su - postgres
psql -c "alter user postgres with password 'StrongDBPassword'"
ALTER ROLE
Enabling remote Database connections (Optional)
Edit the file /var/lib/pgsql/13/data/postgresql.conf and set Listen address to your server IP address or “*” for all interfaces.

$ sudo vi /var/lib/pgsql/13/data/postgresql.conf
# line 59
listen_addresses = '172.20.11.11'

Also set PostgreSQL to accept remote connections
sudo vi /var/lib/pgsql/13/data/pg_hba.conf

# Accept from anywhere (not recommended)
host all all 0.0.0.0/0 md5

# Accept from trusted subnet (Recommended setting)
host all all 172.20.11.0/24 md5

Restart the database service after saving the changes.
sudo systemctl restart postgresql-13
Test connection using the psql command while providing username and optionally database name.
psql -U <dbuser> -h <serverip> -p 5432 <dbname>
Install pgAdmin 4 Web interface
https://computingforgeeks.com/how-to-install-postgresql-13-on-centos-7/#ex1



https://www.tecmint.com/install-lamp-in-centos-7/
https://www.tecmint.com/install-lamp-in-centos-7/
https://www.tecmint.com/install-lamp-in-centos-7/

# yum install httpd
systemctl status|start|stop|restart|reload httpd
service httpd status|start|stop|restart|reload
apachectl configtest| graceful

On the next step start Apache service using systemd init script and open RHEL/CentOS 7.0 Firewall rules using firewall-cmd, which is the default command to manage iptables through firewalld daemon.

# firewall-cmd --add-service=http

NOTE: Make notice that using this rule will lose its effect after a system reboot or firewalld service restart, because it opens on-fly rules, which are not applied permanently. To apply consistency iptables rules on firewall use –permanent option and restart firewalld service to take effect.

# firewall-cmd --permanent --add-service=http
# systemctl restart firewalld

Other important Firewalld options are presented below:

# firewall-cmd --state
# firewall-cmd --list-all
# firewall-cmd --list-interfaces
# firewall-cmd --get-service
# firewall-cmd --query-service service_name
# firewall-cmd --add-port=8080/tcp

To verify Apache functionality open a remote browser and type your server IP Address using HTTP protocol on URL (http://server_IP), and a default page should appear like in the screenshot below.

For now, Apache DocumentRoot path it’s set to /var/www/html system path, which by default doesn’t provide any index file. If you want to see a directory list of your DocumentRoot path open Apache welcome configuration file and set Indexes statement from – to + on <LocationMach> directive, using the below screenshot as an example.

# nano /etc/httpd/conf.d/welcome.conf

Close the file, restart Apache service to reflect changes and reload your browser page to see the final result.

# systemctl restart httpd

Install PHP5 Support for Apache

Before installing PHP5 dynamic language support for Apache, get a full list of available PHP modules and extensions using the following command.

# yum search php

Depending on what type of applications you want to use, install the required PHP modules from the above list, but for a basic MariaDB support in PHP and PhpMyAdmin you need to install the following modules.

# yum install php php-mysql php-pdo php-gd php-mbstring

To get a full information list on PHP from your browser, create a info.php file on Apache Document Root using the following command from root account, restart httpd service and direct your browser to the http://server_IP/info.php address.

# echo "<?php phpinfo(); ?>" > /var/www/html/info.php
# systemctl restart httpd

If you get an error on PHP Date and Timezone, open php.ini configuration file, search and uncomment date.timezone statement, append your physical location and restart Apache daemon.

# nano /etc/php.ini

Locate and change date.timezone line to look like this, using PHP Supported Timezones list.

date.timezone = Continent/City

https://www.php.net/manual/en/timezones.php

Install and Configure MariaDB Database
# yum install mariadb-server mariadb
After MariaDB package is installed, start database daemon and use mysql_secure_installation script to secure database (set root password, disable remotely logon from root, remove test database and remove anonymous users).
# systemctl start mariadb
# mysql_secure_installation
To test database functionality login to MariaDB using its root account and exit using quit statement.

mysql -u root -p
MariaDB > SHOW VARIABLES;
MariaDB > quit

By default official RHEL 7.0 or CentOS 7.0 repositories doesn’t provide any binary package for PhpMyAdmin Web Interface. If you are uncomfortable using MySQL command line to manage your database you can install PhpMyAdmin package by enabling CentOS 7.0 rpmforge repositories using the following command.

# yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm

After enabling rpmforge repository, next install PhpMyAdmin.

# yum install phpmyadmin
Next configure PhpMyAdmin to allow connections from remote hosts by editing phpmyadmin.conf file, located on Apache conf.d directory, commenting the following lines.

# nano /etc/httpd/conf.d/phpmyadmin.conf
Use a # and comment this lines.

# Order Deny,Allow
# Deny from all
# Allow from 127.0.0.1

To be able to login to PhpMyAdmin Web interface using cookie authentication method add a blowfish string to phpmyadmin config.inc.php file like in the screenshot below using the generate a secret string, restart Apache Web service and direct your browser to the URL address http://server_IP/phpmyadmin/.

# nano /etc/httpd/conf.d/phpmyadmin.conf
# systemctl restart httpd

Enable LAMP System-wide

If you need MariaDB and Apache services to be automatically started after reboot issue the following commands to enable them system-wide.

# systemctl enable mariadb
# systemctl enable httpd

https://www.tecmint.com/apache-virtual-hosting-in-centos/https://www.tecmint.com/apache-virtual-hosting-in-centos/
https://www.tecmint.com/apache-virtual-hosting-in-centos/


Create and Manage Apache Virtual Hosts in RHEL/CentOS 7

To begin, start by entering on /etc/httpd/ path, create sites-available and sites-enabled directories and edit Apache httpd.conf file to apply the new enabled websites location.

# cd /etc/httpd/
# mkdir sites-available sites-enabled
# nano conf/httpd.conf

On httpd.conf file add the following directive line at the bottom of the file, which will make Apache read and parse all files located on /etc/httpd/sites-enabled/ ended in .conf extension.

IncludeOptional sites-enabled/*.conf

On next step create a new Virtual Host on sites-available location using a descriptive name – in this case I’ve used rheltest.lan.conf – and use the following file as a template.


nano /etc/httpd/sites-available/rheltest.lan.conf

<VirtualHost *:80>
ServerName rheltest.lan
DocumentRoot "/var/www/rheltest.lan"
<Directory "/var/www/rheltest.lan">
Options Indexes FollowSymLinks MultiViews
# AllowOverride controls what directives may be placed in .htaccess files.
AllowOverride All
# Controls who can get stuff from this server file
Order allow,deny
Allow from all
</Directory>
<IfModule mpm_peruser_module>
ServerEnvironment apache apache
</IfModule>
ErrorLog /var/log/httpd/rheltest.lan-error.log
CustomLog /var/log/httpd/rheltest.lan-access.log combined
</VirtualHost>

If you changed DocumentRoot location on your virtual host from default /var/www/html to other path make sure you also create this path.

NOTE: Also assure that ServerName host is a valid DNS record or is added to your local machines hosts file, from where you are planning to visit the website.

Now it’s time to create a2ensite and a2dissite bash scripts on a executable system path – in this case is /usr/local/bin/ – but
you can use any executable path that $PATH system variable outputs.
Create a2ensite Script

Create a following file with your choice of editor.

# nano /usr/local/bin/a2ensite



#!/bin/bash
if test -d /etc/httpd/sites-available && test -d /etc/httpd/sites-enabled ; then
echo "-----------------------------------------------"
else
mkdir /etc/httpd/sites-available
mkdir /etc/httpd/sites-enabled
fi

avail=/etc/httpd/sites-available/$1.conf
enabled=/etc/httpd/sites-enabled/
site=`ls /etc/httpd/sites-available/`

if [ "$#" != "1" ]; then
echo "Use script: a2ensite virtual_site"
echo -e "\nAvailable virtual hosts:\n$site"
exit 0
else

if test -e $avail; then
sudo ln -s $avail $enabled
else

echo -e "$avail virtual host does not exist! Please create one!\n$site"
exit 0
fi
if test -e $enabled/$1.conf; then

echo "Success!! Now restart Apache server: sudo systemctl restart httpd"
else
echo -e "Virtual host $avail does not exist!\nPlease see available virtual hosts:\n$site"
exit 0
fi
fi

-----------
Create a2dissite Script

Create a following file with your choice of editor.

# nano /usr/local/bin/a2dissite

Add the whole following script to the file.


#!/bin/bash
avail=/etc/httpd/sites-enabled/$1.conf
enabled=/etc/httpd/sites-enabled
site=`ls /etc/httpd/sites-enabled/`

if [ "$#" != "1" ]; then
echo "Use script: a2dissite virtual_site"
echo -e "\nAvailable virtual hosts: \n$site"
exit 0
else

if test -e $avail; then
sudo rm $avail
else
echo -e "$avail virtual host does not exist! Exiting!"
exit 0
fi

if test -e $enabled/$1.conf; then
echo "Error!! Could not remove $avail virtual host!"
else
echo -e "Success! $avail has been removed!\nPlease restart Apache: sudo systemctl restart httpd"
exit 0
fi
fi

After both script files had been created, make sure they are executable and start using them to enable or disable virtual hosts by appending vhost name as command parameter.

# chmod +x /usr/local/bin/a2*
# a2ensite vhost_name
# a2disite vhost_name

To test it, enable the virtual host created earlier, restart Apache service and direct browser to the new virtual host – in this case http://rheltest.lan.

# a2ensite rheltest.lan
# systemctl restart httpd

That’s it! Now you can use a2eniste and a2dissite bash scripts as system commands to manage Apache Vhosts file on RHEL/CentOS 7.0.

https://www.tecmint.com/apache-ip-based-and-name-based-virtual-hosting/
https://www.tecmint.com/apache-ip-based-and-name-based-virtual-hosting/
https://www.tecmint.com/apache-ip-based-and-name-based-virtual-hosting/

Lets set up Name Based Virtual Hosting and IP based Virtual hosting in RHEL, CentOS and Fedora.
Testing Environment

OS – CentOS 6.5
Application – Apache Web Server
IP Address – 192.168.0.100
IP Address – 192.168.0.101
Domain – www.example1.com
Domain – www.example2.com


How to Setup IP Based and Name Based Apache Virtual Hosts

Before setting up virtual hosting with Apache, your system must have Apache Web software installed. if not, install it using default package installer called yum.

yum install httpd
Setup Name Based Virtual Host

But, before creating a virtual host, you need to create a directory where you will keep all your website’s files. So, create directories for these two virtual hosts under /var/www/html folder. Please remember /var/www/html will be your default Document Root in the Apache virtual configuration.

[root@tecmint ~]# mkdir /var/www/html/example1.com/
[root@tecmint ~]# mkdir /var/www/html/example2.com/

To set up Name based virtual hosting you must need to tell Apache to which IP you will be using to receive the Apache requests for all the websites or domain names. We can do this with NameVirtualHost directive. Open Apache main configuration file with VI editor.

[root@tecmint ~]# vi /etc/httpd/conf/httpd.conf

Search for NameVirtualHost and uncomment this line by removing the # sign in front of it.

NameVirtualHost

Next add the IP with possible in which you want to receive Apache requests. After the changes, your file should look like this:

NameVirtualHost 192.168.0.100:80


Now, it’s time to setup Virtual host sections for your domains, move to the bottom of the file by pressing Shift + G. Here in this example, We are setting up virtual host sections for two domains

www.example1.com
www.example2.com


Add the following two virtual directives at the bottom of the file. Save and close the file.

<VirtualHost 192.168.0.100:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/example1.com
ServerName www.example1.com
ErrorLog logs/www.example1.com-error_log
CustomLog logs/www.example1.com-access_log common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/example2.com
ServerName www.example2.com
ErrorLog logs/www.example2.com-error_log
CustomLog logs/www.example2.com-access_log common
</VirtualHost>

You are free to add as many directives you want to add in your domains virtual host section. When you are done with changes in httpd.conf file, please check the syntax of files with following command.

[root@tecmint ~]# httpd -t

Syntax OK

It is recommended to check the syntax of the file after making some changes and before restarting the Web server because if any syntax goes wrong Apache will refuse to work with some errors and eventually affect your existing web server go down for a while. If syntax is OK. Please restart your Web server and add it to chkconfig to make your web server start in runlevel 3 and 5 at the boot time only.

[root@tecmint ~]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]

[root@tecmint ~]# chkconfig --level 35 httpd on

Now it’s time to create a test page called index.html add some content to the file so we will have something to check it, when the IP calls the virtual host.

[root@tecmint ~]# vi /var/www/html/example1.com/index.html

<html>
<head>
<title>www.example1.com</title>
</head>
<body>
<h1>Hello, Welcome to www.example1.com.</h1>
</body>
</html>

[root@tecmint ~]# vi /var/www/html/example2.com/index.html

<html>
<head>
<title>www.example2.com</title>
</head>
<body>
<h1>Hello, Welcome to www.example2.com.</h1>
</body>
</html>

Once you’re done with it, you can test the setup by accessing both the domains in a browser.

http://www.example1.com
http://www.example2.com

Setup IP Based Virtual Hosting Linux

To setup IP based virtual hosting, you must have more than one IP address/Port assigned to your server or your Linux machine.

It can be on a single NIC card , For example: eth0:1, eth0:2, eth0:3 … so forth. Multiple NIC cards can also be attached. If you don’t know how to create multiple IP’s on single NIC, follow the below guide, that will help you out in creating.

Purpose of implementing IP based virtual hosting is to assign implementing for each domain and that particular IP will not be used by any other domain.

This kind of set up required when a website is running with SSL certificate (mod_ssl) or on different ports and IPs. And You can also run multiple instances of Apache on a single machine. To check the IPs attached in your server, please check it using ifconfig command.

As you can see in above output, two IPs 192.168.0.100 (eth0) and 192.168.0.101 (eth0:1) is attached to the server, both IPs are assigned to the same physical network device (eth0).

Now, assign a specific IP/Port to receive http requests, you can simply do it by changing Listen directive in httpd.conf file.

[root@tecmint ~]# vi /etc/httpd/conf/httpd.conf
Search for word “Listen”, You find a section where the short description about Listen directive is written. In that section, comment the original line and write your own directive below that line.

# Listen 80

Listen 192.168.0.100:80

Now, create a Virtual host sections for both the domains. Go the bottom of the file and add the following virtual directives.

<VirtualHost 192.168.0.100:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/example1
ServerName www.example1.com
ErrorLog logs/www.example1.com-error_log
TransferLog logs/www.example1.com-access_log
</VirtualHost>

<VirtualHost 192.168.0.101:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/example2
ServerName www.example2.com
ErrorLog logs/www.example2.com-error_log
TransferLog logs/www.example2.com-access_log
</VirtualHost>

Now, since you have modified main Apache conf file, you need to restart the http service like below.

[root@tecmint ~]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]

Test your IP based Virtual hosting setup by accessing the URLs on web browser as shown below.








-------------------------
https://www.tecmint.com/install-and-compile-php-7-on-centos-7-and-debian-8/

yum update && yum install httpd mariadb mariadb-server
aptitude update && aptitude install apache2 mariadb-server mariadb-client mariadb.common
wget https://downloads.php.net/~ab/php-7.0.0RC1.tar.gz
tar xzf php-7.0.0RC1.tar.gz -C /opt
ls
cd /opt/php-7.0.0RC1.tar.gz
./buildconf --force

# ./configure \
--prefix=$HOME/php7/usr \
--with-config-file-path=$HOME/php7/usr/etc \
--enable-mbstring \
--enable-zip \
--enable-bcmath \
--enable-pcntl \
--enable-ftp \
--enable-exif \
--enable-calendar \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-curl \
--with-mcrypt \
--with-iconv \
--with-gmp \
--with-pspell \
--with-gd \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-zlib-dir=/usr \
--with-xpm-dir=/usr \
--with-freetype-dir=/usr \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-openssl \
--with-pdo-mysql=/usr \
--with-gettext=/usr \
--with-zlib=/usr \
--with-bz2=/usr \
--with-recode=/usr \
--with-mysqli=/usr/bin/mysql_config \
--with-apxs2

configure: error: no acceptable C compiler found in $PATH
see 'config.log' for more details

yum install gcc
aptitude install gcc

configure: error: xml2-config not found. Please check your libxml2 installation.

ON CENTOS 7
gcc
libxml2-devel
pkgconfig
openssl-devel
bzip2-devel
curl-devel
libpng-devel
libpng-devel
libjpeg-devel
libXpm-devel
freetype-devel
gmp-devel
libmcrypt-devel
mariadb-devel
aspell-devel
recode-devel
httpd-devel

yum install gcc libxml2-devel pkgconfig openssl-devel bzip2-devel libpng-devel libpng-devel libjpeg-devel libXpm-devel freetype-devel gmp-devel libmcrypt-devel mariadb-devel aspell-devel recode-devel httpd-devel

make
make install

ON DEBIAN 8

# apt-get install make libxml2-dev libcurl4-openssl-dev libjpeg-dev libpng-dev libxpm-dev libmysqlclient-dev libicu-dev libfreetype6-dev libxslt-dev libssl-dev libbz2-dev libgmp-dev libmcrypt-dev libpspell-dev librecode-dev apache2-dev

# ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h
# make
# make install

​Setting Up php.ini and Testing PHP 7 Installation
# ls -l /opt/php-7.0.0RC1 | grep php.ini
# cp /opt/php-7.0.0RC1/php.ini-development /usr/local/lib

/etc/httpd/conf/httpd.conf [On CentOS 7 box]
/etc/apache2/apache2.conf in [On Debian 8 box]

LoadModule php7_module /usr/lib64/httpd/modules/libphp7.so
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>

In Debian 8 you can omit the LoadModule line and also you need to remove and create the following symbolic links to the indicated Apache modules:

# cd /etc/apache2
# rm mods-enabled/mpm_event.conf
# rm mods-enabled/mpm_event.load
# ln -s mods-available/mpm_prefork.conf mpm_prefork.conf
# ln -s mods-available/mpm_prefork.load mpm_prefork.load


# systemctl restart httpd [On CentOS 7 box]
# systemctl restart apache2 [On Debian 8 box]

http://localhost/test.php
OR
http://IP-address/test.php


https://www.tecmint.com/install-and-compile-php-7-on-centos-7-and-debian-8/
https://www.tecmint.com/install-and-compile-php-7-on-centos-7-and-debian-8/
https://www.tecmint.com/install-and-compile-php-7-on-centos-7-and-debian-8/


https://www.tecmint.com/install-apache-mysql-php-on-redhat-centos-fedora/
https://www.tecmint.com/install-apache-mysql-php-on-redhat-centos-fedora/

# yum update && yum install epel-release
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

On RHEL/CentOS 7

# yum update && yum install epel-release
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

------ For RHEL 7 Only ------
# subscription-manager repos --enable=rhel-7-server-optional-rpms


On RHEL/CentOS 6

# yum update && yum install epel-release
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

------ For RHEL 6 Only ------
# subscription-manager repos --enable=rhel-6-server-optional-rpms


On Fedora 24-29

# rpm -Uvh http://rpms.remirepo.net/fedora/remi-release-29.rpm [On Fedora 29]
# rpm -Uvh http://rpms.remirepo.net/fedora/remi-release-28.rpm [On Fedora 28]
# rpm -Uvh http://rpms.remirepo.net/fedora/remi-release-27.rpm [On Fedora 27]
# rpm -Uvh http://rpms.remirepo.net/fedora/remi-release-26.rpm [On Fedora 26]
# rpm -Uvh http://rpms.remirepo.net/fedora/remi-release-25.rpm [On Fedora 25]
# rpm -Uvh http://rpms.remirepo.net/fedora/remi-release-24.rpm [On Fedora 24]


Step 2: Installing Apache Web Server

# yum -y update
# yum install httpd

# systemctl start httpd
# systemctl enable httpd
# systemctl status httpd

If you are running firewalld, make sure to allow Apache traffic on the firewall.

# firewall-cmd --zone=public --permanent --add-service=http
# firewall-cmd --zone=public --permanent --add-service=https
# firewall-cmd --reload

# yum install yum-utils

For example, to install PHP 7.x version, use the following command.

On CentOS & RHEL -------------
# yum-config-manager --enable remi-php70 && yum install php [Install PHP 7.0]
# yum-config-manager --enable remi-php71 && yum install php [Install PHP 7.1]
# yum-config-manager --enable remi-php72 && yum install php [Install PHP 7.2]
# yum-config-manager --enable remi-php73 && yum install php [Install PHP 7.3]

------------- On Fedora -------------
# dnf --enablerepo=remi install php70 [Install PHP 7.0]
# dnf --enablerepo=remi install php71 [Install PHP 7.1]
# dnf --enablerepo=remi install php72 [Install PHP 7.2]
# dnf --enablerepo=remi install php73 [Install PHP 7.3]

------ RHEL/CentOS 7/6------
# yum search all php

------ Fedora / CENTOS 8------
# dnf search all php

Here are the packages that we will install. Please keep in mind that MySQL connectors (PHP, Perl, Python, Java, etc.) will work unchanged with MariaDB as both systems use the same client protocol and the client libraries are binary compatible.

MariaDB/MySQL (php-mysql) – a dynamic shared object that will add MariaDB support to PHP.
PostgreSQL (php-pgsql) – PostgreSQL database support for PHP.
MongoDB (php-pecl-mongo) – An interface for communicating with the MongoDB database in PHP.
Generic (php-pdo) – A dynamic shared object that will add a database access abstraction layer to PHP.
Memcache (php-pecl-memcache) – Memcached is a caching daemon designed especially for dynamic web applications to decrease database load by storing objects in memory.
Memcached (php-pecl-memcached) – An extension that uses the libmemcached library to provide API for communicating with memcached servers.
GD (php-gd) – A dynamic share object that adds support for using the gd graphics library to PHP.
XML (php-xml) – A dynamic shared objects that adds support to PHP for manipulating XML documents.
MBString (php-mbstring) – An extension to handle multi-byte string in PHP applications.
MCrypt (php-mcrypt) – A Mcrypt library for PHP scripts.
APC (php-pecl-apcu) – APC module used to optimize and cache PHP code.
CLI (php-cli) – Command-line interface for PHP.
PEAR (php-pear) – Application Repository framework for PHP.

Install these following necessary PHP modules with the command below.

------ On RHEL/CentOS 7/6 ------
# yum --enablerepo=remi install php-mysqlnd php-pgsql php-pecl-mongo php-pdo php-pecl-memcache php-pecl-memcached php-gd php-xml php-mbstring php-mcrypt php-pecl-apcu php-cli php-pear

------ On Fedora / CENTOS 8 ------
# dnf --enablerepo=remi install php-mysqlnd php-pgsql php-pecl-mongo php-pdo php-pecl-memcache php-pecl-memcached php-gd php-xml php-mbstring php-mcrypt php-pecl-apcu php-cli php-pear

Installing MySQL 8 Database Server
To install latest MySQL 8.0 version, we will install and enable official MySQL Yum software repository using the following commands.

# rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm [On RHEL/CentOS 7]
# rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el6-1.noarch.rpm [On RHEL/CentOS 6]
# rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-fc29-1.noarch.rpm [On Fedora 29]
# rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-fc28-1.noarch.rpm [On Fedora 29]
# rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-fc27-1.noarch.rpm [On Fedora 29]
# rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-fc26-1.noarch.rpm [On Fedora 29]
# rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-fc25-1.noarch.rpm [On Fedora 29]
# rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-fc24-1.noarch.rpm [On Fedora 29]


After installing the MySQL Yum software repository for your Linux platform, now install the latest version of MySQL (currently 8.0) using the following command.

# yum install mysql-community-server [On RHEL/CentOS]
# dnf install mysql-community-server [On Fedora]

# service mysqld start

Installing MariaDB 10 Database Server

/etc/yum.repos.d/mariadb.repo

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

------ On RHEL/CentOS 7 ------
# yum --enablerepo=remi install httpd MariaDB-client MariaDB-server

------ On Fedora / CENTOS 8------
# dnf --enablerepo=remi install httpd MariaDB-client MariaDB-server

Step 5: Enable/Start Apache and MySQL/MariaDB

------ Enable Apache and MariaDB on Boot ------
# systemctl enable httpd
# systemctl enable mariadb

------ Start Apache and MariaDB ------
# systemctl start httpd
# systemctl start mariadb


On SysVinit

------ Enable Apache and MySQL on Boot ------
# chkconfig --levels 235 httpd on
# chkconfig --levels 235 mysqld on

------ Start Apache and MySQL ------
# /etc/init.d/httpd start
# /etc/init.d/mysqld start


Step 6: Verifying PHP Instalation

Let’s stick with the classic way of testing PHP. Create a file called test.php
Now point your web browser to http://[server]/test.php and check the presence of the
under /var/www/html and add the following lines of code to it.

The phpinfo() function shows a great deal of information about the current PHP installation:

Now point your web browser to http://[server]/test.php and check the presence of the

https://www.tecmint.com/forbidden-you-dont-have-permission-to-access-on-this-server-error/
https://www.tecmint.com/forbidden-you-dont-have-permission-to-access-on-this-server-error/
https://www.tecmint.com/protect-apache-using-mod_security-and-mod_evasive-on-rhel-centos-fedora/
https://www.tecmint.com/protect-apache-using-mod_security-and-mod_evasive-on-rhel-centos-fedora/
https://www.tecmint.com/install-lamp-on-centos-8/
https://www.tecmint.com/ubuntu-apache-mod_status/
https://www.tecmint.com/ubuntu-apache-mod_status/
https://www.tecmint.com/install-varnish-cache-on-centos-7-for-apache/
https://www.tecmint.com/install-varnish-cache-on-centos-7-for-apache/
https://www.tecmint.com/centos-7-5-installation-guide/
https://www.tecmint.com/centos-7-5-installation-guide/
https://www.tecmint.com/goaccess-a-real-time-apache-and-nginx-web-server-log-analyzer/
https://www.tecmint.com/goaccess-a-real-time-apache-and-nginx-web-server-log-analyzer/



https://www.tecmint.com/install-wordpress-with-apache-on-centos-rhel-fedora/
https://www.tecmint.com/install-wordpress-with-apache-on-centos-rhel-fedora/

Installing Remi Repository on CentOS 7
The installation that we will perform will be on CentOS 7, but same instructions also works on RHEL and Fedora distributions as well.

First install and enable Remi repository using following command.

Since we are going to use php7.3, we will need to disable the installation of php5.4 using yum-config-manager command provided by yum-utils tool.

CentOS version 7.7
# dnf install http://rpms.remirepo.net/fedora/remi-release-29.rpm [On Fedora 29]
# yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm [On CentOS/RHEL 7]
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm

RHEL or CentOS 7
yum install yum-utils
yum-config-manager --enable remi-php74


# yum install yum-utils

yum repolist
yum -v repolist all
shows all enabled repositories. These two commands are identical.
yum repolist disabled

# yum-config-manager --disable remi-php54
# yum-config-manager --enable remi-php73
# yum-config-manager --enable remi-php74

# yum install httpd mariadb mariadb-server php php-common php-mysql php-gd php-xml php-mbstring php-mcrypt

# systemctl start mariadb
# mysql_secure_installation

Then we will configure MariaDB to start automatically on system boot:
# systemctl enable mariadb

# systemctl start httpd
# systemctl enable httpd


# mysql -u root -p
Enter password:

## Create database ##
CREATE DATABASE wordpress;

## Creating new user ##
CREATE USER wordpress@localhost IDENTIFIED BY "secure_password";

## Grant privileges to database ##
GRANT ALL ON wordpress.* TO wordpress@localhost;

## FLUSH privileges ##
FLUSH PRIVILEGES;

## Exit ##
exit

#cd /tmp && wget http://wordpress.org/latest.tar.gz
#tar -xvzf latest.tar.gz -C /var/www/html
#/var/www/html/wordpress
#chown -R apache /var/www/html/wordpress

Creating Apache Virtual Host for WordPress
#vim /etc/httpd/conf/httpd.conf


<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/wordpress
ServerName tecminttest.com
ServerAlias www.tecminttest.com
ErrorLog /var/log/httpd/tecminttest-error-log
CustomLog /var/log/httpd/tecminttest-acces-log common
</VirtualHost>

# systemctl restart httpd

============
https://www.tecmint.com/install-wordpress-using-apache-in-debian-ubuntu-linux-mint/

1. First of all, due to fact that there’s no authoritative DNS server on the network, and for this setup Apache Virtual Host is used. We need to map server IP to our virtual (fake) domain name to be able to access it like a real domain name from any browser.

To complete this job open and edit ‘/etc/hosts‘ on local server and your preferred domain name on the “127.0.0.1 localhost” line end. In my case, I’ve taken the domain name as ‘wordpress.lan‘.

$ sudo nano /etc/hosts
$ ping wordpress.lan

2. If your server is designed for production and runs only from the command line ( and it should ) and you need to access WordPress domain from a Windows station somewhere on your network then open and modify with a notepad that Windows hosts file located on ‘C:\Windows\System32\drivers\etc‘ path and on the last line add your Apache Server LAMP IP and your virtual domain name.


$ sudo apt-get install apache2 apache2-utils php libapache2-mod-php php-mysql php-curl php-gd php-intl php-mbstring php-soap php-xml php-xmlrpc php-zip mariadb-server mariadb-client

$ sudo apt-get install phpmyadmin

5. After PhpMyAdmin had been installed is time to make it accessible for web browsing and for that
Apache web server needs to read its configurations file.

To enable PhpMyAdmin you must copy 'apache.conf' PhpMyAdmin configuration to 'conf-available'
Apache path and enable the new configuration.

For this, run the following series of commands on Ubuntu and Linux Mint systems.


$ sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/
$ sudo mv /etc/apache2/conf-available/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
$ sudo a2enconf phpmyadmin

On Debian systems, issue the following commands.

$ sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/
$ sudo mv /etc/apache2/conf.d/apache.conf /etc/apache2/conf.d/phpmyadmin.conf


Creating Apache Virtual Host for Domain

7. The next step is to create a Virtual Host on the Apache web server that will host the WordPress new domain. To create and activate a new Virtual Host, open a text editor and create a new file named, suggestive, 'wordpress.conf' on '/etc/apache2/sites-available/' path by running the following command.

$ sudo nano /etc/apache2/sites-available/wordpress.conf

<VirtualHost *:80>
ServerName wordpress.lan
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Then activate the new virtual host with this command.
$ sudo a2ensite wordpress.conf
$ sudo systemctl reload apache2

. To avoid that future Apache error concerning, ServerName FQDN missing open main
configuration file '/etc/apache2/apache2.conf', add the following line at the bottom of the
file and restart service.

ServerName wordpress.lan


$ sudo systemctl restart apache2

$ sudo mysql_secure_installation


11. Now is time to actually create a WordPress database by connecting to mysql shell as a root user.

$ sudo mysql -u root -p
MariaDB [(none)]> CREATE DATABASE mysite;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON mysite.* TO 'mysiteadmin'@'localhost' IDENTIFIED BY 'SecureP@ssHere!';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

$ wget http://wordpress.org/latest.tar.gz

Next extract WordPress archive and copy all extracted files to Apache Virtual Host DocumentRoot, that will be '/var/www/html' on Ubuntu and Linux Mint systems.

$ sudo tar xvzf latest.tar.gz
$ sudo cp -r wordpress/* /var/www/html

On Debian systems, run the following commands.

$ sudo tar xvzf latest.tar.gz
$ sudo mkdir -p /var/www/html
$ sudo cp -r wordpress/* /var/www/html

$ sudo service apache2 restart
$ sudo service mysql restart
$ sudo chown -R www-data /var/www/html
$ sudo chmod -R 755 /var/www/html

Open a browser and enter your server’s IP or virtual domain name on URL using the HTTP protocol.

http://wordpress.lan/index.php
http://your_server_IP/index.php

$ sudo chown -R root /var/www/html

Enable HTTPS on WordPress

21. If you want to enforce HTTPS on your WordPress website, you need to install a free SSL certificate from Let’s Encrypt as shown.

$ sudo apt-get update
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository universe
$ sudo apt-get update
$ sudo apt-get install certbot python3-certbot-nginx
$ sudo certbot --apache


To verify that your WordPress site uses HTTPS, visit your website at https://yourwebsite.com/ and look for the lock icon in the URL bar. Alternatively, you can check your site’s HTTPS at https://www.ssllabs.com/ssltest/.



https://www.tecmint.com/install-wordpress-with-apache-on-centos-rhel-fedora/
https://www.tecmint.com/install-wordpress-with-apache-on-centos-rhel-fedora/


Install WordPress 5 with Apache, MariaDB 10 and PHP 7 on CentOS 7

Installing Remi Repository on CentOS 7
The installation that we will perform will be on CentOS 7, but same instructions also works on RHEL and Fedora distributions as well.

First install and enable Remi repository using following command.

# yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm [On CentOS/RHEL 7]
# dnf install http://rpms.remirepo.net/fedora/remi-release-29.rpm [On Fedora 29]

Since we are going to use php7.3, we will need to disable the installation of php5.4 using yum-config-manager command provided by yum-utils tool.

# yum install yum-utils
# yum-config-manager --disable remi-php54
# yum-config-manager --enable remi-php73

Installing LAMP Stack on CentOS 7
Now we are ready to install all the required packages related to our LAMP stack using following command.

# yum install httpd mariadb mariadb-server php php-common php-mysql php-gd php-xml php-mbstring php-mcrypt
Now that the installation is complete, we will need to start and secure our MariaDB installation.
# systemctl start mariadb
# mysql_secure_installation


Follow the instructions on the screen to answer the questions related to your MariaDB server security.
Then we will configure MariaDB to start automatically on system boot:

# systemctl enable mariadb
Next we will do the same for Apache web server:
# systemctl start httpd
# systemctl enable httpd

# mysql -u root -p
Enter password:
## Create database ##
CREATE DATABASE wordpress;
## Creating new user ##
CREATE USER wordpress@localhost IDENTIFIED BY "secure_password";
## Grant privileges to database ##
GRANT ALL ON wordpress.* TO wordpress@localhost;
## FLUSH privileges ##
FLUSH PRIVILEGES;
## Exit ##
exit

# cd /tmp && wget http://wordpress.org/latest.tar.gz
# tar -xvzf latest.tar.gz -C /var/www/html
/var/www/html/wordpress
# chown -R apache /var/www/html/wordpress
# vim /etc/httpd/conf/httpd.conf

<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/wordpress
ServerName tecminttest.com
ServerAlias www.tecminttest.com
ErrorLog /var/log/httpd/tecminttest-error-log
CustomLog /var/log/httpd/tecminttest-acces-log common
</VirtualHost>

Save your changes and restart Apache:
# systemctl restart httpd

Installing WordPress on Website

Now we are ready to run our WordPress installation. To start the installation you can access either your server’s IP address at http://ip-address or if installing locally you can use http://localhost or if you are using a real domain, you can use the domain instead. You should see the following page:

https://musaamin.web.id/cara-install-php-7-di-centos-7/
https://musaamin.web.id/cara-install-php-7-di-centos-7/
https://musaamin.web.id/cara-install-php-7-di-centos-7/

Di CentOS 7 versi PHP yang tersedia di repository default adalah PHP 5.4. Untuk instalasi PHP 7 kita harus menambahkan repository lainnya. Package PHP 7 tersedia di repository Webtatic, IUS, atau Remi. Pada tutorial ini digunakan repository Remi.

Perintah yum info php. Terlihat version PHP 5.4.16.

[root@lab-centos ~]# yum list php
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: repo.us.bigstepcloud.com
* epel: mirror.steadfast.net
* extras: mirrors.gigenet.com
* updates: mirrors.gigenet.com
Available Packages
Name : php
Arch : x86_64
Version : 5.4.16
Release : 43.el7_4
Size : 1.4 M
Repo : updates/7/x86_64

# yum install httpd
# systemctl start httpd
# systemctl enable httpd
# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Install repository Remi. Repository Remi ini menyediakan PHP versi 5.4, 7.0, 7.1, dan 7.2.
Perintah install repository di bawah ini akan menambah file .repo di /etc/yum.repos.d.
# rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm

Lihat isi folder /etc/yum.repos.d
# ls -l /etc/yum.repos.d
...
-rw-r--r--. 1 root root 457 Jun 30 2017 remi-php54.repo
-rw-r--r--. 1 root root 1316 Jun 30 2017 remi-php70.repo
-rw-r--r--. 1 root root 1316 Jun 30 2017 remi-php71.repo
-rw-r--r--. 1 root root 1316 Jun 30 2017 remi-php72.repo
-rw-r--r--. 1 root root 2609 Jun 30 2017 remi.repo
-rw-r--r--. 1 root root 751 Jun 30 2017 remi-safe.repo

Install paket yum-utils untuk yum-config-manager
# yum install yum-utils
Mengaktifkan repository remi-php70
# yum-config-manager --enable remi-php70
Cek ulang informasi paket PHP. Apakah sudah mengarah ke repository Remi dengan PHP 7.0.

# yum info php
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: repo.us.bigstepcloud.com
* epel: mirror.steadfast.net
* extras: mirrors.gigenet.com
* remi-php70: repo1.dal.innoscale.net
* remi-safe: repo1.dal.innoscale.net
* updates: mirrors.gigenet.com
Available Packages
Name : php
Arch : x86_64
Version : 7.0.26
Release : 1.el7.remi
Size : 2.6 M
Repo : remi-php70

# yum install php php-common
Restart service apache agar dapat membaca PHP
# systemctl restart httpd
Buat file info.php untuk menguji instalasi PHP
# nano /var/www/html/info.php

https://musaamin.web.id/how-to-install-phpfpm-apache-ubuntu2004/
https://musaamin.web.id/how-to-install-phpfpm-apache-ubuntu2004/
https://musaamin.web.id/how-to-install-phpfpm-apache-ubuntu2004/

1. Install Apache
Install Apache and FastCGI module.

sudo apt update
sudo apt install apache2 libapache2-mod-fcgid -y

2. Install PHP and PHP-FPM
Install PHP and PHP-FPM.

sudo apt install php php-fpm -y

Check the status of the php-fpm service.

sudo systemctl status php7.4-fpm

3. Configure Apache
Activate the required module.

sudo a2enmod actions fcgid alias proxy_fcgi

Configure the virtual host to run PHP-FPM.
sudo nano /etc/apache2/sites-available/000-default.conf
Add the below configuration between VirtualHost tag.

<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php/php7.4-fpm.sock|fcgi://localhost"
</FilesMatch>

sudo systemctl restart apache2
sudo systemctl status apache2
Access http://localhost/info.php or http://serverIP/info.php. In the Server API the value is FPM/FastCGI.
sudo echo "<?php phpinfo(); ?>" > /var/www/html/info.php


https://musaamin.web.id/how-to-install-laravel-8-on-ubuntu-2004/

Server Requirements

Server requirements that must be met to run Laravel 8:

PHP >= 7.3
BCMath PHP Extension
Ctype PHP Extension
Fileinfo PHP extension
JSON PHP Extension
Mbstring PHP Extension
OpenSSL PHP Extension
PDO PHP Extension
Tokenizer PHP Extension
XML PHP Extension

sudo apt install composer
sudo apt install php php-common php-bcmath php-mbstring php-mysql php-tokenizer php-zip

Install Laravel
Install Laravel 8.0 using Composer and save it in the /home/user/public_html/blog folder:

mkdir ~/public_html
cd ~/public_html
composer create-project laravel/laravel blog 8.0
If you don’t specify a version number, the latest version of Laravel is installed:
composer create-project laravel/laravel blog

Running Laravel with a Development Server
Running Laravel using a development server:
cd blog
php artisan serve
The results of the above command run the development server with IP address 127.0.0.1 (localhost IP) and port 8000:
Starting Laravel development server: http://127.0.0.1:8000
[Thu Sep 10 23:32:56 2020] PHP 7.4.3 Development Server (http://127.0.0.1:8000) started
Browse http://127.0.0.1:8000 atau http://localhost:8000.
sudo apt install apache2 libapache2-mod-php
sudo systemctl restart apache2
sudo systemctl status apache2
URL address http://127.0.0.1:8000 can be changed to a hostname or local domain using Apache virtual host and the file /etc/hosts.

Create a virtual host with the name laravel.web:

<VirtualHost *:80>
ServerName laravel.web
DocumentRoot /home/user/public_html/blog/public
<Directory /home/user/public_html/blog/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/laravel.web_error.log
CustomLog /var/log/apache2/laravel.web_access.log combined
</VirtualHost>

sudo a2ensite laravel.web.conf
sudo a2enmod rewrite
sudo systemctl restart apache2

sudo chown -R $USER:www-data /home/user/public_html/blog
sudo chmod -R 775 /home/user/public_html/blog
sudo nano /etc/hosts
127.0.0.1 laravel.web
SSL
sudo apt install build-essential curl file git
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
Make homebrew available in the system environment:
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo eval" ($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
echo "eval $($(brew --prefix)/bin/brew shellenv)" >>~/.profile

Install the dependency package for mkcert:
sudo apt install libnss3-tools
brew install mkcert
mkcert -install
Create an SSL certificate for laravel.web:
mkcert laravel.web
sudo mkdir /etc/apache2/ssl
sudo mv laravel.web*.pem /etc/apache2/ssl
virtualHOSTOPEN
sudo nano /etc/apache2/sites-available/laravel.web.conf

<VirtualHost *:80>
ServerName laravel.web
RewriteEngine on
RewriteCond %{SERVER_NAME} =laravel.web
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName laravel.web
DocumentRoot /home/user/public_html/blog/public
<Directory /home/user/public_html/blog/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/laravel.web_error.log
CustomLog /var/log/apache2/laravel.web_access.log combined

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/laravel.web.pem
SSLCertificateKeyFile /etc/apache2/ssl/laravel.web-key.pem
</VirtualHost>
</IfModule>

Activate Apache SSL module and restart the apache2 service:
sudo a2enmod ssl
sudo systemctl restart apache2
Browse https://laravel.web.
sudo apt install mariadb-server
sudo mysql_secure_installation

Enter current password for root (enter for none): ENTER
Set root password? [Y/n] y
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

sudo mysql -u root -p
CREATE DATABASE blog;
CREATE USER 'userblog'@'localhost' IDENTIFIED BY 'passblog';
GRANT ALL PRIVILEGES ON blog.* TO 'userblog'@'localhost';
FLUSH PRIVILEGES;
EXIT;

nano ~/public_html/blog/.env

DB_DATABASE=blog
DB_USERNAME=userblog
DB_PASSWORD=passblog

php artisan migrate
Install laravel/jetstream:
composer require laravel/jetstream
composer update
Install livewire:
php artisan jetstream:install livewire https://musaamin.web.id/how-to-install-laravel-8-on-ubuntu-2004/


https://musaamin.web.id/cara-install-php-dengan-apache-di-centos-8/

0.Install Apache
Install Apache terlebih dahulu.

dnf install httpd -y
systemctl enable --now httpd
systemctl status httpd

Ijinkan http di firewall.
firewall-cmd --add-service=http --permanent
firewall-cmd --reload
firewall-cmd --list-services

1.Install PHP

Versi PHP yang tersedia secara default di CentOS 8 adalah PHP versi 7.2.1.
dnf info php
dnf install php

Apache web server di CentOS 8 secara default memakai PHP-FPM, tidak memakai mod_php untuk menjalankan script PHP. Jadi, kita perlu menjalankan dan mengaktifkan php-fpm service.

systemctl enable php-fpm
systemctl start php-fpm
systemctl status php-fpm
php -v

PHP 7.2.11 (cli) (built: Oct 9 2018 15:09:36) ( NTS )

cd /var/www/html
echo "<?php phpinfo(); ?>" > info.php

Mencari Extension PHP
Jika membutuhkan extension atau module PHP yang lain, cari nama paketnya dengan perintah dnf.

dnf search php-

php-gd.x86_64 : A module for PHP applications for using the gd graphics library
php-cli.x86_64 : Command-line interface for PHP
php-fpm.x86_64 : PHP FastCGI Process Manager
php-cli.x86_64 : Command-line interface for PHP
https://www.youtube.com/watch?v=YGNeZV1raGQ&feature=emb_title

https://musaamin.web.id/cara-install-apache-di-centos-8/
https://musaamin.web.id/cara-install-apache-di-centos-8/

Perangkat yang Digunakan

Sebelum melangkah ke tutorial install Apache, berikut perangkat yang saya gunakan dalam tutorial ini:

VPS Vultr CentOS 8 dengan IP Public 139.180.143.87
Domain superuser.web.id
Domain wpdev.web.id

1.Install Apache
Install paket httpd dan aktifkan servicenya.

dnf install httpd -y
systemctl enable --now httpd
systemctl status httpd

2.FirewallD Service
Masukkan protokol http ke dalam FirewallD agar web server dapat diakses.

firewall-cmd --add-service=http --permanent
firewall-cmd --reload
firewall-cmd --list-services

3.Pengujian

Browsing IP CentOS server untuk melakukan pengujian Apache web server.

Hasilnya adalah 403 Forbidden. Apache web server sudah aktif, tetapi terjadi error karena belum ada file index di Document Root.

Buat file index.html di dalam direktori /var/www/html.

cd /var/www/html/
echo "<h1>hello world</h1>" > index.html

Menghubungkan Domain dengan VPS

Agar website yang ada di web server CentOS dapat diakses dengan nama domain, buat A record di DNS record dengan memasukkan domain dan IP Public dari VPS.

Banyak Domain dalam Satu Server (Virtual Host)

Apakah bisa dalam satu server bisa menjalankan banyak domain atau sub-domain? Jawabannya bisa.
Buat A record seperti langkah sebelumnya pada semua domain yang ingin dihosting di server yang sama.

Kalau langsung melakukan uji browsing ke domain, hasilnya akan menampilkan halaman yang sama.

Agar tiap domain menampilkan halaman website yang berbeda, konfigurasikan virtual host di Apache.
Buat direktori Document Root dan index.html untuk masing-masing domain.

cd /var/www
mkdir superuser.web.id wpdev.web.id
echo "<h1>superuser.web.id</h1>" > superuser.web.id/index.html
echo "<h1>wpdev.web.id</h1>" > wpdev.web.id/index.html

Buat file konfigurasi virtual host untuk superuser.web.id.

cd /etc/httpd/conf.d/
vi superuser.web.id.conf

<VirtualHost *:80>
ServerName www.superuser.web.id
ServerAlias superuser.web.id
DocumentRoot /var/www/superuser.web.id
<Directory /var/www/superuser.web.id>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/httpd/superuser.web.id_error.log
CustomLog /var/log/httpd/superuser.web.id_access.log combined
</VirtualHost>

Buat file konfigurasi virtual host untuk wpdev.web.id.

vi wpdev.web.id.conf

<VirtualHost *:80>
ServerName www.wpdev.web.id
ServerAlias wpdev.web.id
DocumentRoot /var/www/wpdev.web.id
<Directory /var/www/wpdev.web.id>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/httpd/wpdev.web.id_error.log
CustomLog /var/log/httpd/wpdev.web.id_access.log combined
</VirtualHost>

systemctl restart httpd
systemctl status httpd


https://musaamin.web.id/cara-setting-firewall-dengan-firewalld-di-centos-8/

https://musaamin.web.id/cara-setting-firewall-dengan-firewalld-di-centos-8/

FirewallD adalah perangkat lunak untuk mengelola firewall di Linux yang mendukung fitur zones (zona jaringan) untuk menentukan tingkat kepercayaan koneksi.

FirewallD sudah terinstall dan aktif secara default di CentOS 8. Hal tersebut dapat kita verifikasi dengan mengecek service dan statusnya.

systemctl status firewalld
firewall-cmd --state

Install FirewallD

Jika FirewallD belum terinstall jalankan perintah berikut.


dnf install firewalld
systemctl start firewalld
systemctl enable firewalld
systemctl status firewalld
firewall-cmd --state
FirewallD memiliki zones, secara sederhannya seperti profile konfigurasi yang sudah ditetapkan, masing-masing memiliki rule tersendiri. Zones ada yang sudah disediakan, tapi kita bisa juga membuat custom zones.

Menampilkan semua nama zones.
firewall-cmd --get-zones

block dmz drop external home internal public trusted work
Menampilkan semua zones dan konfigurasinya.
firewall-cmd --list-all-zones
firewall-cmd --list-all-zones

...
public (active)
target: default
icmp-block-inversion: no
interfaces: enp0s3 enp0s8
sources:
services: cockpit dhcpv6-client ssh
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
...
work
target: default
icmp-block-inversion: no
interfaces:
sources:
services: cockpit dhcpv6-client ssh
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules
Hasil perintah di atas terlihat bahwa public zone merupakan zone yang aktif digunakan.

Bisa juga dengan menggunakan parameter tersendiri untuk menampilkan active zone dan default zone.

firewall-cmd --get-active-zones

public
interfaces: enp0s3 enp0s8

firewall-cmd --get-default-zone

public

Menampilkan konfigurasi satu zone, misalnya public.

firewall-cmd --zone=public --list-all

public (active)
target: default
icmp-block-inversion: no
interfaces: enp0s3 enp0s8
sources:
services: cockpit dhcpv6-client ssh
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:

Mengijinkan Services

Konfigurasi public zone di atas hanya mengijinkan service yang terdaftar yaitu cockpit, dhcpv6-client, dan ssh. Jadi ketika ingin mengakses service lain misalnya http atau https tidak akan bisa.

Menambahkan service http ke public zone.


firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --reload
firewall-cmd --zone=public --list-all

public (active)
target: default
icmp-block-inversion: no
interfaces: enp0s3 enp0s8
sources:
services: cockpit dhcpv6-client http ssh
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:


Menampilkan nama service yang bisa dimasukkan ke dalam zone.

firewall-cmd --get-services

RH-Satellite-6 amanda-client amanda-k5-client amqp amqps apcupsd audit bacula bacula-client bgp bitcoin bitcoin-rpc bitcoin-testnet bitcoin-testnet-rpc ceph ceph-mon cfengine cockpit condor-collector ctdb dhcp dhcpv6 dhcpv6-client distcc dns docker-registry docker-swarm dropbox-lansync elasticsearch etcd-client etcd-server finger freeipa-ldap freeipa-ldaps freeipa-replication freeipa-trust ftp ganglia-client ganglia-master git gre high-availability http https imap imaps ipp ipp-client ipsec irc ircs iscsi-target isns jenkins kadmin kerberos kibana klogin kpasswd kprop kshell ldap ldaps libvirt libvirt-tls lightning-network llmnr managesieve matrix mdns minidlna mongodb mosh mountd mqtt mqtt-tls ms-wbt mssql murmur mysql nfs nfs3 nmea-0183 nrpe ntp nut openvpn ovirt-imageio ovirt-storageconsole ovirt-vmconsole plex pmcd pmproxy pmwebapi pmwebapis pop3 pop3s postgresql privoxy proxy-dhcp ptp pulseaudio puppetmaster quassel radius redis rpc-bind rsh rsyncd rtsp salt-master samba samba-client samba-dc sane sip sips slp smtp smtp-submission smtps snmp snmptrap spideroak-lansync squid ssh steam-streaming svdrp svn syncthing syncthing-gui synergy syslog syslog-tls telnet tftp tftp-client tinc tor-socks transmission-client upnp-client vdsm vnc-server wbem-http wbem-https wsman wsmans xdmcp xmpp-bosh xmpp-client xmpp-local xmpp-server zabbix-agent zabbix-server

Menghapus service dari zone gunakan remove.

firewall-cmd --zone=public --remove-service=http

Mengijinkan Nomor Port

Kalau service yang ingin kita masukkan tidak tersedia nama servicenya atau servicenya tidak menggunakan nomor default port, kita bisa mengijinkan akses ke service tersebut dengan memasukkan nomor portnya.

Misalnya kita ingin mengijinkan akses ke port nomor 5000 untuk protokol TCP dan UDP.

firewall-cmd --zone=public --add-port=5000/tcp --permanent
firewall-cmd --zone=public --add-port=5000/udp --permanent
firewall-cmd --reload
firewall-cmd --zone=public --list-all

public (active)
target: default
icmp-block-inversion: no
interfaces: enp0s3 enp0s8
sources:
services: cockpit dhcpv6-client http ssh
ports: 5000/tcp 5000/udp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:

firewall-cmd --zone=public --list-ports

5000/tcp 5000/udp

Menghapus port dari public zone.

firewall-cmd --zone=public --remove-port=5000/tcp --permanent
firewall-cmd --zone=public --remove-port=5000/udp --permanent
firewall-cmd --reload


https://musaamin.web.id/how-to-install-ckan-open-data-portal-ubuntu2004/
https://musaamin.web.id/how-to-install-ckan-open-data-portal-ubuntu2004/


https://musaamin.web.id/cara-install-laravel-8-ubuntu-2004/
https://musaamin.web.id/cara-install-laravel-8-ubuntu-2004/
https://musaamin.web.id/cara-install-laravel-8-ubuntu-2004/


Server requirements yang harus dipenuhi untuk menjalankan Laravel 8:

PHP >= 7.3
BCMath PHP Extension
Ctype PHP Extension
Fileinfo PHP extension
JSON PHP Extension
Mbstring PHP Extension
OpenSSL PHP Extension
PDO PHP Extension
Tokenizer PHP Extension
XML PHP Extension



Install Composer

Laravel menggunakan Composer untuk mengelola dependensinya. Jadi, sebelum install Laravel, install Composer terlebih dahulu.

Install Composer:

sudo apt install composer

Install PHP

Install PHP beserta extension yang dibutuhkan:

sudo apt install php php-common php-bcmath php-mbstring php-mysql php-tokenizer php-zip

Install Laravel 8.0 dengan menggunakan Composer dan tersimpan dalam folder /home/musaamin/public_html/blog:

kdir ~/public_html
cd ~/public_html
composer create-project laravel/laravel blog 8.0
Jika tidak menuliskan nomor versi yang terinstall adalah Laravel versi terbaru:
composer create-project laravel/laravel blog
Menjalankan Laravel dengan Development Server

Menjalankan Laravel dengan menggunakan development server:
cd blog
php artisan serve
Hasil perintah di atas menjalankan development server dengan IP address 127.0.0.1 (localhost IP) dan port 8000:

Starting Laravel development server: http://127.0.0.1:8000
[Thu Sep 10 23:32:56 2020] PHP 7.4.3 Development Server (http://127.0.0.1:8000) started

Browse http://127.0.0.1:8000 atau http://localhost:8000.

Menjalankan Laravel dengan Apache

Install Apache web server:
sudo apt install apache2 libapache2-mod-php
sudo apt install apache2 libapache2-mod-php

Restart apache2 service:
sudo systemctl restart apache2
sudo systemctl status apache2

URL address http://127.0.0.1:8000 bisa diubah menjadi hostname atau local domain dengan menggunakan Apache virtual host dan file /etc/hosts.

Membuat virtual host dengan nama laravel.web:

sudo nano /etc/apache2/sites-available/laravel.web.conf

Masukkan konfigurasi virtual host:

<VirtualHost *:80>
ServerName laravel.web
DocumentRoot /home/musaamin/public_html/blog/public
<Directory /home/musaamin/public_html/blog/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/laravel.web_error.log
CustomLog /var/log/apache2/laravel.web_access.log combined
</VirtualHost>

Aktifkan virtual host dan Apache rewrite module:

sudo a2ensite laravel.web.conf
sudo a2enmod rewrite
sudo systemctl restart apache2

Ubah ownership dan permission folder DocumentRoot:
sudo chown -R $USER:www-data /home/musaamin/public_html/blog
sudo chmod -R 775 /home/musaamin/public_html/blog

Buka file /etc/hosts:
sudo nano /etc/hosts
Masukkan local domain laravel.web:
127.0.0.1 laravel.web
Install SSL

Install sertifikat SSL untuk local server dengan menggunakan mkcert agar bisa menjalankan HTTPS protocol.

Install paket dependensi untuk Homebrew:

sudo apt install build-essential curl file git

Download dan jalankan installer Homebrew:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
Membuat homebrew tersedia di system environment:
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo eval" ($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
echo "eval $($(brew --prefix)/bin/brew shellenv)" >>~/.profile
Install paket dependensi untuk mkcert:
sudo apt install libnss3-tools
Install mkcert via brew:
brew install mkcert
Install Certificate Authority (CA):
mkcert -install
Membuat sertifikat SSL untuk laravel.web:
mkcert laravel.web
Membuat direktori ssl dan memindahkan SSL yang sudah dibuat ke dalamnya:
sudo mkdir /etc/apache2/ssl
sudo mv laravel.web*.pem /etc/apache2/ssl
Buka file konfigurasi laravel.web virtual host:
sudo nano /etc/apache2/sites-available/laravel.web.conf
Ubah konfigurasinya menjadi:

<VirtualHost *:80>
ServerName laravel.web
RewriteEngine on
RewriteCond %{SERVER_NAME} =laravel.web
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName laravel.web
DocumentRoot /home/musaamin/public_html/blog/public
<Directory /home/musaamin/public_html/blog/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/laravel.web_error.log
CustomLog /var/log/apache2/laravel.web_access.log combined

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/laravel.web.pem
SSLCertificateKeyFile /etc/apache2/ssl/laravel.web-key.pem
</VirtualHost>
</IfModule>

Aktifkan Apache SSL module dan restart apache2 service:

sudo a2enmod ssl
sudo systemctl restart apache2

sudo apt install mariadb-server
Jalankan mysql_secure_installation:

sudo mysql_secure_installation

Enter current password for root (enter for none): ENTER
Set root password? [Y/n] y
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

sudo mysql -u root -p

CREATE DATABASE blog;
CREATE USER 'userblog'@'localhost' IDENTIFIED BY 'passblog';
GRANT ALL PRIVILEGES ON blog.* TO 'userblog'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Buka file .env:

nano ~/public_html/blog/.env

Konfigurasi koneksi database:
DB_DATABASE=blog
DB_USERNAME=userblog
DB_PASSWORD=passblog

Membuat Fungsi Register dan Login
Jalankan migrate untuk membuat user table:

php artisan migrate
Memasang laravel/jetstream:
composer require laravel/jetstream
composer update
php artisan jetstream:install livewire
Fungsi register dan login sudah aktif.

https://musaamin.web.id/cara-install-ioncube-loader-di-centos-7/
https://musaamin.web.id/cara-install-ioncube-loader-di-centos-7/
https://musaamin.web.id/cara-install-ioncube-loader-di-centos-7/


Install PHP dan Apache
Install Apache web server dan PHP.

yum install httpd php php-cli

Aktifkan dan jalankan Apache web server.

systemctl enable httpd
systemctl start httpd
systemctl status httpd

Download ionCube Loader
Download ionCube Loader untuk arsitektur 64bit.

curl -O https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar xzvf ioncube_loaders_lin_x86-64.tar.gz
Cek versi PHP yang berjalan.

Cek isi folder ioncube apakah tersedia untuk PHP yang digunakan.


ls ioncube

ioncube_loader_lin_4.1.so ioncube_loader_lin_5.0.so ioncube_loader_lin_5.3.so ioncube_loader_lin_5.6.so ioncube_loader_lin_7.2.so README.txt
ioncube_loader_lin_4.2.so ioncube_loader_lin_5.0_ts.so ioncube_loader_lin_5.3_ts.so ioncube_loader_lin_5.6_ts.so ioncube_loader_lin_7.2_ts.so USER-GUIDE.pdf
ioncube_loader_lin_4.3.so ioncube_loader_lin_5.1.so ioncube_loader_lin_5.4.so ioncube_loader_lin_7.0.so ioncube_loader_lin_7.3.so USER-GUIDE.txt
ioncube_loader_lin_4.3_ts.so ioncube_loader_lin_5.1_ts.so ioncube_loader_lin_5.4_ts.so ioncube_loader_lin_7.0_ts.so ioncube_loader_lin_7.3_ts.so
ioncube_loader_lin_4.4.so ioncube_loader_lin_5.2.so ioncube_loader_lin_5.5.so ioncube_loader_lin_7.1.so LICENSE.txt
ioncube_loader_lin_4.4_ts.so ioncube_loader_lin_5.2_ts.so ioncube_loader_lin_5.5_ts.so ioncube_loader_lin_7.1_ts.so loader-wizard.php

Cek lokasi extension directory.
php -i | grep extension_dir

extension_dir => /usr/lib64/php/modules => /usr/lib64/php/modules
Copy ionCube Loader 5.4 ke extension directory.
cp ioncube/ioncube_loader_lin_5.4.so /usr/lib64/php/modules

Masukkan ionCube Loader ke dalam konfigurasi PHP.
vi /etc/php.ini
Masukkan opsi di bawah ini ke dalam file php.ini.
zend_extension = /usr/lib64/php/modules/ioncube_loader_lin_5.4.so
Restart Apache web server.
systemctl restart httpd
pengujian untuk mengetahui apakah ionCube Loader telah berjalan di PHP.
php -v

PHP 5.4.16 (cli) (built: Apr 1 2020 04:07:17)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
with the ionCube PHP Loader + ionCube24 v10.3.9, Copyright (c) 2002-2019, by ionCube Ltd.


https://musaamin.web.id/cara-install-php-dengan-apache-di-centos-8/
https://musaamin.web.id/cara-install-php-dengan-apache-di-centos-8/



Versi PHP yang tersedia secara default di CentOS 8 adalah PHP versi 7.2.1.
dnf install php
Apache web server di CentOS 8 secara default memakai PHP-FPM, tidak memakai mod_php untuk menjalankan script PHP. Jadi, kita perlu menjalankan dan mengaktifkan php-fpm service.


systemctl enable php-fpm
systemctl start php-fpm
systemctl status php-fpm
cd /var/www/html
echo "<?php phpinfo(); ?>" > info.php

Jika membutuhkan extension atau module PHP yang lain, cari nama paketnya dengan perintah dnf.

dnf search php-

php-gd.x86_64 : A module for PHP applications for using the gd graphics library
php-cli.x86_64 : Command-line interface for PHP
php-fpm.x86_64 : PHP FastCGI Process Manager
php-cli.x86_64 : Command-line interface for PHP
...

https://musaamin.web.id/cara-install-php-dengan-nginx-di-centos-8/
https://musaamin.web.id/cara-install-php-dengan-nginx-di-centos-8/
https://musaamin.web.id/cara-install-php-dengan-nginx-di-centos-8/
https://musaamin.web.id/cara-install-php-dengan-nginx-di-centos-8/


dnf install nginx
systemctl enable --now nginx
systemctl start nginx
systemctl status nginx

1.FirewallD Service
Masukkan service http ke dalam FirewallD agar web server dapat diakses.

firewall-cmd --add-service=http --permanent
firewall-cmd --reload
firewall-cmd --list-services

https://musaamin.web.id/cara-setting-firewall-dengan-firewalld-di-centos-8/

Install PHP
Versi PHP yang tersedia secara default di CentOS 8 adalah PHP versi 7.2.11.
Install paket PHP beserta extension yang sering digunakan.
dnf install php php-mysqlnd php-pdo php-gd php-mbstring
systemctl enable php-fpm
systemctl start php-fpm
systemctl status php-fpm

cd /usr/share/nginx/html
echo "<?php phpinfo(); ?>" > info.php
Lalu browsing http://ip-server/info.php.

Nginx + Server Block Nginx
Selanjutnya mencoba melakukan konfigurasi server block untuk domain superuser.web.id.
Buat Document Root terlebih dahulu dan file testing PHP.

mkdir /var/www/superuser.web.id
echo "<?php phpinfo(); ?>" > /var/www/superuser.web.id
vi /etc/nginx/conf.d/superuser.web.id.conf

server {
listen 80;

server_name superuser.web.id;
root /var/www/superuser.web.id;

index index.php index.html;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

location ~ \.php$ {
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_index index.php;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
}

access_log /var/log/nginx/superuser.web.id.access.log;
error_log /var/log/nginx/superuser.web.id.error.log warn;
}

systemctl restart nginx
systemctl status nginx

Mencari Extension PHP

Jika membutuhkan extension atau module PHP yang lain, cari nama paketnya dengan perintah dnf search.
dnf search php-

php-gd.x86_64 : A module for PHP applications for using the gd graphics library
php-cli.x86_64 : Command-line interface for PHP
php-fpm.x86_64 : PHP FastCGI Process Manager
php-cli.x86_64 : Command-line interface for PHP
--------------

Install Nginx langsung dari repository default CentOS 8.

ssystemctl enable --now nginx
systemctl start nginx
systemctl status nginx

firewall-cmd --add-service=http --permanent
firewall-cmd --reload
firewall-cmd --list-services


https://musaamin.web.id/cara-install-ioncube-loader-di-centos-7/
https://musaamin.web.id/cara-install-php-7-4-di-centos-8/
https://musaamin.web.id/cara-install-php-7-4-di-centos-8/
https://musaamin.web.id/cara-install-php-7-4-di-centos-8/

Install EPEL dan REMI Repository

Install terlebih dahulu EPEL dan REMI repository.

dnf install epel-release -y
dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm -y

Cek PHP yang tersedia di module.

dnf module list php


CentOS-8 - AppStream
Name Stream Profiles Summary
php 7.2 [d] common [d], devel, minimal PHP scripting language
php 7.3 common [d], devel, minimal PHP scripting language

Remi's Modular repository for Enterprise Linux 8 - x86_64
Name Stream Profiles Summary
php remi-7.2 common [d], devel, minimal PHP scripting language
php remi-7.3 common [d], devel, minimal PHP scripting language
php remi-7.4 common [d], devel, minimal PHP scripting language

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

Aktifkan PHP 7.4 Module Stream
dnf module enable php:remi-7.4

Dependencies resolved.
=======================================================================================================
Package Architecture Version Repository Size
=======================================================================================================
Enabling module streams:
php remi-7.4

Transaction Summary
=======================================================================================================

Is this ok [y/N]: y

Sekarang install PHP 7.4.

dnf install php php-cli php-common
Saat install PHP tadi juga terinstall Apache web server (HTTPD). Aktifkan dan jalankan servicenya.
systemctl enable httpd
systemctl start httpd
systemctl status httpd
Cek juga status php-fpm service, karena di CentOS 8 tidak lagi menggunakan Apache module. Install PHP tadi juga sudah menginstall PHP-FPM.

systemctl enable php-fpm
systemctl status php-fpm

Membuat file info.php untuk menguji Apache apakah sudah bisa menjalankan PHP script.

cd /var/www/html
echo "<?php phpinfo(); ?>" > info.php



https://musaamin.web.id/how-to-install-laravel-8-on-ubuntu-2004/
https://musaamin.web.id/how-to-install-laravel-8-on-ubuntu-2004/
https://musaamin.web.id/how-to-install-laravel-8-on-ubuntu-2004/


Server requirements that must be met to run Laravel 8:

PHP >= 7.3
BCMath PHP Extension
Ctype PHP Extension
Fileinfo PHP extension
JSON PHP Extension
Mbstring PHP Extension
OpenSSL PHP Extension
PDO PHP Extension
Tokenizer PHP Extension
XML PHP Extension

Laravel uses Composer to manage its dependencies. So, before installing Laravel, install Composer first.

Install Composer:
sudo apt install composer
sudo apt install php php-common php-bcmath php-mbstring php-mysql php-tokenizer php-zip

mkdir ~/public_html
cd ~/public_html
composer create-project laravel/laravel blog 8.0
composer create-project laravel/laravel blog
cd blog
php artisan serve
Starting Laravel development server: http://127.0.0.1:8000
[Thu Sep 10 23:32:56 2020] PHP 7.4.3 Development Server (http://127.0.0.1:8000) started
sudo apt install apache2 libapache2-mod-php
sudo systemctl restart apache2
sudo systemctl status apache2
URL address http://127.0.0.1:8000 can be changed to a hostname or local domain using Apache virtual host and the file /etc/hosts.

Create a virtual host with the name laravel.web:
sudo nano /etc/apache2/sites-available/laravel.web.conf
<VirtualHost *:80>
ServerName laravel.web
DocumentRoot /home/user/public_html/blog/public
<Directory /home/user/public_html/blog/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/laravel.web_error.log
CustomLog /var/log/apache2/laravel.web_access.log combined
</VirtualHost>
Enable virtual host and Apache rewrite module:

sudo a2ensite laravel.web.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
Change ownership and permissions for the DocumentRoot folder:
sudo chown -R $USER:www-data /home/user/public_html/blog
sudo chmod -R 775 /home/user/public_html/blog
Open the file /etc/hosts:
sudo nano /etc/hosts
127.0.0.1 laravel.web
Install the SSL certificate for the local server using mkcert to run the HTTPS protocol.
Install the dependency package for Homebrew:
sudo apt install build-essential curl file git
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
Test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo eval" ($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
echo "eval $($(brew --prefix)/bin/brew shellenv)" >>~/.profile
sudo apt install libnss3-tools
brew install mkcert
mkcert -install
mkcert laravel.web

sudo mkdir /etc/apache2/ssl
sudo mv laravel.web*.pem /etc/apache2/ssl
Open the laravel.web virtual host configuration file:
sudo nano /etc/apache2/sites-available/laravel.web.conf

<VirtualHost *:80>
ServerName laravel.web
RewriteEngine on
RewriteCond %{SERVER_NAME} =laravel.web
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName laravel.web
DocumentRoot /home/user/public_html/blog/public
<Directory /home/user/public_html/blog/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/laravel.web_error.log
CustomLog /var/log/apache2/laravel.web_access.log combined

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/laravel.web.pem
SSLCertificateKeyFile /etc/apache2/ssl/laravel.web-key.pem
</VirtualHost>
</IfModule>

sudo a2enmod ssl
sudo systemctl restart apache2

sudo apt install mariadb-server
sudo mysql_secure_installation

Enter current password for root (enter for none): ENTER
Set root password? [Y/n] y
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

sudo mysql -u root -p

CREATE DATABASE blog;
CREATE USER 'userblog'@'localhost' IDENTIFIED BY 'passblog';
GRANT ALL PRIVILEGES ON blog.* TO 'userblog'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Open the .env file:

nano ~/public_html/blog/.env
DB_DATABASE=blog
DB_USERNAME=userblog
DB_PASSWORD=passblog
Run migrate to create a user table:
php artisan migrate
composer require laravel/jetstream
composer update
php artisan jetstream:install livewire




https://tecadmin.net/install-laravel-framework-on-centos/
https://tecadmin.net/install-laravel-framework-on-centos/

Setup Yum Repositories

First of all, you need to add REMI and EPEL rpm repositories in your system. these repositories have updated packages. Use one of the below commands as per your OS version and system architecture.

CentOS/RHEL 7:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-12.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

CentOS/RHEL 6:

rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Install Apache, MySQL and PHP

Here is short instruction for the installation of LAMP stack. Its required to run the Laravel framework on your CentOS system. Use this guide for the detailed LAMP setup on CentOS

Install Apache

yum --enablerepo=remi,epel install httpd

yum --enablerepo=remi,epel install mysql-server
service mysqld start
/usr/bin/mysql_secure_installation

yum --enablerepo=remi,epel install php php-zip php-mysql php-mcrypt php-xml php-mbstring
service httpd restart

Install Composer

Composer is required for installing Laravel dependencies. So use below commands to download and use as a command in our system.

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/bin/composer
chmod +x /usr/bin/composer

Install Laravel

To download latest version of Laravel, Use below command to clone master repo of laravel from github.

cd /var/www
git clone https://github.com/laravel/laravel.git

Navigate to the Laravel code directory and use the composer to install all dependencies required for the Laravel framework.

cd /var/www/laravel
composer install


Dependency installation will take some time. After than set proper permissions on files.

chown -R apache.apache /var/www/laravel
chmod -R 755 /var/www/laravel
chmod -R 755 /var/www/laravel/storage

SELinux enabled systems also run the below command to allow write on storage directory.
chcon -R -t httpd_sys_rw_content_t /var/www/laravel/storage

Set Encryption Key

Laravel uses .evn file for environment configuration. Use .evn file for configuring all the environment variables for your application like the database, SMTP, security key, etc.

cp .env.example .env

Now set the 32 bit long random number encryption key, which used by the Illuminate encrypter service.

php artisan key:generate

Application key set successfully.
You can view the .env file to find the Application key is configured.

Create Apache Virtual Host

Now add a Virtual Host in your Apache configuration file to access Laravel framework from web browser. To do it edit Apache configuration file /etc/httpd/conf/httpd.conf and add below code at end of file

vim /etc/httpd/conf/httpd.conf

<VirtualHost *:80>
ServerName laravel.example.com
DocumentRoot /var/www/laravel/public

<Directory /var/www/laravel>
AllowOverride All
</Directory>
</VirtualHost>

Restart Apache service and access the Laravel framework using your favorite web browser and start developing a great web application.

service httpd restart

https://tecadmin.net/install-lamp-apache-mysql-and-php-on-centos-rhel-7/
https://tecadmin.net/install-lamp-apache-mysql-and-php-on-centos-rhel-7/
https://tecadmin.net/install-lamp-apache-mysql-and-php-on-centos-rhel-7/


LAMP stands for Linux, Apache, MySQL and PHP. Its is used for hosting websites written with PHP programming language and using MySQL as backend database server. This article will help you to install Apache 2.4, MySQL 8 and PHP 7.3 on CentOS 7 and RedHat 7 systems. You may also use video tutorial on Youtube for installation instruction’s.

Prerequsitis

The two most popular rpm repositories REMI and EPEL have most of the updated packages. They are also providing the latest packages for LAMP setup. Enable both repositories on your system using the following commands on your CentOS 7 system.

rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm


Install Apache Server

Apache or HTTP is the most popular web server used on Linux based systems. Let’s install Apache web server using the following command by enabling EPEL and REMI yum repositories.

yum --enablerepo=epel,remi install httpd
Now start httpd service and enable to start on boot using commands.
systemctl enable httpd.service
systemctl start httpd.service

Install MySQL Server

First, add MySQL yum repository in your system using the following command. You may also visit repo.mysql.com to find repository rpms for other operating systems. The below command will work with CentOS and RedHat 7.

rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm

The default MySQL 8 repository is enabled for installation. To change edit repository configuration file (/etc/yum.repos.d/mysql-community.repo) and enable/disable repositories as per requirements.

Then install the MySQL server and other dependency packages.

yum install mysql-server

After installation enable MySQL service and start it.

systemctl enable mysqld.service
systemctl start mysqld.service

The installer generated a temporary password for MySQL root user and copied to log file. You can find this password using the below command.

grep "A temporary password" /var/log/mysqld.log | tail -n1

[Some text hidden] A temporary password is generated for root@localhost: Eif;=YpBy2h#

Apply security on newly installed MySQL server. This will also prompt you to change the temporary password with a new password.

mysql_secure_installation

Enter password for user root: [Enter password here found in log file]
The existing password for the user account root has expired. Please set a new password.
New password: [Enter new password]
Re-enter new password: [Re-enter new password]

Change the password for root? - n
Remove anonymous users? - y
Disallow root login remotely? - y
Remove test database and access to it? - y
Reload privilege tables now? - y

MySQL has been installed on your system. After this install PHP.

Install PHP

Now, install PHP packages with enabling EPEL and REMI repositories using the following command.

yum --enablerepo=epel,remi-php74 install php
yum --enablerepo=remi-php74 list php-*
yum --enablerepo=remi-php74 install php-mysql php-xml php-xmlrpc php-soap php-gd
After installing php and other php modules restart Apache service.
systemctl restart httpd.service
Allow Port in Firewall
Finally open firewall ports for HTTP (80) and HTTPS (443) services using the following command.
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
php -v
httpd -v
mysql -v

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-centos-8
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-centos-8

dnf module list postgresql
Output
postgresql 9.6 client, server [d] PostgreSQL server and client module
postgresql 10 [d] client, server [d] PostgreSQL server and client module
postgresql 12 client, server

To enable the module stream for Postgres version 12, run the following command:

sudo dnf module enable postgresql:12

When prompted, press y and then ENTER to confirm that you want to enable the stream:

Output
====================================================================
Package Architecture Version Repository Size
====================================================================
Enabling module streams:
postgresql 12

Transaction Summary
====================================================================

Is this ok [y/N]: y

After enabling the version 12 module stream, you can install the postgresql-server package to install PostgreSQL 12 and all of its dependencies:

sudo dnf install postgresql-server

When given the prompt, confirm the installation by pressing y then ENTER:

Output
. . .
Install 4 Packages

Total download size: 16 M
Installed size: 62 M
Is this ok [y/N]: y

Now that the software is installed, you will perform some initialization steps to prepare a new database cluster for PostgreSQL.

Creating a New PostgreSQL Database Cluster

You have to create a new PostgreSQL database cluster before you can start creating tables and loading them with data. A database cluster is a collection of databases that are managed by a single server instance. Creating a database cluster consists of creating the directories in which the database data will be placed, generating the shared catalog tables, and creating the template1 and postgres databases.

The template1 database is a template of sorts used to create new databases; everything that is stored in template1, even objects you add yourself, will be placed in new databases when they’re created. The postgres database is a default database designed for use by users, utilities, and third-party applications.

The Postgres package we installed in the previous step comes with a handy script called postgresql-setup which helps with low-level database cluster administration. To create a database cluster, run the script using sudo and with the --initdb option:

sudo postgresql-setup --initdb

You will see the following output:
Output
* Initializing database in '/var/lib/pgsql/data'
* Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log

Now start the PostgreSQL service using systemctl:

sudo systemctl start postgresql

Then, use systemctl once more to enable the service to start up wh
Safefileku