Ok, let's download and unpack the latest version of WordPress directly into the root of our web directory.
cd /var/www wget wordpress.org/latest.tar.gz tar xzvf latest.tar.gz --strip-components 1
Lastly, we need to remove the default Apache index.html file so visitors will be served the WordPress index.php instead.
rm index.html
With WordPress downloaded and unpacked we are ready to get production ready and run the install.
Let's create a user that will own our WordPress installation with all the proper permissions. Let's create the user "wpftpuser".
useradd -d /var/www wpftpuser
We have created a user named wpftpuser and given the web content directory as the home directory. Now change your user password with the passwd command.
passwd wpftpuser
When prompted to "Enter new UNIX password:" create a new password and press enter. Again enter this password when prompted to "Retype new UNIX password:".
We need to make sure our new user has group and user permissions to the web directory. This is going to ensure smooth sailing later on when we need to upload files or modify permalinks with WordPress.
chown -R wpftpuser:www-data /var/www
Now we will change the permission level on the folder to be group writable to allow the www-data Apache group write access.
chmod -R 775 /var/www
And, finally, we will add the wpftpuser to the www-data group with one final command.
usermod -a -G www-data wpftpuser
You may be wondering why we performed this last step. That is because WordPress wants Apache to be the group owner of the web folder. And WordPress gets what WordPress wants!
At this point, you could run the WordPress install and setup your wp-config file. But we're going to skip this step now, because we want to wait until we've setup our DNS records. That way, when we do install WordPress, it will store the proper domain name as its 'url', instead of the IP address of our master server.