alpha

Mike Tango Bravo · Updated 2022-02-05

Migrating from magnolia to wordpress was unfortunately necessary because of a lack of support and expertise for magnolia, and the version of magnolia installed for OpenVino is EOL.

This section describes the steps involved in installing wordpress.

Backup!

Even though we are not going to erase magnolia (yet), first check to make sure that an up-to-date backup of alpha exists:

[root@foxtrot alpha]# date
Wed Apr 21 15:22:50 -03 2021
[root@foxtrot alpha]# pwd
/ov_data/backups/alpha
[root@foxtrot alpha]# ls -lat var/log/messages
-rw------- 1 root root 6803187 Apr 20 23:36 var/log/messages

Make sure that the rsync backup script is not currently running on alpha:

[mbarrow@alpha ~]$ ps -ef | grep rsync
mbarrow  13751 13678  0 20:23 pts/0    00:00:00 grep --color=auto rsync

Check for the last monthly archive:

[root@foxtrot alpha]# ls -l /ov_data/backups/monthly/
total 437978608
-rw-r--r-- 1 root root  5863489557 Apr  1 02:20 alpha.Apr.tar.bz2.cpt
-rw-r--r-- 1 root root  3081689040 Aug 11  2020 alpha.Aug.tar.bz2.cpt
-rw-r--r-- 1 root root  5858589854 Dec  1 02:25 alpha.Dec.tar.bz2.cpt
-rw-r--r-- 1 root root  5863683890 Feb  1 02:24 alpha.Feb.tar.bz2.cpt
-rw-r--r-- 1 root root  5922971391 Jan  1 02:02 alpha.Jan.tar.bz2.cpt
-rw-r--r-- 1 root root  5866212383 Mar  1 01:59 alpha.Mar.tar.bz2.cpt
-rw-r--r-- 1 root root  5856488010 Nov  1 01:59 alpha.Nov.tar.bz2.cpt
-rw-r--r-- 1 root root  3081874851 Oct  1  2020 alpha.Oct.tar.bz2.cpt
-rw-r--r-- 1 root root  3081559094 Sep  1  2020 alpha.Sep.tar.bz2.cpt

About Wordpress

WordPress is an open source website creation tool or content management system (CMS) based on PHP and MySQL. Matt Mullenweg and Mike Little programmed WordPress back on 2003. This is the most easiest static (can be developed for dynamic also) website content management system (or CMS) that exists.

WordPress is a free and license under GPLv2 (or later) from the Free Software Foundation. According to a survey report, WordPress was used by more than 23.3% of the top 10 million websites. WordPress is one of the most popular blogging system used on the Web.

To know more about WordPress, visit this link. To download latest WordPress from here.

Prerequisites

To install WordPress on our CentOS 7 server.

  • Apache as web server
  • PHP version 5.6 or greater
  • MySQL / MariaDB version 5.6 or greater as database

Also, make sure your firewall / iptables or SELinux is not blocking any port(s) which is required over here or you don’t have any problem with proper user permission.

To disable SELinux, type the following

setenforce 0

First update the CentOS 7 server first:

[root@delta]# sudo yum clean all

[root@delta ~]# yum -y update

Test Apache

To test apache:

[root@delta ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/httpd.service.d
           └─limits.conf
   Active: active (running) since Wed 2021-04-21 23:26:41 CEST; 1min 51s ago
     Docs: man:httpd(8)
           man:apachectl(8)
 Main PID: 972 (httpd)
   Status: "Total requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec"
   CGroup: /system.slice/httpd.service
           ├─ 972 /usr/sbin/httpd -DFOREGROUND
           ├─1775 /usr/sbin/httpd -DFOREGROUND
           ├─1776 /usr/sbin/httpd -DFOREGROUND
           ├─1777 /usr/sbin/httpd -DFOREGROUND
           ├─1778 /usr/sbin/httpd -DFOREGROUND
           └─1779 /usr/sbin/httpd -DFOREGROUND

Apr 21 23:26:39 delta systemd[1]: Starting The Apache HTTP Server...
Apr 21 23:26:40 delta httpd[972]: AH00112: Warning: DocumentRoot [/var/www/html/magento/] does not exist
Apr 21 23:26:41 delta systemd[1]: Started The Apache HTTP Server.

Installing PHP

To install PHP, open a terminal and issue the below command.

sudo yum -y install php php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl

This will download and install PHP along with some others PHP modules which are required for WordPress.

Installing phpMyAdmin

To install phpMyAdmin:

sudo yum -y install phpmyadmin

After installing PHP, we need to restart the Apache or other web server in order to work with PHP. Type the following to do so.

sudo systemctl restart httpd.service

To test whether you can access phpMyAdmin or not, open any web browser and type the following in the address bar.

localhost/phpmyadmin

You will see something like this.

Install Apache server.

First, clean-up yum:

[root@alpha ~]# yum clean all
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Cleaning repos: base extras updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors

Update our packages:

[root@alpha ~]# yum -y update
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/4): base/7/x86_64/group_gz | 156 kB 00:00:00
(2/4): extras/7/x86_64/primary_db | 166 kB 00:00:00
(3/4): updates/7/x86_64/primary_db | 6.0 MB 00:00:00
(4/4): base/7/x86_64/primary_db | 5.7 MB 00:00:00
Determining fastest mirrors
 * base: mirror.airenetworks.es
 * extras: mirror.airenetworks.es
 * updates: mirror.airenetworks.es
No packages marked for update

Install Apache:

[root@alpha ~]# yum -y install httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.airenetworks.es
 * extras: mirror.airenetworks.es
 * updates: mirror.airenetworks.es
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-67.el7.centos.6 will be installed
--> Processing Dependency: httpd-tools = 2.4.6-67.el7.centos.6 for package: httpd-2.4.6-67.el7.centos.6.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-67.el7.centos.6.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-67.el7.centos.6.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-67.el7.centos.6.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-3.el7_4.1 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
---> Package httpd-tools.x86_64 0:2.4.6-67.el7.centos.6 will be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================
 Package Arch Version Repository Size
===============================================================================================================================
Installing:
 httpd x86_64 2.4.6-67.el7.centos.6 updates 2.7 M
Installing for dependencies:
 apr x86_64 1.4.8-3.el7_4.1 updates 103 k
 apr-util x86_64 1.5.2-6.el7 base 92 k
 httpd-tools x86_64 2.4.6-67.el7.centos.6 updates 88 k
 mailcap noarch 2.1.41-2.el7 base 31 k
Transaction Summary
===============================================================================================================================
Install 1 Package (+4 Dependent packages)
Total download size: 3.0 M
Installed size: 10 M
Downloading packages:
(1/5): apr-1.4.8-3.el7_4.1.x86_64.rpm | 103 kB 00:00:00
(2/5): apr-util-1.5.2-6.el7.x86_64.rpm | 92 kB 00:00:00
(3/5): httpd-tools-2.4.6-67.el7.centos.6.x86_64.rpm | 88 kB 00:00:00
(4/5): httpd-2.4.6-67.el7.centos.6.x86_64.rpm | 2.7 MB 00:00:00
(5/5): mailcap-2.1.41-2.el7.noarch.rpm | 31 kB 00:00:00
-------------------------------------------------------------------------------------------------------------------------------
Total 16 MB/s | 3.0 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
 Installing : apr-1.4.8-3.el7_4.1.x86_64 1/5
 Installing : apr-util-1.5.2-6.el7.x86_64 2/5
 Installing : httpd-tools-2.4.6-67.el7.centos.6.x86_64 3/5
 Installing : mailcap-2.1.41-2.el7.noarch 4/5
 Installing : httpd-2.4.6-67.el7.centos.6.x86_64 5/5
 Verifying : mailcap-2.1.41-2.el7.noarch 1/5
 Verifying : httpd-2.4.6-67.el7.centos.6.x86_64 2/5
 Verifying : apr-util-1.5.2-6.el7.x86_64 3/5
 Verifying : apr-1.4.8-3.el7_4.1.x86_64 4/5
 Verifying : httpd-tools-2.4.6-67.el7.centos.6.x86_64 5/5
Installed:
 httpd.x86_64 0:2.4.6-67.el7.centos.6
Dependency Installed:
 apr.x86_64 0:1.4.8-3.el7_4.1 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-67.el7.centos.6
 mailcap.noarch 0:2.1.41-2.el7
Complete!
[root@alpha ~]#

Add to start:

[root@alpha ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@alpha ~]#

Create mtb18.costaflores.com folder:

[root@alpha ~]# cd /var/www/html/
[root@alpha html]# mkdir mtb18
[root@alpha html]# chown apache:apache mtb18/ -R
[root@alpha html]#

Create VirtualHost file in Apache config:

[root@alpha ~]# cd /etc/httpd/conf.d/
[root@alpha conf.d]# vi website.mtb18.costaflores.com.conf
[root@alpha conf.d]#

<VirtualHost *:80>
 ServerName mtb18.costaflores.com
 DocumentRoot /var/www/html/mtb18/
 CustomLog logs/mtb18.costaflores.com.log combined
 ErrorLog logs/mtb18.costaflores.com.error.log
</VirtualHost>

Restart Apache server: (Apache start/stop/status/restart)

systemctl start httpd
systemctl stop httpd
systemctl status httpd
systemctl restart httpd

Firewall Add ports:

[root@alpha ~]# firewall-cmd --permanent --add-port="80"/tcp
success
[root@alpha ~]# firewall-cmd --permanent --add-port="443"/tcp
success

Reload firewall rules:

[root@alpha ~]# firewall-cmd --reload
success

List rules:

[root@alpha ~]# su -c 'firewall-cmd --zone=public --list-all'
public (active)
 target: default
 icmp-block-inversion: no
 interfaces: eth0
 sources:
 services: dhcpv6-client ssh
 ports: 80/tcp 443/tcp
 protocols:
 masquerade: no
 forward-ports:
 source-ports:
 icmp-blocks:
 rich rules:
[root@alpha ~]

Check Apache is listen in port 80:

[root@alpha ~]# netstat -anp |grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 22208/httpd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 10680/sshd
tcp6 0 0 :::22 :::* LISTEN 10680/sshd
unix 2 [ ] DGRAM 8480 1/systemd /run/systemd/notify
unix 3 [ ] STREAM CONNECTED 34245 10680/sshd
unix 3 [ ] STREAM CONNECTED 18000 484/systemd-journal /run/systemd/journal/stdout
[root@alpha ~]#

Install nmap:

[root@alpha httpd]# yum install nmap
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
Loading mirror speeds from cached hostfile
 * base: mirror.airenetworks.es
 * extras: mirror.airenetworks.es
 * updates: mirror.airenetworks.es
Resolving Dependencies
--> Running transaction check
---> Package nmap.x86_64 2:6.40-7.el7 will be installed
--> Processing Dependency: nmap-ncat = 2:6.40-7.el7 for package: 2:nmap-6.40-7.el7.x86_64
--> Running transaction check
---> Package nmap-ncat.x86_64 2:6.40-7.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===================================================================================================================================================================
 Package Arch Version Repository Size
===================================================================================================================================================================
Installing:
 nmap x86_64 2:6.40-7.el7 base 4.0 M
Installing for dependencies:
 nmap-ncat x86_64 2:6.40-7.el7 base 201 k
Transaction Summary
===================================================================================================================================================================
Install 1 Package (+1 Dependent package)
Total download size: 4.2 M
Installed size: 17 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): nmap-ncat-6.40-7.el7.x86_64.rpm | 201 kB 00:00:00
(2/2): nmap-6.40-7.el7.x86_64.rpm | 4.0 MB 00:00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 17 MB/s | 4.2 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
 Installing : 2:nmap-ncat-6.40-7.el7.x86_64 1/2
 Installing : 2:nmap-6.40-7.el7.x86_64 2/2
 Verifying : 2:nmap-ncat-6.40-7.el7.x86_64 1/2
 Verifying : 2:nmap-6.40-7.el7.x86_64 2/2
Installed:
 nmap.x86_64 2:6.40-7.el7
Dependency Installed:
 nmap-ncat.x86_64 2:6.40-7.el7
Complete!
[root@alpha httpd]#

Check what ports are listening for TCP connections from the network:

[root@alpha httpd]# nmap -sT -O localhost
Starting Nmap 6.40 ( http://nmap.org ) at 2018-02-27 16:13 CET
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00068s latency).
Other addresses for localhost (not scanned): 127.0.0.1
Not shown: 998 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
Device type: general purpose
Running: Linux 3.X
OS CPE: cpe:/o:linux:linux_kernel:3
OS details: Linux 3.7 - 3.9
Network Distance: 0 hops
OS detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 1.86 seconds
[root@alpha httpd]#

Install "mod_ssl" module:

[root@alpha]# yum install mod_ssl
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/2): extras/7/x86_64/primary_db | 185 kB 00:00:00
(2/2): updates/7/x86_64/primary_db | 6.9 MB 00:00:00
Determining fastest mirrors
 * base: mirror.airenetworks.es
 * extras: mirror.airenetworks.es
 * updates: mirror.airenetworks.es
Resolving Dependencies
--> Running transaction check
---> Package mod_ssl.x86_64 1:2.4.6-67.el7.centos.6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================================================================================================
 Package Arch Version Repository Size
=======================================================================================================================================================================
Installing:
 mod_ssl x86_64 1:2.4.6-67.el7.centos.6 updates 109 k
Transaction Summary
=======================================================================================================================================================================
Install 1 Package
Total download size: 109 k
Installed size: 224 k
Is this ok [y/d/N]: y
Downloading packages:
mod_ssl-2.4.6-67.el7.centos.6.x86_64.rpm | 109 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
 Installing : 1:mod_ssl-2.4.6-67.el7.centos.6.x86_64 1/1
 Verifying : 1:mod_ssl-2.4.6-67.el7.centos.6.x86_64 1/1
Installed:
 mod_ssl.x86_64 1:2.4.6-67.el7.centos.6
Complete!
[root@alpha]#

Install Let's Encrypt Certificates:

[root@alpha ~]# yum -y install epel-release
[root@alpha ~]# yum -y install yum-utils
[root@alpha ~]# yum -y install certbot-apache
[root@alpha ~]# sudo certbot --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
Which names would you like to activate HTTPS for?
-------------------------------------------------------------------------------
1: costaflores.com
2: ico.costaflores.com
3: mtb18.costaflores.com
4: openbravo.costaflores.com
5: openvino.costaflores.com
6: www.costaflores.com
7: martianwinefederation.org
8: www.martianwinefederation.org
9: openvino.org
10: www.openvino.org
11: theluckhunters.com
12: www.theluckhunters.com
-------------------------------------------------------------------------------
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 11
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for theluckhunters.com
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/httpd/conf.d/website.theluckhunters.com-le-ssl.conf
Deploying Certificate to VirtualHost /etc/httpd/conf.d/website.theluckhunters.com-le-ssl.conf
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
-------------------------------------------------------------------------------
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Redirecting vhost in /etc/httpd/conf.d/website.theluckhunters.com.conf to ssl vhost in /etc/httpd/conf.d/website.theluckhunters.com-le-ssl.conf
-------------------------------------------------------------------------------
Congratulations! You have successfully enabled https://theluckhunters.com
You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=theluckhunters.com
-------------------------------------------------------------------------------
IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
 /etc/letsencrypt/live/theluckhunters.com/fullchain.pem
 Your key file has been saved at:
 /etc/letsencrypt/live/theluckhunters.com/privkey.pem
 Your cert will expire on 2018-10-03. To obtain a new or tweaked
 version of this certificate in the future, simply run certbot again
 with the "certonly" option. To non-interactively renew *all* of
 your certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
 Donating to EFF: https://eff.org/donate-le
[root@alpha ~]#

Uninstall Let's Encrypt Certificates:

[root@alpha ~]# certbot delete --cert-name theluckhunters.com

Install HAPROXY

[root@alpha ~]# yum -y install haproxy
Installed:
 haproxy.x86_64 0:1.5.18-8.el7
Complete!
[root@alpha ~]#
[root@alpha ~]# cd /etc/haproxy/
[root@alpha haproxy]# mv haproxy.cfg haproxy.cfg.orig
[root@alpha haproxy]#