How to Migrate Wordpress Website from 32-bit CentOS Linux 6.3 to 64-bit CentOS Linux 8.2 (2004)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

How to Migrate Wordpress Website from 32-bit CentOS Linux 6.3 to 64-bit CentOS Linux 8.2 (2004)

Turritopsis Dohrnii Teo En Ming-3
Subject: How to Migrate Wordpress Website from 32-bit CentOS Linux 6.3 to 64-bit CentOS Linux 8.2 (2004)

Author of this Guide: Mr. Turritopsis Dohrnii Teo En Ming (TARGETED INDIVIDUAL)

Country: Singapore

Date: 31 August 2020 Monday Singapore Time

Type of Publication: Plain Text

Document Version: 20200831.01

SECTION 1 Information Gathering Stage

Host operating system is Windows Server 2008 R2 Standard

Host Processor: Intel Xeon CPU E5620 @ 2.40 GHz

Host Memory: 24 GB RAM

Old Oracle VirtualBox version is 4.1.18


Old CentOS Linux VM is version 6.3 (32-bit only)

Old Apache web server version 2.2.15

Old MySQL database server version 5.1.61

Old PHP version 5.6.40

Interface eth0: AAA.BBB.CCC.3/24 (ifconfig)
Gateway: AAA.BBB.CCC.2 (ip route) (Gateway is the next hop router which is also the Fortigate firewall)
/etc/resolv.conf (for DNS Client):
nameserver AAA.BBB.CCC.1 (This is the Windows Server with DNS Server role installed)

How to login to OLD MySQL database server:

mysql -u root -p

Old hostname:

Old Virtual Machine Settings

4 GB RAM, 2 processors, 20 GB storage, network adapter: bridged to broadcom bcm5709c

NEW Virtual Machine Settings
4 GB RAM, 4 processors, 100 GB storage, network adapter: bridged to broadcom bcm5709c
After using Advanced IP scanner and checking DHCP scope in Microsoft DHCP server in Windows Server,
Unused IP address: AAA.BBB.CCC.4 (Use this IP address for new CentOS 8.2 Linux VM)

SECTION 2 Installation of NEW CentOS 8.2 Linux Virtual Machine

New Hostname:

Subnet mask: (Class C)
Gateway: AAA.BBB.CCC.2


CentOS 8.2 Linux 64-bit will not start and run because VirtualBox is too old (version 4.1.18). Intel Virtualization and VT-d already enabled in server BIOS previously.
So running 64-bit virtual machines is not an issue.


After upgrading to VirtualBox 6.1.12, CentOS 8.2 Linux 64-bit is able to start and run.

SECTION 3 Generate a Backup of ALL Databases in the Old VM

Reference Guide: How to backup and restore MySQL databases using the mysqldump command


Reference Guide: How to Show Users in MySQL using Linux


# cd /root

# mysqldump -u root -p --all-databases > all-databases-20200829.sql

# du -h all-databases-20200829.sql

70M all-databases-20200829.sql

SECTION 4 Disable SELinux (Security Enhanced Linux)

You MUST disable SELinux, otherwise Apache web server will not work.

If you DO NOT want to disable SELinux, you must be an expert in SELinux to configure SELinux.

# nano /etc/selinux/config


# reboot

SECTION 5 Disable firewalld Software Firewall

Because already protected by Fortigate firewall at the perimeter.

# systemctl disable firewalld

# reboot

SECTION 6 LAMP (Linux, Apache, MySQL and PHP) Installation

I will be installing Apache web server 2.4.37-21, MariaDB server 3:10.3.17-1, PHP 7.2.24-1 and OpenSSL 1:1.1.1c-15 in 64-bit CentOS Linux 8.2 (2004).

Sub-Section on Installing Apache Web Server

# dnf install php php-fpm php-gd

You *MUST* install php-gd, otherwise Apache Web Server cannot execute PHP scripts.

# dnf install httpd

# systemctl enable httpd

# systemctl start httpd

[root@centos82 ~]# ps -ef | grep httpd
root       33214       1  0 22:03 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache     33351   33214  0 22:03 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache     33352   33214  1 22:03 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache     33355   33214  1 22:03 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache     33357   33214  0 22:03 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
root       36374    7368  0 22:03 pts/0    00:00:00 grep --color=auto httpd

On the OLD CentOS 6.3 server:

# cd /etc/httpd

# tar cfvz apacheconf.tar.gz conf conf.d

# mv apacheconf.tar.gz /root

On the NEW CentOS 8.2 server:

# cd /etc/httpd

# cp -r conf conf.original

# cp -r conf.d conf.d.original

# scp [hidden email].3:/root/apacheconf.tar.gz .

# tar xfvz apacheconf.tar.gz

On the OLD CentOS 6.3 server:

# cd /var/www/html

# tar cfvz websites.tar.gz *

(1.4 GB)

On the NEW CentOS 8.2 server:

# cd /var/www/html

# scp [hidden email].3:/root/websites.tar.gz .

# tar xfvz websites.tar.gz

Continuing on the NEW CentOS 8.2 server

How to troubleshoot Apache web server

The following are TWO very important Linux troubleshooting commands.

# systemctl status httpd (check the error Apache web server gives out)

# httpd -t (for checking Apache web server configuration syntax)

Make the following changes to /etc/httpd/conf/httpd.conf, as follows:

Rationale for unloading modules here: The modules were already loaded in config files in another location /etc/httpd/conf.modules.d, so we disable in httpd.conf to avoid duplication.
If there are duplication for loading modules, Apache web server cannot start.

# Dynamic Shared Object (DSO) Support
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
# Example:
# LoadModule foo_module modules/
#LoadModule auth_basic_module modules/
#LoadModule auth_digest_module modules/
#LoadModule authn_file_module modules/
#LoadModule authn_alias_module modules/
#LoadModule authn_anon_module modules/
#LoadModule authn_dbm_module modules/
#LoadModule authn_default_module modules/
#LoadModule authz_host_module modules/
#LoadModule authz_user_module modules/
#LoadModule authz_owner_module modules/
#LoadModule authz_groupfile_module modules/
#LoadModule authz_dbm_module modules/
#LoadModule authz_default_module modules/
#LoadModule ldap_module modules/
#LoadModule authnz_ldap_module modules/
#LoadModule include_module modules/
#LoadModule log_config_module modules/
#LoadModule logio_module modules/
#LoadModule env_module modules/
#LoadModule ext_filter_module modules/
#LoadModule mime_magic_module modules/
#LoadModule expires_module modules/
#LoadModule deflate_module modules/
#LoadModule headers_module modules/
LoadModule usertrack_module modules/
#LoadModule setenvif_module modules/
#LoadModule mime_module modules/
#LoadModule dav_module modules/
#LoadModule status_module modules/
#LoadModule autoindex_module modules/
#LoadModule info_module modules/
#LoadModule dav_fs_module modules/
#LoadModule vhost_alias_module modules/
#LoadModule negotiation_module modules/
#LoadModule dir_module modules/
#LoadModule actions_module modules/
LoadModule speling_module modules/
#LoadModule userdir_module modules/
#LoadModule alias_module modules/
#LoadModule substitute_module modules/
#LoadModule rewrite_module modules/
#LoadModule proxy_module modules/
#LoadModule proxy_balancer_module modules/
#LoadModule proxy_ftp_module modules/
#LoadModule proxy_http_module modules/
#LoadModule proxy_ajp_module modules/
#LoadModule proxy_connect_module modules/
#LoadModule cache_module modules/
#LoadModule suexec_module modules/
#LoadModule disk_cache_module modules/
LoadModule cgi_module modules/
#LoadModule version_module modules/

IncludeOptional conf.d/*.conf (Notice the use of OPTIONAL)
Include conf.modules.d/*.conf (DEFAULT CONFIG FILES INSTALLED BY APACHE WEB SERVER 2.4.37)

Install the Secure Sockets Layer (SSL) module for Apache web server

# dnf install mod_ssl

Make the following changes to /etc/httpd/conf.d/ssl.conf, as follows:

#SSLMutex default (MUST be disabled)

Transferring Public Key from OLD server to NEW server:

# cd /etc/pki/tls/certs

# scp [hidden email].3:/root/teo-en-ming-corp.crt .

Transferring Private Key from OLD server to NEW server:

# cd /etc/pki/tls/private/

# scp [hidden email].3:/root/teo-en-ming-corp.key .

Install Python3 module for Apache web server:

# dnf install python3-mod_wsgi

Make the following changes to /etc/httpd/conf.d/wsgi.conf, as follows:

LoadModule wsgi_module modules/

Install the Perl module:

# dnf install epel-release

# dnf install mod_perl

Make the following changes to /etc/httpd/conf.d/perl.conf, as follows:

#LoadModule perl_module modules/

Because Perl module is already loaded in /etc/httpd/conf.modules.d/

Disable SSL virtual hosts for now (Our server will support only http and no https at the moment)

# cd /etc/httpd/conf.modules.d/

# mv 00-ssl.conf 00-ssl.conf.original

# cd /etc/httpd/conf.d

# mv ssl.conf ssl.conf.1

Sub-Section on Installing MariaDB (MySQL) Database Server

# dnf install mariadb-server

# systemctl enable mariadb

# systemctl start mariadb

Reference Guide: How to Use SCP Command to Securely Transfer Files

Transfer backup of ALL databases from OLD server to NEW server:

# scp [hidden email].3:/root/all-databases-20200829.sql .

Restore ALL databases on NEW server:

# mysql < all-databases-20200829.sql

Login to MySQL (MariaDB):

# mysql

Check all MySQL users are imported:

MariaDB [(none)]> select user from mysql.user;
| user             |
| root             |
|                  |
| root             |
|                  |
| root             |
| aaa              |
| bbb              |
| ccc              |
8 rows in set (0.001 sec)

Sub-Section on Installing PHP 7.2

We WON'T be using PHP configuration from OLD CentOS 6.3 server:

# /etc/httpd/conf.d

# mv php.conf php.conf.63

Use the PHP configuration on NEW CentOS 8.2 server:

# cp php.conf.rpmnew php.conf


ERROR: Your PHP installation appears to be missing the MySQL extension which is required by WordPress

Solution is found at:


MUST install php-mysqlnd

# dnf install php-mysqlnd

SECTION 7 Apache Web Server Virtual Hosts


### Section 3: Virtual Hosts
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
# Please see the documentation at
# <URL:>
# for further details before you try to setup virtual hosts.
# You may use the command line option '-S' to verify your virtual host
# configuration.

# Use name-based virtual hosting.
#NameVirtualHost *:80
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.

# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#<VirtualHost *:80>
#    ServerAdmin [hidden email]
#    DocumentRoot /www/docs/
#    ServerName
#    ErrorLog logs/
#    CustomLog logs/ common

#NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin [hidden email]
    DocumentRoot /var/www/html/Teo-En-Ming-Corp
    redirect permanent /

<VirtualHost *:80>
    ServerAdmin [hidden email]
    DocumentRoot /var/www/html/Teo-En-Ming-Corp

    RewriteEngine off
<Directory /var/www/html/Teo-En-Ming-Corp/>
        AllowOverride All

    <Location />
        RewriteEngine on
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule !\.(js|ico|gif|jpg|png|css)$ /index.php

<VirtualHost *:80>
    ServerAdmin [hidden email]
    DocumentRoot /var/www/html/DonaldTrump
    redirect permanent /

<VirtualHost *:80>
    ServerAdmin [hidden email]
    DocumentRoot /var/www/html/DonaldTrump

    RewriteEngine off

    <Location />
        RewriteEngine on
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule !\.(js|ico|gif|jpg|png|css)$ /index.php

#<VirtualHost *:80>
#    ServerAdmin [hidden email]
#    DocumentRoot /var/webmiln
#    ServerName
#    redirect permanent /

<VirtualHost *:80>
    ServerAdmin [hidden email]
    DocumentRoot /var/www/html/Teo-En-Ming-Corp_old

    RewriteEngine off

    <Location />
        RewriteEngine on
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule !\.(js|ico|gif|jpg|png|css)$ /index.php

SECTION 8 .htaccess


order deny,allow
deny from all
allow from AAA.BBB.CCC.DDD
allow from AAA.BBB.CCC.DDD
allow from AAA.BBB.CCC.DDD
allow from AAA.BBB.CCC.DDD
allow from AAA.BBB.CCC.DDD


Create Virtual IPs for Static NAT/port forwarding.

Edit Virtual IP

Name: Wordpress-Website

Interface: Internet (wan1)

Type: Static NAT

External IP Address/Range: AAA.BBB.CCC.DDD - AAA.BBB.CCC.DDD

Mapped IP Address/Range: AAA.BBB.CCC.4 - AAA.BBB.CCC.4

Optional Filters: No

Port Forwarding: No

Click OK.

Then create IPv4 firewall polic(ies) from WAN1 to Internal using the created Virtual IP, allowing http, https, icmp, ssh, and/or other networking protocols as you wish.

You may also use Security Profiles in Fortigate firewall as you wish:


Web Filter

DNS Filter

Application Control

FortiClient Compliance

SSL/SSH Inspection

Web Rating Overrides

Custom Signatures



The Gospel for all Targeted Individuals (TIs):

[The New York Times] Microwave Weapons Are Prime Suspect in Ills of
U.S. Embassy Workers



Singaporean Mr. Turritopsis Dohrnii Teo En Ming's Academic
Qualifications as at 14 Feb 2019 and refugee seeking attempts at the United Nations Refugee Agency Bangkok (21 Mar 2017), in Taiwan (5 Aug 2019) and Australia (25 Dec 2019 to 9 Jan 2020):