How to Install a Linux Distro: Image is Everything

7267

Image is everything in Linux, but perhaps not in the way that you think.

If there’s one thing all Linux users have in common, it’s installing distros from ISO images. Whether your favorite distro’s digital DNA evolved from the Debian, Slackware, Gentoo, or Red Hat families. Or whether you got the ISO from a download, a purchased CD/DVD/USB, or packaged with a book or magazine. The distro you installed on your hard drive came to you in the form of an ISO image.

Linux Knoppix logoA Live CD/DVD image has all the files, the file system, and the metadata your hard drive needs to run Linux in some specific software configuration from a CD/DVD, without installing it to your hard drive. A Live CD/DVD is often also an installable image, containing files and instructions that lead you through the process of installing Linux to your hard drive. Clearly, in the Linux world the expression “Image is everything” has a very different meaning than it does on the public scene.

KNOPPIX

A good example of just how “Everything” an image can be is best illustrated by Klaus Knopper’s KNOPPIX distribution. On a single CD of 700MB capacity he has compressed an image that originally consisted of some 2GB of data. Using on-the-fly decompression, that one CD boots a full-scale Linux desktop system with a rich variety of applications including (if you have the graphics to handle it) all the spectacular bells and whistles of Compiz, which adds cool special effects to your Linux desktop.

KNOPPIX can even be run with the boot code toram, which releases the CD and runs just as fast as your CPU can handle it, because the entire image exists in the memory itself. It is not on the hard drive, as is the case for an installed image. The speed has been achieved by bypassing any physical media from which the image file must be read, even a tiny bit faster than an SSD. However, when you shut your computer down, the image vanishes with the power.

So why not just run KNOPPIX and forget about installation? You could – I’m sure some people do; even some web hosting services run KNOPPIX on their servers. Of course if those servers shut down, the owners have a lot more to worry about than just refreshing their operating system. For the rest of us, we need something more tangible than a disembodied image.

Compressed Magic

That is where the CD comes in. In 1988 the ISO (in this case, the initials are from the French of International Organization for Standardization) established the ISO 9660 file system for optical disk media which allowed for exchanging data across different platforms. That file system can handle all the properties of a disk image and your computer can read them directly from the disk. To form the image of an operating system on the CD (or more often these days, the DVD), a running system is cloned and transformed into one big archive file in the Compact Disk File System, or CDFS.

That file is smaller than the original system was on the hard drive from which it was taken, because all the unused spaces within the files on the original drive have been eliminated – the files have been compressed, and will have to be expanded again to make it something that can run from the hard drive. Installation consists of transforming the archived contents into a system appropriate for a hard drive, arranging the results on the drive, and establishing a way to select the resulting operating system from any others on the hard drive.

All of the statements above apply equally well to a CD, a DVD, or a USB flash drive (or for that matter an SD card or…). In each case, the vehicle for the image – the body of the ghost, as it were – is a tangible device that carries files in a form that can be read by your computer. But not just any part of your computer: It must have some means of entering the BIOS of your computer, of being introduced to the startup process as a candidate for controlling the operation of the machine.

That is called the boot process, and how it is enabled is a topic too grand to handle in such a short article as this. For the moment you’ll just have to allow that such a process can be written, the files for it can be coded in the proper file system, and that it can be recognized by your computer. It will be the first thing your computer assimilates from the physical device, whether it be a CD, a DVD, or a USB.

The CD, the dd, and the USB

That makes it really easy if you bought the device, or someone gave it to you, or you found it in a book or magazine. But if you downloaded the image from the web, you generally have to do something more to it before you can make it behave as an operating system. That means you do one of three things:

  1. If you have Ubuntu or another Grub2 distro, boot the ISO directly.
  2. Burn the ISO to a DVD (every distro includes a favorite disk burner)
  3. Transfer the ISO to a USB flash drive.

The first technique is a help if you want to see how well the distro runs on your specific machine without committing hardware to it (running the LiveCD version), but it is no more permanent than the KNOPPIX toram option.

The second is probably the most frequently used method. It gives you a CD you can use to reinstall, to rescue a later botched boot install (of course, that NEVER happens, right?), or pass along to someone else. It also tends to build up a prodigious stack of old CDs that are too useful to trash and and too bulky to keep (my second 50CD spindle is filling fast).

The third method is currently the fashion. For a long time it was a bit of a challenge to get an ISO onto a USB in a form most computers could handle, but with applications like Unetbootin and the older Disk Utility it became simpler. These are nice graphical programs for creating a bootable USB stick from any Linux ISO image. Lately a number of distros have presented their ISO in so-called hybrid form, which can be installed directly onto a hard drive that has been properly partitioned.

And there’s one more way, the easiest of all for the more courageous among us: Just dd the entire ISO onto the whole USB drive, not a partition:

$ dd if=zilch-1.0.42-desktop-amd64.iso of=/dev/sdX

Replace zilch-1.0.42-desktop-amd64.iso with the name of your ISO image, and /dev/sdX with the correct dev name of your USB stick, which you can find with the dmesg command:

$ dmesg
[26404.421977] USB Mass Storage support registered.
[26405.421596] scsi 6:0:0:0: Direct-Access     Kingston DataTraveler 2.0 1.00 PQ: 0 ANSI: 2
[26405.422980] sd 6:0:0:0: Attached scsi generic sg3 type 0
[26405.425453] sd 6:0:0:0: [sdc] 3944448 512-byte logical blocks: (2.01 GB/1.88 GiB)

So for this example, replace /dev/sdX with /dev/sdc. It will take dd a few minutes. When you’re done, you will have a live system you can either test-run indefinitely from the USB or install to your hard drive.

All this is made possible by the nature of ISO images: They are the means by which the essence of an operating system can be distilled down to a single large file. That file, in turn, can be communicated over the web like any other file; it can be embodied in a tangible medium and operated from it; and it can be installed on the hard drive of a computer. It is the means by which Linux is spread – no wonder that for Linux, image is indeed everything.