My New Backup and Testing Server
A few weeks ago, a stray lightning bolt managed to create a power surge through our cable - and through that our network - damaging three unfortunate pieces of networking equipment. Two gigabit switches, a cat6 Ethernet cable, and a gigabit card fell before this power surge, of these one of the switches, the cable, and the card were mine. The switch is still managing to limp along - some ports simply don’t support gigabit speeds anymore. The network card, which was the one installed on my server, was completely taken out, forcing me to switch to the 100mps onboard adapter.Not long ago, I finally ordered the card, and today I managed to find the time and energy to install it.
However, I couldn’t just simply take the server down and install the card while taking my website completely offline for the duration - an option that is in reality acceptable to me, but as it happened I recently acquired two old desktops either one of which with more than enough life left to run a lightly trafficked website for an hour or two. So, I decided to rehabilitate one of them, an old Dell.
This Dell lacked a hard drive, the previous owner having pulled it in an attempt to ensure that their data would remain safe (better ways can be had to do this, by the by) so the first step was to install a new drive in it. Unfortunately, this proved to be somewhat difficult, first to find an IDE drive (no SATA ports to be had, sadly) then to install it. Fortunately, a little persistence turned up an old 20 gig hard drive - more than adequate for my purposes. Figuring out how to install the drive was substantially more difficult. I will admit, I have only used a few cases, so my experience is limited, but every computer I have seen puts its hard drives directly below the CD/DVD drives. This one has a detachable piece that the hard drive is mounted in, then it stands up against the front of the case.
I’m truly embarrassed to say it took me around forty minutes to sort out the installation of this drive. However, once I finally got the last of the cables plugged in (it was cramped enough inside that I had to unplug all the power cables and ribbon cables) I was soon onto the installation of Ubuntu Server.
Not seeing any point in burning another CD (I have one for Ubuntu Server - but not in 32 bit) I loaded Ubuntu Server onto a flash drive and I soon had a LAMP server set up on the box. Following this I quickly configured ssh server, and was glad to not only be able to log into the new server without a keyboard or monitor attached, but also to be able to navigate to its IP address and see the “It works” page, informing me that Apache was up and running. At this point I stopped for the night, figuring it wouldn’t take long to migrate a copy of my site to run on this backup server while my main server underwent its maintenance.
Of course, I always forget the hassle of dealing with mysql through command line (and I figure I’ll learn more this way, so I refuse to install a web front end for it). I was able to successfully import the database for my thoughts blog onto the backup server, as well as transfer the actually web files. However, I was stumped for quite some time as Drupal refused to display my site. The solution, much like the solution to my difficulties with the hard drive, proved to be quite obvious, simply putting the site into offline mode before exporting the database prevented the difficulties. (A more detailed explanation of how to move Drupal back and forth like this to come later), and then running
a2enmod rewrite and reloading Apache so that it could rewrite its URLs the way Drupal prefers to.
So, finally having gotten Drupal to read its database and gotten URL rewriting turn on for apache, I shortly ran into a new problem - logging in while the site was in maintenance mode. Some research revealed that by entering the URL http://192.168.0.x/?q=user I could log in once more. Again though, I soon found that I had components that needed setting up.
It turned out that I had forgotten to configure Apache to allow clean URLS to be used. Fixing this required editing the file
/etc/apache2/sites-available/default so that in the
Directory /var/www section
None in the line
AllowOverride None. All that remained following this was installing ImageMagick and the GD library for PHP so that my image related modules could work properly.
Soon after the last of the steps were completed, I put my site into maintenance mode on my main server and moved it over to the backup, and pointed my domain at that local IP in place of the main server’s IP. I was quickly able to installed the network card, but had to trouble shoot some issues with the network before I could move back to the main server, leaving the backup to successfully run the site for a few hours (the last half hour or so of which it was in maintenance mode, when a problem with my switch suddenly became apparent just before I switched back to the main server).
All in all, I think that for an old computer it performed quite well - although I noticed that the motherboard battery is failing, which means resetting the time anytime the machine has been unplugged.