// log into the MySQL account
mysql -u root -p
// create database
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
// create user for database
GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
// update changes
FLUSH PRIVILEGES;
// exit
exit;
// assign permissions of the root file to our username
sudo chown -R me:www-data /var/www/html
// make all new files inherit permissions
sudo find /var/www/html -type d -exec chmod g+s {} \;
// group write permissions to the wp-content directory
sudo chmod g+w /var/www/html/wp-content
// write access to these folders
sudo chmod -R g+w /var/www/html/wp-content/themes
sudo chmod -R g+w /var/www/html/wp-content/plugins
// download latest version of wordpress into a temp directory and extract
cd /tmp
curl -O https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
// create dummy .htaccess file and give it the necessary permissions
touch /tmp/wordpress/.htaccess
chmod 660 /tmp/wordpress/.htaccess
chown www-data: .htaccess
// copy the sample config file into the final one
cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
// add an upgrade directory
mkdir /tmp/wordpress/wp-content/upgrade
// copy wordpress to the document root
sudo cp -a /tmp/wordpress/. /var/www/html