My Setup

I’ve been maintaining an up to date list of what hardware and software I use since I discovered Uses This a few years ago. It usually lives as a page on this blog, but as I’ve rewritten 95% of it today then I think it deserves to be a blog post.

The hardware I use

Work – Surface Pro 4, with a Targus dock, two generic monitors and a Microsoft keyboard and mouse.

Home – A setup that looks superficially the same as work, but is older, has more cables, and has an excellent solar powered keyboard that is far superior to the Microsoft one I use at work. It also replaces the Surface Pro with a proper laptop, and adds a server with lots of memory that runs my (internal) WordPress sites and contains a backup of all my music. I also have a variety of small laptops and Raspberry Pis that fulfill various server and media functions, and a Synology NAS for backups. I’m trying to phase out a lot of my older computers and only use newer machines with SSDs and lots of memory, but it’s hard to let go sometimes.

Work from home – As home, but with an additional VM that allows me to connect to a remote desktop. Sometimes I’ll plug the Surface in, but that is only required for certain types of work and it’s far from my default setup now.

Travel – Chromebook, Raspberry Pi Zero, iPad (sometimes), Kindle and phone. Sometimes I’ll travel with my laptop, but that is rare. I also carry bootable USB versions of Ubuntu and Tails everywhere I go (even places I don’t take a computer). Increasingly my travel hardware also includes a bike and related tools.

The software I use

At work I’m running Windows 10. It’s ok, but I would like to be able to live without it.

At home (and whilst travelling) It’s a mix of Ubuntu, iOS, LibreElec ChromeOS and Raspbian (although I also have computers running Windows 10 and Mac OS that are rarely switched on now). Some of this is the legacy of spending the first half of 2018 trying to live with each main desktop OS for at least a month, which I must get round to writing up properly soon.

I use Firefox, Chrome and Safari on a daily basis, although Firefox has always been my main browser.

Other software I use that I feel is somewhat noteworthy includes:

WordPress – All my blogs run on WordPress, including several that are only available on my home network (including an extensive knowledge base containing all IT related things I learn). I currently maintain a WordPress multisite installation and several stand alone sites.

Evernote – I use this on every device I own (largely the web version now though), mostly to take notes in meetings and training sessions, and then to revise/reflect later. A lot of my notes are now photographs of whiteboards and other hand drawn scribbles, which Evernote handles very well.

Atom – A text editor that handles Markdown well, and can preview and export to PDF. I also use Pandoc to convert to PDF, HTML and/or .docx if required (I try not to use office software until the point I have to share what I’m working on with someone else).

Trello – I use this for my to do list, and it’s a good way to visualise the planning and execution of any task based work.

Dropbox – Cloud storage and syncing software to ensure I can access everything everywhere. I also use the text editor on the Dropbox mobile app to edit on the move.

IFTTT and Buffer – To automate as much as possible. Between them they handle a lot of the seemingly clever things in my digital life, and explain why I seem to be able to post to social media sites at times when I appear to be elsewhere.

Virtualbox – Because no-one needs as many physical computers as I had before virtualisation was a thing.

Spotify for discovering new music, and Rhythmbox for playing the music I already own.

My dream setup

Maybe I’m already living the dream, but the one thing I’d really like is to go back to doing everything on one computer (ideally running Ubuntu). That was possible 10 years ago, and I’m sad that it doesn’t seem possible today. I also yearn to live the life of a nomad, with just a bike, a change of clothes, and a tiny laptop to my name.

Testing on Ubuntu

This blog post details the installation process for Ubuntu when I’m using it for testing web applications. The builds are designed to conduct meaningful tests on Oracle cloud applications but should be suitable for testing any similar web application.

Test Build 1 (all tests)

Installation

  • Installed in a VM running in VirtualBox
  • Give the VM 4Gb of Ram, a 10Gb hard drive, and enable 3D acceleration
  • Install from ubuntu-18.04-desktop-amd64.iso
  • Minimal installation
  • Download updates
  • Don’t install 3rd party software

Post installation tasks

  • Launch gnome-terminal
  • Install all updates by typing sudo apt update && sudo apt upgrade -y
  • Reboot if required

Smoke tests

  • VM boots
  • User can log in
  • User can connect to internet
  • User can open Firefox and browse to a website

Test Build 2 (all tests that fail on Test Build 1)

  • Installed in a VM running in VirtualBox
  • Give the VM 4Gb of Ram, a 10Gb hard drive, and enable 3D acceleration
  • Install from ubuntu-18.04-desktop-amd64.iso
  • Normal installation
  • Download updates
  • Install 3rd party software

Post installation tasks

  • Launch Software & Updates
  • Under Ubuntu Software ensure that all 4 repositories are enabled (main, universe, restricted, multiverse)
  • Under Other Software enable Canonical Partners
  • Launch gnome-terminal
  • Install all updates by typing sudo apt update && sudo apt upgrade -y
  • Reboot if required
  • Install some software by typing sudo apt install ubuntu-restricted-extras adobe-flashplugin browser-plugin-freshplayer-pepperflash chromium-browser

Smoke tests

  • VM boots
  • User can log in
  • User can connect to internet
  • User can open Firefox and browse to a website
  • User can open Chromium and browse to a website
  • User can open LibreOffice Calc
  • User can open LibreOffice Writer

Setting up new Ubuntu computers

I’ve had to set up a few Ubuntu desktop machines recently, and I thought it was worth documenting what I install on each one, and how I automate those installations as much as possible. I wrote about this a few years ago but so much has changed with my setup that I thought it was worth revisiting these instructions.

Generally, I’ll always install from USB, and from the latest desktop version. I make my installer in Ubuntu, using Disk Image Writer and boot the computer from that. From 18.04 onwards I sometimes use the minimal installation feature (which I love), but for now assume that I just go with the defaults for everything.

Once it has finished installing, I’ll go through the process of getting everything I want on to the machine.

Install dropbox

I download the latest version from https://www.dropbox.com/install?os=lnx and then type:

sudo dpkg -i dropbox <hit the tab key>

I have a lot of files on Dropbox, so I let this sync while I’m doing the rest.

Add some software from the Ubuntu repositories

sudo apt update
sudo apt install byobu gimp vlc ubuntu-restricted-extras build-essential hexchat openssh-server gnome-tweak-tool tilix testdrive tasksel gnome-session libdvd-pkg chromium-browser youtube-dl
sudo snap install --classic atom
sudo snap install spotify

Add a script to make updating software easier

Create a new file called updateall

#!/bin/bash
echo "updateall v.1.2 for Ubuntu"
#Run this as a normal user. Your admin password will be asked for if required.
sudo apt update
sudo apt upgrade -y
sudo apt full-upgrade -y
sudo apt autoremove -y
sudo purge-old-kernels -y
echo "The script has now finished running."

I move it to /usr/local/bin/ then make it executable with sudo chmod 755 /usr/local/bin/updateall.

Install tails-installer

sudo add-apt-repository ppa:tails-team/tails-installer
sudo apt update
sudo apt install tails-installer   

Install pandoc

This installs the latest version at time of writing, although there may be updates available.

wget https://github.com/jgm/pandoc/releases/download/2.2.1/pandoc-2.2.1-1-amd64.deb
sudo dpkg -i pandoc-2.2.1-1-amd64.deb
sudo apt install texlive texlive-latex-extra

See here for more on how I configure and use Pandoc.

Cosmetic tweaks

  • Change desktop wallpaper
  • Log out, log back in, and select a vanilla Gnome desktop.
  • Go to Settings --> Security and Privacy and turn off all “phone home” functionality.

Experiments with PDF files

I’ve been experimenting a lot with combining PDF files in interesting ways (largely to make a recipe book from all sorts of different sources). I’ve used Preview on my Mac for a lot of this, but have also done a fair bit of work in Ubuntu recently which required a slightly different approach.

The best graphical PDF merging tool for Linux is probably pdfmod. It’s in the Ubuntu repositories, and can do anything Preview can do as far as merging/exporting PDF files from multiple sources.

For command line merging, pdftk does the job well. The syntax would be something like:

pdftk *.pdf cat output combined.pdf

Which would merge all PDF files in the current directory, or:

pdftk file1.pdf file2.pdf cat output combined.pdf

Which would merge two specific files.

If you need to convert Word documents to PDF prior to doing this, there is a command line tool called lowriter which is part of the libreoffice suite. The syntax would be:

lowriter --convert-to pdf *.docx

It works with .doc and .docx files.

Simple CCTV setup using a Raspberry Pi

This weekend I’ve been setting up my latest Raspberry Pi (a version III, in a blue lego case, running Ubuntu) to display a video stream of what’s going on outside my house so I can watch out for deliveries etc.

It’s something I’ve done before on different hardware, but I thought it was worth documenting as it’s a good project for any model of Raspberry Pi, and requires nothing more than the Pi, a USB webcam (or camera module), and 15 minutes of your time. I’m using a piece of software called motion which is available in the Debian/Raspian/Ubuntu repositories.

Install motion:

sudo apt-get install motion

Enable motion to start at boot:

sudo nano /etc/default/motion

Find the line that says start_motion_daemon=no and change it to start_motion_daemon=yes.

Enable the stream to be viewed from other computers on the local network, and also make the output a little bigger:

sudo nano /etc/motion/motion.conf

Change the following values:

daemon on
width 640
height 480
framerate 100
stream_localhost off

Reboot, and then browse to port 8081 on the computer you’ve set it up on.

An updated guide to using Pandoc for document conversion

I wrote about Pandoc last year, but I’m using it more and more and I’ve found myself editing the original post a fair few times. This is the updated 2016 version that gathers together useful commands I’ve learned so far.

Last year I found myself needing to do a lot of document conversion, and maintaining documentation that needs to be available in a variety of formats (HTML, Word documents, Markdown and PDF). My tool of choice for this sort of thing is Pandoc, which is available for Windows, Mac OS X and Linux, although most of my usage so far has been on Linux and Mac OS X (it’s a command line package that can output to Dropbox, so it doesn’t matter where it runs really).

There are instructions for installing Pandoc on quite a few platforms. I’ve found that following these is generally enough, although it’s worth installing the latest version of the .deb packages rather than the one in the repositories.

On Debian/Ubuntu I also add the texlive-latex-extra package, but that’s largely because it gives me a specific Beamer theme I like to use.

If you’re using Pandoc on Mac OS X there is one more command you’ll need to issue prior to the first time you want to create a PDF file:

sudo ln -s /Library/TeX/texbin/pdflatex /usr/local/bin/

This will ensure Pandoc knows where to find pdflatex. If this step isn’t followed then you’ll likely get an error message along the lines of pandoc: pdflatex not found. pdflatex is needed for pdf output.

Pandoc works for me because I write everything in markdown, and Pandoc is great at taking markdown and converting it into almost anything else. It’s also good if you need to create a PDF, a Word document and a slide show from the same document. The syntax is fairly simple for most document types:

For example:

pandoc input.md -s -o output.docx
pandoc input.md -s -o output.html
pandoc input.md -s -o output.epub

Conversion to PDF works the same, although I’m not a fan of wide margins, so I tweak it slightly:

pandoc -V geometry:margin=1in input.md -s -o output.pdf

For a Beamer slide show you’ll need something like:

pandoc -t beamer input.md -V theme:metropolis -o output.pdf

Pandoc does a lot more, but the documentation is great, and the commands above should be enough to get you started. If you want to try out the functionality in a web browser then http://pandoc.org/try/ should be able to handle most types of conversions.

Setting up WordPress

The following instructions describe how I install WordPress on Ubuntu. The instructions may differ slightly for other server environments, but the basic principles should be the same. This requires shell access to the server, but once it’s finished the WordPress instance(s) should be capable of being administered through a web browser.

Part 1 – Installing WordPress

Download WordPress and move it to /var/www/html/ so it runs from the root directory of the web server.

cd /var/www/html
sudo apt-get install unzip
sudo wget http://wordpress.org/latest.zip
sudo unzip latest.zip
cd wordpress
sudo mv * /var/www/html/
cd /var/www/html
sudo mv index.html index.html_old

Log into mysql:

mysql -u root -p

Create a new database (calling it something different to the example below)

mysql> CREATE DATABASE wordpress;
mysql> GRANT ALL PRIVILEGES ON wordpress.* TO wp_user@localhost IDENTIFIED BY "<password>";
mysql> exit

Install WordPress, following the instructions at http://codex.wordpress.org/Installing_WordPress. Remember to make a note of the username and password you set up for the admin account.

At one point in the installation (it will be obvious) you may need to issue the following command to manually create a config file.

sudo nano wp-config.php

Once WordPress is installed, navigate to /var/www (cd .. or cd /var/www/) and issue the following command:

sudo chown -R www-data html

This will ensure you can install plugins and themes through the WordPress web interface.


Part 2 – Configuring WordPress

Log in using the account you just created.

Install and activate some plugins (Acunetix WP Security, Jetpack by WordPress.com, WP-Markdown and WordPress Importer), via the web interface in WordPress (if you’ve not issued the command above then this won’t work).

Navigate to the left hand menu item for Acunetix WP Security, tick all boxes and click on “update settings”. This will apply all recommended security changes.

Use WordPress Importer to import content (posts, tags, files) from other instances of WordPress.

If you want to compose posts in markdown then you’ll need to navigate to Settings –> Writing and tick the boxes for the interfaces you want to default to markdown.

Note: you won’t be able to activate Jetpack unless the server is visible on the public internet.

Remove the “Hello World!” post and the sample page (both should be obvious if they have not been removed!)


Part 3 – WordPress Multisite (optional)

This allows you to run more than one blog/site in a single instance of WordPress. The instructions at http://codex.wordpress.org/Create_A_Network are good, and are mostly enough to get it up and running.

There are two more things to do on Ubuntu servers:

Enable mod_rewrite

 a2enmod rewrite

Open /etc/apache2/apache2.conf and find the part that says:

 <Directory /var/www/>
 Options Indexes FollowSymLinks
 AllowOverride None
 Require all granted
 </Directory>

Replace AllowOverride None with AllowOverride All


Part 4 – SSL (optional)

Enable mod_rewrite (if you’ve not already done it as part of step 3)

sudo a2enmod rewrite

Enable ssl

sudo a2enmod ssl
sudo a2ensite default-ssl.conf

Amend your apache config to enable pages to be served on port 443

sudo nano /etc/apache2/sites-available/default-ssl.conf

<VirtualHost _default_:443>
Servername yourdomain.com
DocumentRoot /var/www/html

#Enable/Disable SSL for this virtual host.
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3

Amend 80 config (e.g. 000-default.conf), to redirect to 443

sudo nano /etc/apache2/sites-available/000-default.conf

DocumentRoot /var/www/html
ServerName yourdomain.com
Redirect "/" "https://yourdomain.com"

Restart apache

sudo service apache2 restart

Change domain in WordPress settings (through UI) to yourdomain.com

Create a certificate request (csr):

sudo mkdir /etc/apache2/ssl
sudo openssl req -new -newkey rsa:2048 -nodes -keyout /etc/apache2/ssl/yourdomain.key -out /etc/apache2/ssl/yourdomain.csr

Country Name (2 letter code) [XX]:GB
State or Province Name (full name) []:West Midlands
Locality Name (eg, city) [Default City]:Your city
Organization Name (eg, company) [Default Company Ltd]:Your Company
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:yourdomain.com

Copy certificate somewhere sensible

sudo cp /etc/apache2/ssl/yourdomain.csr /home/username/yourdomain.csr

What you’ll need to do then is grab the certificate from home directory, save it somewhere safe and then do whatever you do in your organisation/environment to generate/buy/get a root certificate (there are so many different ways).

Once you have a root certificate, follow instructions at http://askubuntu.com/questions/73287/how-do-i-install-a-root-certificate

Configure apache to use certificate

sudo nano /etc/apache2/sites-available/default-ssl.conf

Then add/edit the following lines:

SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCertificateFile  /etc/apache2/ssl/yourdomain.com.cer
SSLCertificateKeyFile /etc/apache2/ssl/yourdomain.key

Restart apache

sudo service apache2 restart

At that point your site should serve web pages on https with no error messages.

What I did on my holidays

I’m quite pleased with what I’ve achieved over the last two weeks. This holiday was supposed to be a chance to recharge prior to a very busy period at work, but I think I’ve actually been about as productive as I normally am (just in different ways).

I’ve done a lot of technical things while I’ve been off, including dismantling (and throwing away) 5 old computers, building a server/workstation using a lot of spare parts and a new case/motherboard, and setting up WordPress Multisite on the new server (and then building a site to host my Continuous Professional Development Portfolio which I have to do as part of ILM5). I’ve also decluttered my study, set up a new Raspberry Pi Zero, written a lot of notes about fixing specific technical issues I’ve encountered whilst doing all these things, and ripped about 100 CDs to MP3.

The decluttering has felt very liberating, and I plan on doing more of it (and throwing out more computers) in the summer. Of course, all this means is that I have an even larger pile of old hard drives and memory (even after using 3 of each in the new server) that I need to dispose of at some point.

As well as technical things I’ve also visited the Sea Life Centre, been out for two meals, and booked tickets for various shows. I’ve certainly spent a lot less money than a two week holiday abroad would have cost, and I’m feeling like my technology setup is moving in the right direction again.

Setting up new Ubuntu machines

I’ve had to set up a few Ubuntu desktop machines recently (for my own use), and I thought it was worth documenting what I install on each one, and how I automate those installations as much as possible.

Add a script to make updating software easier

Create a new file called updateall

#!/bin/bash
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo apt-get clean -y
sudo apt-get autoclean -y
sudo apt-get autoremove -y

Move it to /usr/local/bin/ then make it executable with sudo chmod -X updateall.

Add some software from the Ubuntu repositories

sudo updateall
sudo apt-get install git gimp byobu vlc ubuntu-restricted-extras build-essential hexchat openssh-server unity-tweak-tool youtube-dl

Install Spotify

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BBEBDCB318AD50EC6865090613B00F1FD2C19886
echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list
sudo apt-get update
sudo apt-get install spotify-client

Install atom

cd Downloads
wget https://github.com/atom/atom/releases/download/v1.7.3/atom-amd64.deb
sudo dpkg -i atom-amd64.deb

The version number may be different – get the latest version from https://github.com/atom/atom/releases/.

Install dropbox

wget https://www.dropbox.com/download?dl=packages/ubuntu/dropbox_2015.10.28_amd64.deb
sudo dpkg -i dropbox_2015.10.28_amd64.deb

The version number will be different, but hit tab after typing dropbox and it should autocomplete. If that doesn’t work, download the latest version from https://www.dropbox.com/install?os=lnx.

Install tails-installer

wget --continue http://dl.amnesia.boum.org/tails/stable/tails-i386-2.3/tails-i386-2.3.iso
sudo add-apt-repository ppa:tails-team/tails-installer
sudo apt update
sudo apt install tails-installer

Install pandoc

wget https://github.com/jgm/pandoc/releases/download/1.17.0.2/pandoc-1.17.0.2-1-amd64.deb
sudo dpkg -i pandoc-1.17.0.2-1-amd64.deb
sudo apt-get install texlive

See here for more on how I configure and use Pandoc, and also for a fix for a Mac OS X related bug to do with rendering PDFs.

Cosmetic tweaks

Go to System Settings --> Appearance
Change theme from Ambience –> Radiance
Reduce Launcher size to 24
Change desktop wallpaper
Enable workspaces

Open Unity Tweak Tool and configure so that hot corners work, with the top left and right corner doing a window spread (largely because that’s how my Macs are set up, and also how Gnome 3 works).

Go to System Settings --> Security and Privacy and turn off all “phone home” functionality.

Updating Ubuntu

I’ve been using Ubuntu a fair bit over the last few weeks, both at work and at home. I have a number of projects on the go, and I’ve found myself needing to maintain a few different machines (both LTS and current) to run experiments on, and to built live servers and services.

One thing I’m very big on is keeping software up to date, and I thought it was worth sharing the script I use to update my Ubuntu machines (and then to delete anything that is no longer required, like old kernels).

#!/bin/bash
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo apt-get clean -y
sudo apt-get autoclean -y
sudo apt-get autoremove -y

I create this on each machine (in a file called updateall), move it to /usr/local/bin/ and then make it executable with sudo chmod -X update all. I then run it when I want to update software (or even better, add it as a scheduled job so it runs once a day).

If I end up with many more machines I’ll need to find something more elegant, but for now this will suffice.