New Music – May 2016

I was at home a lot this month, using up holiday I needed to take, and also doing a lot of de-cluttering and technical projects around the house. I did listen to a fair bit of new music (as detailed below), but I also ripped around 100 old CDs to my computer, and so much of my fortnight off was sound-tracked by music from the 90s and very early 2000s, which I’d not listened to for the best part of 10 years.

May also saw the unexpected release of the new Radiohead album. I’ve played it a lot, I love it, and I’d highly recommend it to anyone. Also of note was the Rough Trade album of the month by LUH. The music is great, but it’s also the sort of record that you want to just look at – it’s full of interesting artwork, and the sleeve itself is a work of art.

I’d also highly recommend the New Order record. It’s extended versions of last year’s album, but it comes with a download code for the original album so you get a great deal of wonderful music for £9.99. Of course, that means I now have another download code for Music Complete.

I also love the new Car Seat Headrest record. If you’re intrigued then there are a few very good albums available from Bandcamp on a pay-what-you-want basis. I’d recommend How to Leave Town as a representative starting point.

My list for May is:

Radiohead – A Moon Shaped Pool
LUH – Spiritual Songs for Lovers to Sing
James Blake – The Colour in Anything
Julianna Barwick – Will
Cate le Bon – Crab Days
New Order – Complete Music (extended versions from last year’s Music Complete)
Drake – Views
Cat Seat Headrest – Teens of Denial
Super Furry Animals – Bing Bong (single)

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

Navigate to /var/www and issue the following command:

sudo chown -R www-data html

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.


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.

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.

WordPress troubleshooting

I’ve done a fair bit of WordPress troubleshooting over the last few weeks, including moving sites from one server to another and upgrading server operating systems. While a lot of this isn’t probably that interesting, I did come across a few things that might help other people undertaking similar tasks.

My method for moving content between sites generally involves exporting the content to XML, installing a fresh instance of WordPress on the new server, importing the content using the WordPress Importer plugin, and then seeing what doesn’t work. What usually doesn’t work is uploaded images and files, but it’s just a case of copying across the whole contents of /var/www/html/wp-content/uploads to the new server to fix that.

Talking of which, Debian (and derivatives) changed the default location for websites from /var/www to /var/www/html last year. If you upgrade Debian to the latest version and all your WordPress sites break, then it should just be a case of editing /etc/apache2/sites-available/000-default.conf so that the DocumentRoot value is set back to to /var/www/.

My last revelation is around hardwired links. When moving a site to a new server (with a new URL) there are likely to be many references to the old site URL in config files and in the WordPress database. There is a plugin called Search and Replace which does all the heavy lifting for you, and which should rewrite your new URL to everywhere it needs to be. I’ve used this a few times now and it works really well.

I’m also half way through writing up how I install sites from scratch, but that’s going to be quite a lengthy document and probably deserves a separate post.

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
sudo purge-old-kernels -y

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

Add some software from the Ubuntu repositories

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.