This has been a long time coming – I have finally migrated my blog and associated sites off Windows 2000/IIS onto a standard LAMP infrastructure.
Part of the reason for this move is related to the age of my web server (10 years old, running almost continuously since 2002), as well as my desire to bring some stability to the maintenance and update processes for my various sites. An added benefit, is that I am seeing a significant improvement in performance of web queries from the new server over my old environment.
So, how did I do it? I broke the process down into some basic sections:
- Server/OS setup
- Web server migration
- Data migration
- Web applications configuration
Server and OS – I decided to do something new for this effort. Rather than setup my new environment to host my web services and sites directly, I decided to virtualize the web server using Oracle Virtualbox. After setting up Ubuntu as the host OS on a 2 GB Athlon 2600 PC, I downloaded Virtualbox and installed it on the server. The next step was to create my guest system – I created a virtual PC of 1 GB RAM with 100 GB disk running Ubuntu 10.10. I also ensured that the virtual network adapter was set to bridged (so that it would get provisioned with an IP from the DHCP server). Once the guest Ubuntu web server environment was setup and available, I started the process of installing my web server applications. Ubuntu makes this easy – I ran the Ubuntu Software Centre, and simply searched for Apache, then chose to install it. A similar process allowed me to install MySQL 5.3 and PHP 5.
Web server migration – This step was pretty clear conceptually: I was going to move from WIMP (Windows 2000, IIS, MySQL, PHP) to LAMP, so the web server portion would be covered by changing my OS (I chose Ubuntu 10.10), and my web server (Apache 2.2). I had a small set of applications to migrate (all PHP-based), so this made the process easy. I copied all the application directories and source files (PHP, HTML, images, etc.) onto a flash drive, then mounted the drive in my new virtual web server and copied them as sub-directories of the default Apache web location. To make the process of managing my LAMP server easier, I had earlier installed Webmin, which allows you to visually assign aliases and site directives for your Apache instance (among other server maintenance activities. I used this to create the web virtual directories in Apache to mirror those that I had previously setup in IIS. The next step was to migrate my database.
Data migration – On my old server, I used the standard MySQL tools to export each application database to an external sql file, e.g.,
mysqldump -h tsunade -u duanecato -p corse > corse_120212.sql
Then I used my trusty flash drive to copy the export files into my virtual LAMP environment, and proceeded to run them, creating the application databases:
mysql -u duanecato -p corse < corse_120212.sql
Since this brought over all the database contents from the source WIMP environment, I had little additional work to do with the databases. I intended to keep the same URL structures and virtual directory setups, but if I had changed the hostname or directory aliases, then the tables would have required updating as appropriate for the particular web applications.
Web applications configuration – As I mentioned previously, my web applications are all PHP-based, making them relatively easy to configure for a new OS and server environment. For example, I use phpBB for a forum I maintain, and to enable in the new LAMP server, I simply changed the config.php file to reference the new server name. I did have some issues with my genealogy software, phpGedview, as the version I used on Windows was compatible with MySQL 5.0, but not the new 5.3 which was in the LAMP server. This required a quick upgrade of the phpGedview software to it’s latest version, and subsequent copying of my custom files and updating the config.php in the new instance. I did gain some brand new features now available in the latest version of phpGedview, so this was a positive development.
My final step was to change my firewall to reference the new virtual server for responses from outside my network on port 80. This was a simple change in the router configuration, your own router/firewall will have instructions on how to setup port forwarding. It is important to ensure that the virtual server is accessible from the router i.e., it is not defined as a NAT network interface from the host OS, otherwise, port forwarding to the virtual server will not work.
I’m now looking at additional optimisations and improvements that I can make around the use of LAMP as my web environment of choice, particularly around improving page delivery performance. The future looks bright!