JENS MALMGREN I create, that is my hobby.

Porting my blog for the second time. Project started!

Porting my blog for the second time

On 10 June 2011 I started blogging on Blogger. Not long after on 28 August 2011 I ported the blog to Blogengine.NET that I hosted on my own Windows Small Business Server 2003. I used version 2.5 (Domain no longer available) With Blogengine.NET I had hoped that one day I might start to develop for the engine but that never really happened.

On 29 on January 2015 I accidently killed my blog but after first aid and intensive care it stood up again but it was not the same. Things were broken. I could work with it but there were error messages. While working on fixing things I figured out that there would be no way I could upgrade to a later version of Blogengine.NET without further investment in new hardware and server. I also found out that the idea with Blogengine.NET is that it is at the front of all things .NET and ehum, that is slightly to expensive and useless to me.

Then on 14 July 2015 Windows 2003 expired. I understand that Microsoft cannot support old stuff infinitely but this was really not something I had anticipated on. After the domain havoc the Windows 2003 server would not let me create any new websites. Instead I got really obscure error messages. Actually to be honest, Dot.NET had never worked very well for me on this server.

What should I do with an expired server and a broken Dot.NET? I decided to port all my sites to an Ubuntu server that I host myself. First I ported my site from IIS, SQL Server and Dot.NET to Apache2 and PHP and MySQL. That went really well!

On 5 September 2015 I started on the project of porting my blog for the second time and this blog post is the story about how I ported my blog from Blogengine.NET to my own simple blog platform on Ubuntu server using Apache, PHP and MySQL.

But we begin with the beginning. In the Blogengine.NET I originally had decided that I would store the blog in XML files instead of in SQL Server. So now I had loads and loads of XML files. What to do with them? First of all, get them over to the Ubuntu server.

Here I download all my files from the old Blogengine.NET 2.5:


Here I upload the files to my Ubunto server:

I previously had experience of working on Unix systems but it is a long time ago so such a simple thing such as where should I place the files so I can work on them? So after some research I decided for /usr/local/bin.

Now that I have the files on the Ubuntu server my plan from here on is the following:

  1. Analyze the XML files, figure out a proper database layout. Perl.
  2. Create the database layout I need to host the blog. MySQL.
  3. Import the XML files into the new database. Perl
  4. Design a PHP based self-made blog engine that can display the data from the database. PHP Apache2 and jQuery.

For step 1 and 3 I decided I will use Perl. With Perl I can make a conversion routine looping over the files analyzing and testing. I can load the content of the files and figure out how they are related to each other. When I am ready for it I can let a Perl program import them into the database as I want them to be. If necessary I can carry out all sorts of automatic conversions when needed. Actually I can go over the import and conversion step as many times as I need to. When I start design the site in PHP and I finds out that presenting for example an image in a specific way is not good enough then I can make sure that my Perl program adjusts that instead of that I do all the work manually.

Also I have a little extra future wish for my project: I would like my blog to be able to accept content from Microsoft Word when I am done. That would be fantastic! I think it would be possible to upload a DOCX file to a PHP script and open the file and parse the text and insert it into the blog database. But I leave that as a future extra.

There is also another project I have not mentioned so far. That is to migrate other server functions from Windows 2003 to Ubuntu such as DHCP and DNS and Printer Server. Luckily I never started using the Exchange Server in Windows 2003 so for email migration I have a simple task. Actually I cannot finish the migration to Ubuntu until my blog has been ported.

Another alternative would be that I could find out some mixed mode where I have both my Win 2003 and Linux running at the same time. Probably it could be done by using a Proxy on the Ubuntu server in such way that it got the requests from Internet first and for the sites hosted on Win 2003 it would forward the request but for sites already on Ubuntu it would forward to the local Apache2 web server. I not to try this and instead start porting the blog.

So here we are, the migration project can start!

One moment please...

While working on this project I found I am using these Unix commands all the time:

Command What it does
$sudo su Switch to superuser. The prompt then shows a '#'.
#mysql -u user -p Log in on the MySQL server.
#shutdown -h -P 0 Shutdown the server.
#chmod +x Make executable.
#/etc/init.d/mysql restart Restart MySQL server
#service apache2 restart Restart Apache2 server
#mysqldump --password --result-file=backup.sql Create a backup of the database
Commands in MySQL What it does
use database; Selects what database to work on.
show tables; Shows what tables are available in the database.
desc table; Shows the layout of the table.

I was born 1967 in Stockholm, Sweden. I grew up in the small village Vågdalen in north Sweden. 1989 I moved to Umeå to study Computer Science at University of Umeå. 1995 I moved to the Netherlands where I live in Almere not far from Amsterdam.

Here on this site I let you see my creations.

I create, that is my hobby.