Creating this Website – Part 1: Getting Started

Motivation

There are a few reasons I created this website:

  • To scratch an itch!
  • Consolidate my photos and posts.
  • Make content available outside social networking platforms.
  • Reduce reliance on Facebook.
  • Wanting to write about topics not suitable for the social networking platforms I used.
  • Curiosity and pleasure!

Getting started

I looked at various platforms but eventually opted for the most widely used platform, WordPress. It is open source.

Having picked WordPress, I created a free website on WordPress.com. WordPress steps you through the process. It takes about 15 minutes.

After playing around with the test site, I was happy that WordPress had the right combination of out-of-the-box functionality and easy customisation options. I knew you could further customise it by writing your own code in HTML, CSS, JavaScript and PHP.

I realised that the free site on WordPress.com had limitations and that in order to get the sort of site I wanted (with possibly my own plugins), I would have to buy the business plan and even then I wouldn’t have SSH access.

With that knowledge, I deferred the decision of where I would host the website and, instead, focused on developing the site on my PC.

Setting up WordPress locally

If you’re developing a website and you’re not interested in doing your own development, it’s perfectly possible to create a great looking website using the many available themes and plugins. In which case, you won’t necessarily have to install WordPress locally. You could just use a hosted solution.

I installed a local instance because, even if I didn’t want to resort to programming, I wanted to try out various options locally before committing them to a public website.

Docker

Instead of installing WordPress on my PC, I decided to use a Docker image. This is like a lightweight virtual machine running locally. There are many pre-built (official) installations (images) that you can download. WordPress has an image you can download. This saves you having to install WordPress and you know it’s configured the right way because WordPress created the image!

You can install Docker by following the instructions on the Docker website. These are the instructions for Windows but you can use Docker on Linux and MacOS.

Installing WordPress

Once Docker is installed, fetching the WordPress image is as simple as running the following from the command line (bash, cmd, PowerShell, etc)

docker pull wordpress

For full details, see the WordPress Docker documentation.

I used a docker-compose.xml file to create a start-up file that has all the configuration information for the docker-compose command. You can use docker run command instead of docker-compose. However the docker-compose command lets you: start multiple images at the same time; add version control to your start-up file; and have multiple scripts to try various options. Initially, you’ll need to start WordPress and MySQL. Later, you may want to add PHPMyAdmin so that you can manage MySQL.

The following is my final docker-compose.xml file:

version: '3.3'

services:
   db:
     image: mysql
     volumes:
       - db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: somewordpress
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: wordpress

   wordpress:
     depends_on:
       - db
     image: wp
     volumes:
       - wp_data:/var/www/html
     ports:
       - "8000:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: wordpress

   phpmyadmin:
     image: phpmyadmin/phpmyadmin:latest
     depends_on:
       - db
     container_name: phpmyadmin
     environment:
       - PMA_ARBITRARY=1
     restart: always
     ports:
       - "8080:80"
     volumes:
       - /sessions

volumes:
    db_data:
    wp_data:

To start WordPress, MySQL and PHPMyAdmin, run the following command from the directory that docker-compose.xml is stored in:

docker-compose up -d

This will start the services in the background.

You can view WordPress by going to http://localhost:8000 in your browser. MyPHPAdmin is available at http://localhost:8080.

When you go to your WordPress site, you’ll be asked to create a website, which you can step through. The steps are straightforward, such as choosing a name, theme, etc.

Once created, you can customise the site from the admin page, which is available at http://localhost:8000/wp-admin.

In Part 2, I’ll describe my WordPress customisations.

Leave a Reply