Installing and running WordPress

Wordpress logo
One of the official WordPress logos from https://wordpress.org/about/logos/

This is a How To describing the rational install process of WordPress on GNU/Linux in some detail

The official definitive How To install WordPress guide is at the codex. This post you are reading now complements it by documenting the installation and maintenance for me and also potential customers and giving useful tried-and-tested tips.

  1. Get a GNU/Linux. I use Debian Stable for servers and Kubuntu16.04 (which is an LTS, yippee) for desktop. I also hear good people saying good things about Arch GNU/Linux.
  2. Get a domain name. These cost 10-20€  / year. I use https://gandi.net which is the latter but their palette is so large and their tek is so solid I don’t mind paying +100% extra compared to the price leader with crappy implementation, shady practices and Microsoft .asp crap like you can expect with GoDaddy.com or such. Marketing your WordPress will be much easier with a domain name of it’s own.
  3. Install the dependencies as explained here. If you don’t know what those are you can contact me for help and I will explain package managemnt. If you need someone to (metaphorically) hold your hand while you do the installation or someone to explain to you what these instructions are and what they mean I can come over in the Helsinki area for gigs as short as 4 hrs work.

    The official Debian logo
    The official Debian logo released under LGPL 3.0 – Courtesy of https://www.debian.org/
  4. Go to https://wordpress.org/download/ and right click on the “Download .tar.gz” and choose “Copy link location”
  5. ssh in to your GNU/Linux and create and chown it to the user that will be running the PHP process/var/www/sitename.tld and write ‘wget’ and hit ctrl-v to paste the text ‘https://wordpress.org/latest.tar.gz’.
  6. Instruct your web server in a VirtualHost directive that DocumentRoot is ‘/var/www/sitename.tld/wordpress’. I use both Nginx (nicer conffing) and Apache2.4 as web server, VirtualHost and DocumentRoot are the valid names of the things in the /etc/apache2/sites-enabled/*.conf, the default place for placing the VirtualHost directives.
  7. Point your browser to your domain name and you should see the installation page. There you need to enter ‘database name’, ‘database user’ and ‘password’. Lets create those so we can proceed
  8. Access your shell with ‘ssh’ and start a MariaDB shell with the command.
    Powered by MariaDB
    MariaDB is your faster and more ethical binary compatible drop-into-place replacement for MySQL. MariaDB is a fork of MySQL by the original developers. MySQL is copyright of Oracle Corporation these days.
    1. Type ‘mysql -uroot -p’ and enter your MariaDB root password. The name of the shell wasn’t changed in order to not break things, this is why the command is still called ‘mysql’
    2. Now you should be in the MariaDB shell
    3. create a database with ‘create database mywordpress;’ in the MariaDB shell. Naturally replace ‘mywordpress’ with what you feel like naming your database
    4. type ‘use mywordpress;’ to use the database
    5. type “GRANT ALL ON mywordpress.* TO ‘wordpressuser’@’localhost’ IDENTIFIED BY ‘passwordgoeshere’;” to give the user named wordpressuser all rights on the database mywordpress and all of it’s tables, but only when it is connecting from localhost and naturally has the right password.
  9. Enter the credentials to the WordPress installation page and follow the instructions and you should be done with installing your main WordPress.
  10. Once installation is ready you should enable the prettier URLs in Dashboard > Settings > Reading. This will write the necessary rules into your .htaccess file automatically. If you are getting a 404 Not Found error for your pages and posts you need to enable the use of .htaccess directives in your main web server configuration for this directory as follows:
  11.     <Directory /var/www/domain.tld/wordpress/>
    AllowOverride All
    </Directory>

Remember to reload your web server each time you want it to reread its changed configuration. I use ‘sudo service apache2 reload’ to do that.

After installation it is good time to take into good use some of the great WordPress plugins

  1. Akismet is an excellent anti-comment-spam tool. Get it and activate it for free but optional payment is in order if you can afford it. Follow the instructions. Get a free Akismet.com account which is needed to activate. A WordPress.com account is needed to get the API key to enable Akismet. Also many other plugins ask you for rights via the WordPress.com entity authentication so get a free WordPress.com account to enable lot of automation candy.
  2. JetPack by WordPress.com is an excellent automation tool. It has amples of features that can be enabled. It can for example automate pushing new posts to Facebook, twitter, Linkedin etc.
  3. WordPress Importer by WordPress.org does what it says. The export is built-in into WordPress and gives you filtering to select posts. I imported a few entries from http://juboblo.gr that are of interest to my readers and future clients.