Simple, quick WordPress installation

tar xvf latest.tar.gz
mysql -u root -p -e "create database my_schema; create user 'myuser'@'localhost' identified by 'password'; grant all privileges on schema.* to myuser;"

Update local file update flag (because WordPress expects the httpd user to own the directory):

echo "define('FS_METHOD', 'direct');" >> wp-config.php

Migrating an existing site

To migrate a WordPress installation from one host to another.

Firstly at the source location (with bash help from https://tomjn.com/2014/03/01/wordpress-bash-magic/ ):

cd example.com/

# (Create, gZip, Preserve permissions, Verbose, Filename)
tar czpvf ../examplecom-wp.tgz .      

WPDBHOST=`cat wp-config.php | grep DB_HOST | cut -d \' -f 4`;
WPDBNAME=`cat wp-config.php | grep DB_NAME | cut -d \' -f 4`;
WPDBUSER=`cat wp-config.php | grep DB_USER | cut -d \' -f 4`;
WPDBPASS=`cat wp-config.php | grep DB_PASSWORD | cut -d \' -f 4`;

mysqldump -q -u $WPDBUSER -h $WPDBHOST -p$WPDBPASS $WPDBNAME | gzip -9 > ../examplecom.sql.gz

Then, at the target location:

# First open phpMyAdmin and clear all tables in the target schema

scp user@host:~/examplecom-wp.tgz .
scp user@host:~/examplecom-sql.tgz .
# OR, pop into a public folder somewhere and `curl`
# curl -OL http://myserver.com/examplecom-wp.tgz
# curl -OL http://myserver.com/examplecom-sql.gz

cp public_html/wp-config.php .

WPDBHOST=`cat wp-config.php | grep DB_HOST | cut -d \' -f 4`;
WPDBNAME=`cat wp-config.php | grep DB_NAME | cut -d \' -f 4`;
WPDBUSER=`cat wp-config.php | grep DB_USER | cut -d \' -f 4`;
WPDBPASS=`cat wp-config.php | grep DB_PASSWORD | cut -d \' -f 4`;

gzip -d examplecom-sql.gz
mysql -u $WPDBUSER -p$WPDBPASS $WPDBNAME < backup.sql

rm -rf public_html/*

# Important! extract tar from INSIDE public_html
cd public_html/
tar xvf examplecom-wp.tgz
cp ../wp-config.php .