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.

Let’s install WordPress!

    1. Get a GNU/Linux. I use Debian Stable for servers and Kubuntu20.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 management. 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 a directory for your site e.g. /var/www/domain.tld , navigate there and write wget and hit ctrl-shift-v to paste the text ‘https://wordpress.org/latest.tar.gz‘.
    6. Unpack with tar xvzf latest.tar.gz
    7. Make the newly created directory writable by the user that your webserver runs as e.g. sudo chown -R www-data wordpress/. This allows the WordPress to update itself and the plugins.
    8. Create the log files access.log and error.log in a suitable place. I use /var/log/apache2/sites/domain.tld
    9. Protect your site and your visitors with SSL/TLS encryption. I have written these instructions on how to set-up ‘LetsEncrypt.org wildcard certificate on Linux using acme.sh and a DNS Api’
    10. 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.
    11. 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 proseed
    12. Start a MariaDB shell and add the database and user for it:
      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’. If you get an error saying the login is not allowed this may be due to a security restriction that only the ‘root’-user can log into the ‘root’-account of MariaDB. In this case try with sudo mysql -uroot -pand you’ll probably be granted access to the MariaDB shell.
      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.
      6. Press ctrl-d to exit
  1. Enter the credentials to the WordPress installation page and follow the instructions and you should be done with installing your main WordPress.
  2. 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:
  3. <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.

WordPress plugins

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. UpdraftPlus by UpdraftPlus.com is a plugin to automate backups of your WordPress sites and to centrally keep up-to-date all the plugins of all your WordPress-sites by enabling UpdraftCentral. Free tier of UpdraftCentral allows you to keep up-to-5  WordPress-sites updated and back-upped to a number of cloud storage services.
  4. 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.
  5. Polylang is an easy-to-use plugin to enable a multilingual site
  6. TablePress by TablePress.org is an easy-to-use plugin to enable adding tables to your WordPress site.
  7. Easy Table of Contents is an easy-to-use plugin to easily include a TOC in a post or a page
  8. Yoast SEO by Yoast.com is an easy-to-use plugin to help you with SEO. Some of the features are not available in the free version