fognl

Get off my lawn.

Saturday, December 31, 2005

New Linux install up and running

I had intended to use my 4-day weekend to do the following:

  • Put a new hard drive in my laptop
  • Get it working
  • Install Ubuntu Linux on it
  • Config the sys

I'm already just about done, and I didn't start until sometime after 6pm last evening.

Hard drive installation was a snap. 6 screws, one adapter, 2 hard drives: loosen, pull, loosen, pull, put, insert, tighten, snap, push, flip, snap, tighten, done. It would have only taken about 2 minutes, but I removed the wrong panel from the laptop at first, so I had to put it back on.

Package Managers
I had Ubuntu installed on this machine on a different (slower) hard drive, about 2 months ago. Since then I had installed probably 200 packages, courtesy of apt-get, which makes things really easy. From my previous experience with Red Hat and SuSE linuxen, I'd found that the process of installing software was typically as follows:

  • Do a google search for something relating to the package I was interested in.
  • Find some kind of link in the results, and hunt for the package.
  • Download the binary package.
  • Try to install it.
  • Fail.
  • Download the source.
  • Try to run configure and make to build it.
  • Fail.
  • Download the dependencies.
  • Spend a day reading about them and learning about their intricacies.
  • Follow a set of instructions for them.
  • Run configure and make.
  • Run the software, and try to remember that the heck I was doing before I started the ordeal.
  • Consider myself fortunate and skilled for having succeeded.

A variant on this approach is to use RPM, the stupidest and worst package management system in human history. I hate RPM.

To their credit, RedHat and SuSE, having been configured, usually work without any trouble at all. (Contrast this to a Windows installation, which flakes out and shoots itself in the groin, seemingly at random.) That's why I perservere through the BS associated with installing Linux software. It just works! Not to mention the fact that the process is pretty educational. I know more than some about USB, TOC files on CDs, the virtues of Track-at-once vs. Disc-at-once, buffer sizes, kernel source, drivers, ALSA vs. OSS, disk latency, and a lot of other minutiae. More than I wanted to know!

With apt-get and Synaptic (the GUI front-end for apt-get), I do the following:

  • Open Synaptic.
  • Use the search function to find the package I'm interested in.
  • Click on it to mark it for installation.
  • (optional) Select a few other packages that look interesting.
  • Click "Apply".
  • Wait a few minutes.
  • Use the software.
  • Consider myself fortunate and smart for having found a Linux distro with a package management system that doesn't totally suck!

The problem I faced with a new installation of Ubuntu was, how do I remember everything I had installed over the past two months? I ended up doing the following on the old linux system before I shut down to replace the hard drive:

dpkg -l > all-packages

...to get a list of all of the installed packages. I saved it to a directory on another machine.

After installing the base system on the new hard drive, I retrieved the all-packages file from the other machine, and did the same thing with the new installation:

dpkg -l > base-packages

...to get a list of the packages appearing in a base install.

Then I did this:

diff all-packages base-packages > added-packages

...to get a list of the ones I'd need on the new system.

To make a simple list of packages, I did this:

cat added-packages | awk '{print $2}' > addons

...to make a list consisting of only package names.

Then I wrote a shell script (restore-packages) that looks like this:

#!/bin/sh

while read pkg
do
apt-get -y install $pkg
done < addons

Then I updated the /etc/apt/sources.list file to include Debian repositories not included in Ubuntu (for licensing reasons), and ran "apt-get update" to update the list of available packages.

Then I just did the following (as root, using sudo):

./restore-packages; apt-get upgrade

...and went to bed.

This morning, the machine was configured with everything I had in the old installation. Apache, Fonts, iPod tools, decoders/encoders for MP3, AAC, etc. were all present, configured, and working. The JDK installation required about 5 minutes of manual intervention. A little light bulb in the application bar was visible. When I clicked on it, it popped up a window that said, basically: "Your system upgrades involved a change to the kernel, so it would be a good idea to reboot at some point soon."

I can't imagine the process being any easier. I didn't burn a whole extended weekend doing it, and I now have a Linux box with tons of free space, and not a crumb of Windows anywhere on it.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home