WordPress migration from Windows 2003 IIS to a Linux Ubuntu appliance (Debian)


This took me quite a while, and you may have noticed the downtime on this site as a result.  I thought I’d share my process and solutions in case anybody else is trying to do something similar.  These are my working notes from the migration, so please excuse any lack of polish.  Word to the wise: Don’t do this if you are in a hurry.

  • Installed Windows 2008 R2 on a brand-new box, then enabled HyperV 
  • Created a virtual server, and installed a wordpress (turnkeylinux) appliance from .ISO file.  I set this up for 256M and gave it a modest amount of disk space.
  • Configured the virtual to have a legacy NIC and removed the Virtual NIC, as Ubuntu doesn’t support the virtual NICs yet.
  • From wordpress admin on my old server, exported to an XML file (and checked "include content")
  • Using wordpress admin on new appliance, imported the XML file. This set up WP with just IP addresses instead of machine names, which is perfect for now.
  • Installed Arjuna theme on new WP (I wanted the new one to look exactly like the old one)
  • On checking wp_content/uploads, it looks like the export/import process already moved those images and things – a pleasant surprise. I thought I was going to have to transfer those manually.
  • In my browser, I opened new and old sites in different tabs (using IP addresses), and marched down "plugins" – adding plugins to new box, and configuring them where possible.  I have quite a lot of plugins (about 25) so this took a while.  Also, I suspect these plugins are what was contributing to my memory/swap usage issues below.
  • Using Firefox/FireFTP, transferred contents of wordpress /HLIC folder to the new box. This folder contains images cached by one of the plugins (If I link to an image on the web, this plugin grabs a copy, puts it in this cache folder, then updates the html so I am not reliant on external websites to serve those images).
  • Created old.inaneworld.com DNS and pointed to the old server, added to IIS. As of today that old server is still alive, so you can hit it if you want to compare, though obviously no content is being updated there.  I’ll probably decommission that next month.
  • Changed hostname of linux box to www.inaneworld.com
  • Edited /etc/postfix/main.cf so that outgoing emails would be happier (then did "postfix reload"). Changed "myhostname" to inaneworld.com – this makes outgoing email come from user@inaneworld.com
  • I upgraded the virtual to use 600M of RAM but I’m still having "hang" problems.  Ubuntu and HyperV don’t play well together so you can’t make it a “dynamic memory” virtual.  Ubuntu will never request more memory, so it’ll stay at whatever your starting allocation was.
  • Memory usage seems fine (check with "top"), but swap seems exhausted. This makes little sense, but I'm adding more swap via a swap FILE:
    • apt-get install dphys-swapfile
  • This seemed to help, but didn’t solve the hang problem.  Technically, it doesn’t “hang” anymore, it just responds so slowly that you think it’s hung.
  • From net.wisdom, and my own observation, the default apache2 configuration is very memory hungry, so tweaks are needed:
    • The Apache2 config file is /etc/apache2/apache2.conf
    • I Changed KeepAliveTimeout to 3
    • In the mpm_prefork_module section, I made it look like this:
      • StartServers 1
        MinSpareServers 1
        MaxSpareServers 5
        MaxClients 50
        MaxRequestsPerChild 5000
    • Then, I restarted apache:
      • /etc/rc6.d/K09apache2 stop
      • /etc/rc6.d/K09apache2 start
  • Note, to keep an eye on this, fire up "top", and then type G followed by 3 (must be capital G). This displays memory usage in descending order.

It's been a couple of weeks now and I have no hangs, and performance seems to be good!  I hope this information will be helpful, and best of luck to you in porting YOUR blog!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s