One CD disk, multiple Linux distributions: Netboot CD
Every Linux user, after a while, starts creating a toolbox that he/she takes with him/her everywhere. However, that depends on the task at hand. You might need to install a distribution, you might just need a livecd, doing security-related work or just backup. And so the toolbox gets bigger and bigger, thus becoming less and less convenient. The subject of today's article is NetbootCD. NetbootCD is not a supplement for a live Linux environment, but rather it is designed to help you install multiple Linux distributions using a single multiboot disk as oppose to requirement of 7 Linux installation disks.
In this sense NetbootCD is a CD disk that will allow you to netinstall various distributions by offering you a simple menu so you can choose distro/version and other simple options. From this reason a decent Internet connection is absolute must. You will only need the knowledge to install your distribution of choice, which nowadays is a walk in the park, with simple and easy to use installers present in many Linux distributions. We will show you how to use the NetbootCD and also how to hack it in order to add more distributions to the list, provided you have some scripting knowledge. Actually, you can use the disk also as a basic live Linux distribution, but more on that later. If you still have some questions after reading this article please try our new LinuxCareer Forum.
2. Getting NetbootCD
NetbootCD is based on Tiny Core Linux, so you won't have to get some huge ISO. One can download disk images from here and put it on a CD. There is also an option to put it on floppies, but that will not be dealt with here, since floppies are error-prone and almost extinct. The above link will guide you, however, should you really want to choose the floppy way. We recommend at least 512 MB of memory, more with Fedora, because the kernel and initrd images of the distros you choose will be downloaded to RAM. Now, let's see what we get with NetbootCD.
3. Using NetbootCD
As seen on the project's webpage, you can use NetbootCD to install Ubuntu, Debian (stable, testing and unstable), Fedora, OpenSUSE, Mandriva, Scientific Linux, CentOS and Slackware. We will take each distro and tell you a few words about it, plus we will teach you, as previously said, how to add your favorite distro to the list, provided it's a binary distro and you can netinstall it.
When you boot the CD, you will be greeted with a simple menu, letting you choose from HDD boot or CD boot.
The next menu, the main menu, will let you start choosing the distro to install over the 'net or take care of some of the available settings first. We suggest you select [d]ownload first, in order to be up-to-date with the installation script. If the aforementioned choice of distributions suits you, just select [i]nstall. Else select [q]uit so you can get to a prompt and start editing the install script, but we won't get to that just yet.
If NetbootCD doesn't detect an active network connection (wireless is not supported out of the box), like DHCP, you will be dropped to a prompt where you will have the chance to set a static connection by using /sbin/ifconfig. Then run
$ sudo /usr/bin/nbscript.sh
to get to the main menu as pictured above. The [u]tils menu contains grub4dos, so you can fix bootloader issues, and TinyCore Linux, normal and small (!) versions. If you have a syslinux (the bootloader used by NetbootCD) .cfg file you want to use, the [s]cript option helps you. Using [q]uit will not reboot, but will drop you to a terminal. Anyway, for now we assume you want to install a distribution, so let's get to the [i]nstall option.
In our example we installed Ubuntu via NetbootCD, but we'll give a few comments about the other distros before we continue.
When selecting Debian (32 or 64-bit or the daily installers as provided by Joey Hess), you are asked what flavor you want to install, or if you want to select the address of the installer manually. We selected Debian 32 unstable and encountered no problems.
Here we can install Fedora 13, 14 or 15, but we couldn't find a 64-bit option, only 32-bit. However, you will be asked to confirm the address where NetbootCD can find the installer, and replace 'i386' with 'x86_64'. If you decide to go with Fedora 15, make sure to have at least 768 MB of RAM in order to use the installer, or just edit anaconda, which is just a Python script, and look for the check_memory function. However, expect slowness or OOM errors if you have less than 512 MB. And you didn't hear this from me.
The 32-bit issue is found here too, and the solution is the same: just edit the script and you're set. You will be greeted by a CLI window asking you for CD1 of the installation set: just choose Back and opt for HTTP installation, configure your network, enter the HTTP server's IP (we used 22.214.171.124 - download.opensuse.org), path (/distribution/11.4/repo/oss) and it should be ok (change 11.4 with the version you need). We tested this on a KVM machine with 512 MB RAM, so this has to do with the CLI interface on OpenSUSE and Fedora. If you have more memory, you will probably see a more pleasant, graphical interface.
Here we get the same issue with 32-bit, but no problem, as we've seen. The installation process is resemblant to OpenSUSE's, at least until the point we're interested in, but you already get a list of available HTTP servers, plus you get some of the values filled out for you, like the directory locations on the servers. One point scored by Mandriva.
3.5. Scientific Linux and CentOS
We treat these two distros together as they're both RHEL offshoots and there are only minor differences. As with Fedora, you can choose the location of the installer, but here you can choose 32 or 64-bit. You can also choose from RHEL 5 or RHEL 6 derivatives, making this the most complete option we found on NetbootCD, together with Ubuntu and Debian. We tried SL 64-bit and everything worked nicely, but since we only have 512 MB of memory, we had to go for the CLI install.
The website (of NetbootCD) warns you that Slackware can't be installed from a HTTP server, and so does the menu if you select Slackware. However, it's more like a warning, and you can choose the last three available Slackware releases, without being able to choose the architecture. You get to choose the kernel you want to boot and you can login as root (no password) to start setting up your disk. After you type 'setup', make sure you have the Slackware install hierarchy on a Samba/NFS/local drive.
Last but not least, our example Linux distribution, Ubuntu. Here we are free to use from 32- or 64-bit and choose from the latest four Ubuntu releases.
We went for Natty 32-bit and the install worked without a hitch. Now let's see how to modify the script we mentioned before to suit our needs.
4. Hacking nbscript.sh
Don't run away: it's only shell scripting, not Motorola assembly code, there are examples already, and the reward will be a system tailored to what you want and lots of satisfaction. The changes, of course, will not be permanent, but that is not a problem either: you can create your own NetbootCD remix, but how to do that will not be covered here as there are a lot of excellent tutorials.
You can use sudo on the live CD, since it's passwordless. You will need elevated rights in order to write to /usr/bin, so remember sudo. vi is the included editor, so let's do
$ sudo vi /usr/bin/nbscript.sh
and look inside the script. Let's say we want to have Mageia as a choice: we go to the installmenu() function and put a Mageia entry:
mageia "Mageia" \
Next you'll see a lot of if blocks for every entry. We have to add one of our own, using copy and paste to win some time (we chose Fedora as the model). We will use a simpler entry, since Mageia is a simple distro and doesn't have many releases (actually, just one).
if [ $DISTRO = "mageia" ];then dialog --backtitle "$TITLE --menu "Choose a system to install:" 20 70 13 \ 1 "Mageia 1" \ # The screenshot will show you a simple entry in the script for # Mageia 1 64-bit. This is really simplified for illustration, based on the Fedora entry, # especially as Mageia has only one released version. Modify to taste.
We found NetbootCD to be a very customizable and practical CD, with lots of uses, and as we can see, with minimal shell scripting knowledge, we can extend the list of available distributions to a more comprehensive one, as need arises. We hope you get a good kick out of playing with NetbootCD, but that you will also find it useful. We sure did.