Restore WordPress from Duplicator Backup on Vanilla CentOS7 (and others)

I’m putting it here because… well, I feel like I’m a pro at doing this restore procedure given the constant data loss events at Cloud at Cost.

Please, don’t use their services. I’ve already paid the money and don’t feel like paying again for a service I technically still have. I’m also cheap and too stubborn for my own good. This is what happens when you grow up poor and don’t value your time.

Anyway… let’s get back to the topic.

You have a fresh CentOS install and want to get your WordPress backup online in the fewest possible steps.

Start installing the following packages. This assumes you are root. 

yum install net-tools
yum install httpd
yum install php
yum install mysql
yum install mariadb-server
yum install php-mysql

Edit http.conf and add PHP handling to Apache configuration (needed if running Duplicator installer from browser just shows source code).

vi /etc/httpd/conf/httpd.conf  

add the following lines to httpd.conf

AddType application/x-httpd-php .php .htm .html
AddHandler x-httpd-php .php .htm .html

Start Apache (httpd) and DB (mariadb)

chkconfig httpd on
systemctl enable mariadb
systemctl start mariadb

Set mariadb password (if required). This can be done in two ways:

set DB passwordmysql_secure_installation

… and follow the instructions from the script (recommended), or simply run the following and type the password when prompted.

mysqladmin -u root password

Now, copy the installer and archive files to html root directory.

cp installer.php /var/www/html/
cp <date>_<sitename>_archive.zip /var/www/html/

Now, this may be necessary if trying to run the installer in browser, and it fails at the validation, or more specifically at the “permissions” stage. 

Edit SELinux config file to disable SELinux.

vi /etc/selinux/config  

and change the following setting to:

SELINUX=disabled

You may need to reboot here. If the above change fails, permission / ownership change on html root directory may be required

chmod a+x installer.php
chown -R apache:apache /var/www
chmod -R a+rwx /var/www

Finally, point your browser to http://<sitename>/installer.php to run the Duplicator installer.

Following successful install, go to worpress dashboard to remove the install files.

Finally if you made permission changes in html root, reverse the change:

chmod -R o-w /var/www