Build a Ubuntu WordPress site (migrate from Blogger)

Here is a simple tutorial on how to install WordPress on Ubuntu and migrate content from Google’s Blogger.

My wife has bugged me for a while now to migrate her blog (https://www.happyschnapper.com) from Blogger to WordPress, after all they have some cool themes, right?

I was always hesitant as I’m too much of a tight ass to pay for hosting services and didn’t want to be hassled every time my server went down at home. You’d be surprised how often IT ‘stuff’ decides to self destruct when you turn your back for only a few moments.

I bit the bullet last weekend due mostly to me being intrigued by the flexibility and simplicity of running and customising a WordPress site.

The tutorial has some quick notes I put together through my experience. I am running an Intel NUC with Ubuntu (Trusty Tahr) which happens to be a Kodi Media Centre. Luckily for me I already had in place a Synology NAS running MySQL for that setup.

Prerequisites:

1 Ubuntu host with Apache installed

1 MySQL (remote or local) + phpMyAdmin (cheats way)

1 Blogger site to migrate

Installing WordPress

The first step is to install WordPress (assuming the pre-reqs are sorted!).

In the first instance I installed this with Ubuntu’s ‘apt-get’ function only to find it was extremely out of date. Ubuntu has a habit of not updating the WordPress source between LTS releases so its worth installing the latest from the WordPress site.

Having said that, the apt-get function is a fantastic way to install most of the pre-req components such as php5 libraries, mysql client, apache (if required) etc. So go ahead and run this after ssh’ing in to your host.

8. Copy the default config sample file and set the right permissions. In this case chmod 600 (Owner can edit, block everyone else) is set to prevent people snooping at your MySQL credentials.cp www-config-sample.php wp-config.php
chmod 660 wp-config.php
chown -R www-data:www-data wp-config.php

Creating a WordPress Database with phpMyAdmin

I took the easy way out….
Well maybe not, but it does make for pretty screen shots, and created my database via the phpMyAdmin. phpMyAdmin is a GUI management interface for MySQL. If you forgo the GUI option brush up on your ‘mysql’ cli commands.

1. Load up phpMyAdmin on your MySQL box and look in with your root credentials.
2. Click on SQL.
3. Create the WordPress database (in this case I called it happyschnapper_wpdb):CREATE DATABASE happyschnapper_wpdb;
Click Go.
4. MySQL will confirm the success.
5. Grant a user appropriate privileges. Below I am creating a user ‘happyschnapper’ and allowing login only from my Ubuntu host ‘192.168.0.5’ with password ‘HappySchn@pper!’.GRANT ALL PRIVILEGES ON happyschnapper_wpdb.* TO "happyschnapper"@"192.168.0.5"
IDENTIFIED BY "HappySchn@pper!";
Click Go.
6. Flush the privileges from mysql’s memory cache so the above change is complete.FLUSH PRIVILEGES;
7. You can confirm the privileges are ok by clicking More, Privileges and viewing the configuration on your WPDB.

Configuring WordPress to use your new DB

You can now change the default wp-config.php file and insert your database credentials and mysql database server IP. Due to its unencrypted nature it is important to have the correct ‘chmod 600’ settings applied to this file before saving.

FYI the salts and credentials are fake, so don’t try any funky business ok?….
1. Back on your WordPress host you now need to change the config file you created.nano wp-config.php

2. Find the section for the MySQL settings. Enter in the accounts and database information you created earlier. In my example my database server sits on the IP ‘192.168.0.4’.

3. Scroll down to the authentication key and salts part of the config file. Here you need to change the ‘put your unique phrase here’ sections with your on salts. Take the easy way out and navigate to https://api.wordpress.org/secret-key/1.1/salt/ and replace the lines in your config.
Save your configuration file in nano by pressingCtrl-X, Y, enter.

Create website in Apache

I wont go in to too many specifics with apache, I’ll assume this is already installed and operating OK. Below are just a few basic settings to enable your website.

Configuring WordPress

We’re almost on the homestretch, time to configure your first WordPress Account and some basic info.

1. Navigate to your newly created website’s administration page, in my example http://www.happyschnapper.com/wp-admin/install.php. Follow the few pages to configure additional properties like Language, Site Titles etc.
2. Log in with your newly created credentials. You should see your default dashboard page.

Finally on to migrating Blogger!

I had a few trial and error runs with this process….

WordPress suggested the ‘Blogger Importer’ add-on to migrate the content but it didn’t work as expected with my wifes blog.
Her images imported to the WordPress Media store OK but didn’t render at all on the her posts. It may have been due to running the latest WordPress (v4.5.2) at the time along with the great big ‘Warning: This plugin has not been tested with your current version of WordPress’ visible on the plugins homepage.

2. Navigate to the Plugins, Installed Plugins page, click Start!
3. Click Ok, let’s go! (if you get an SSL error go back and try again…)
4.You will need to allow BIE access to your Blogger account. This will allow the add-on to access the content and push it to your WordPress database.
When prompted click ‘Allow’.

5.Select the blog you are migrating.
6. Ensure both ‘Convert Formatting’ and ‘Preserve slugs’ are checked. Click Continue
7. BIE will now migrate your content. This can take a while if you have a load of media content.
8. After the migration is complete you will need to assign a user as the post creator. In this example we use the account you created when configuring WordPress. Select an existing user and hit Assign Authors.

Finishing up

If all has gone to plan you should now have your Blogger content imported in to your new WordPress site.
Time to go clean up a few of the ‘demo’ posts and comments.

Click on Pages and remove Sample Page (this should be the newest).

Click on Posts and remove “Hello world!”.

I’d recommend removing BIE now that you have used it along with de-authorising its access from Blogger. This can be done via the Plugin page. Mine didn’t de-auth properly so head over to Google Blogger and remove BIE from the Authorised Apps in your settings to give it a swift kick.

Don’t forget to cut your DNS over.

The most arduous task will be finding a theme you like and some funky plugins.