Slashdot Mirror


Automatically Installing Linux from Bootable CD?

phorm asks: "While there are newer many distributions of linux that come bootable from CD, I've found that some are a bit difficult to customize and wonder how hard it would be to create my own. Currently we are looking at replacing some of our Windows desktops at work with Linux test-machines - and it would be nice to make the installation process as simple as possible. How hard would it be to create a bootable CD that would automagically install Linux onto the first detected hard-drive? How would you go about 'imaging' an existing machine to use as the base? I suppose that in many cases a tar-gzip of the entire OS would work, provided you could partition the drive correctly, recreate some important handles as in /proc, and run lilo/grub to install a boot loader. Does anyone here have experience with this? I know morphix/knoppix make nice bootable distros but what I really want is a basic Linux bootCD which installs a preconfigured version of the OS of my choice."

36 of 85 comments (clear)

  1. Knoppix by lortho · · Score: 4, Informative

    The Knoppix live CD distro comes with a script for installing to the hard drive that works pretty well, just go to a root console after booting off the cd and type 'knx-hdinstall'. It probably wouldn't be too hard to customize the disk so that it does this automatically.

  2. Ghost by Webmoth · · Score: 2, Informative

    Symantec/Norton Ghost works very well for mirroring drives.

    However, you may have issues when it comes to differing hardare in different machines, and all your boxes will have the same hostname and IP address.

    --
    Give me my freedom, and I'll take care of my own security, thank you.
    1. Re:Ghost by ottawanker · · Score: 4, Insightful

      ..and all your boxes will have the same hostname and IP address. Or, you could use DHCP.

    2. Re:Ghost by Oriumpor · · Score: 3, Insightful

      On imaged systems, it's a bad idea for them not to access the network on first boot.... that means legwork after the image process. I would recommend configuring a DHCP client (with DHCP assigned hostname.)

      For me, this is all I need, as each machine can be assigned statically via the DHCP server.

      Still, IMO Kickstart is a much better methodology. Still better is PXE controlled kickstart mini-distros.... (Ala Ghost/Image Blaster Image partitions.) But I have yet to see someone do this.

    3. Re:Ghost by jsse · · Score: 2, Informative

      How about a Linux solution? Mondo

  3. Gentoo can do it by Apreche · · Score: 3, Informative

    The gentoo livecd is high quality. And on any gentoo system you can emerge the tools used to create the livecds. Create your own custom livecd and go at it. Of course knoppix and such can do it, but the knoppix installer is very primitive and set in stone. By making a custom gentoo livecd you can actually make the system the way you want it to be.

    --
    The GeekNights podcast is going strong. Listen!
    1. Re:Gentoo can do it by nathanm · · Score: 2, Insightful

      I'm a very happy Gentoo user myself, but I can't imagine an installer much more primitive than Gentoo's. And from the original questions, it sounds like creating the custom livecd would be much more complicated than they're asking for.

  4. Check support databases by MrResistor · · Score: 4, Informative

    I found this with a simple search of Suse's support database. I just skimmed it, but it seems to lay out the whole procedure. I'm sure your distro of choice has a similar page. While I haven't tried this myself, I know people have been doing it with Red Hat and Mandrake for years.

    --
    Under capitalism man exploits man. Under communism it's the other way around.
  5. Kickstart by baywulf · · Score: 5, Informative

    You can do this with Redhat Linux (or Fedora.) It is basically a utility called kickstart that creates a configuration file that you can place onto the cd or a floppy. Then when the install takes place, it will automatically make choices based on the configuration file.

    1. Re:Kickstart by hdparm · · Score: 2, Interesting

      This probably isn't much of an issue anymore on FC1 and RH9, as it was with older releases but to achive completely unattended install, good idea would be to trial normal (of the CD) one and get entries for detected hardware and desired packages to be installed. This way file /root/anaconda-ks.cfg (created by installer and available after first reboot) can be almost entirely reused, with only alteration required for the line describing install method (change cdrom to whatever type of network install would happen). Also if one figures that some hardware is not detected properly, manual changes can be done and ks file entries changed accordingly as well.

  6. Google by tsa · · Score: 2, Funny

    Maybe /. should have an 'Ask Google' next to 'Ask /.'

    --

    -- Cheers!

    1. Re:Google by dotgod · · Score: 3, Funny

      What is this "Google" you speak of?

    2. Re:Google by tsa · · Score: 3, Funny

      Maybe you should Ask Slashdot!

      --

      -- Cheers!

  7. Mepis!!! by mabhatter654 · · Score: 4, Interesting

    You want Mepis [www.mepis.org] It's a knoppix-based Live CD distro that works as both a live CD and an installed distro. It's designed with a few of the Knoppix kinks worked out so that the LiveCD can "help" the installed version out when their's trouble...perfect for corperate environments. Also, it's based on Debian...so you can always get your favorite stuff if you get bored/ need special configs!

    1. Re:Mepis!!! by QuantumG · · Score: 2, Interesting

      I just bought a copy, I'm that impressed. This is truely the way installation should be done. No crappy half working X11 in 16 colours. No half-assed mouse support. And best of all, I can keep using my computer during the installation.

      --
      How we know is more important than what we know.
  8. Mondo Works for me. by madstork2000 · · Score: 4, Interesting

    Try Mondo Rescue / Mindi http://www.microwerks.net/~hugo/

    It can create a bootable CD image. Essentially, it can be used to clone/backup a harddrive. I use it to setup a customized distro. Using the recue CD your "install" image can be put on bare hardware and be up in running in less than 20 minutes. If you are using a distro with KUDZU, after the first boot it will recognize your hardware.

    I have been very pleased thus far, it has allowed me to build "base" configuration of dedicated servers and quickly migrate data and test new hardware.

    -MS2k

  9. Don't use CDs by hbackert · · Score: 5, Informative

    If possible, use the network. If those PCs have PXE to boot from, that is by far the easiest and customizeable way to install lots of Linux machines. Using RedHat's kickstart, I can install a basic server in about 5 minutes, plus 5 minutes to configure everything for that machine. It's thus faster than CD and easier and easy to customize. No need to burn a new CD.

    1. Re:Don't use CDs by larien · · Score: 2, Interesting
      Yup, one of the best things about Suns systems is that once you have a jumpstart server set up, installation on a client is simply stop-A, boot net - install. You then walk away, come back later (anything between 30 minutes and a few hours, depending on hardware config and number of patches) and you've got a fully configured server.

      The main advantage of a network install of anything is that a config change to the installation image is as simple as modifying a file (or files) on a network server; with a CD, you have to change the file, burn the CD and test. If the change doesn't work, you've got a coaster.

  10. Mepis by Cipster · · Score: 2, Interesting

    MEPIS would be a great choice.
    Debian based, runs off the CD and the install consists of double clicking on a shortcut on the desktop, answering 2 or 3 questions and waiting for everything to be installed.

  11. One really quick, dirty way to do it by dougmc · · Score: 3, Informative
    Install a system, configure it the way you want it. Don't install too much stuff, because it needs to fit on a CD.

    Once done, boot into single user mode.

    tar everything up to *another* disk (mounted here under /mnt) --

    cd /
    tar --one-file-system --sparse -zcvvvf /mnt/disk.tar.gz /

    If that file doesn't fit on a CD with at least 10 MB to spare, remove some stuff and try again. export GZIP=9 might help a bit too.

    Get a bootable linux floppy disk image. It doesn't really matter which one, but it does need to have a real filesystem on it (not just a kernel.) Your typical rescue disk will probably work well.

    Make a script to install. It'll be something like this --

    #!/bin/sh -e
    # zero the partition table
    dd if=/dev/zero of=/dev/hda bs=1024 count=10
    sync
    sleep 3
    sync
    # create a 1024mb / partition
    printf "n\np\n1\n+1024m\nw\n" | fdisk /dev/hda
    # create the filesystem
    mke2fs -j /dev/hda1
    # mount it
    mkdir /m /n
    mount /dev/scd0 /cd
    mount /dev/hda /m
    # dump your tar.gz file to the new fs
    cd /m
    tar --totals --preserve --sparse -zxvf /cd/disk.tar.gz
    cd /
    # (re)install the bootloader
    echo "/sbin/grub-install /dev/hda" | chroot /m /bin/sh
    # clean up
    umount /m
    umount /cd
    echo "Ok. Time to reboot!"
    and then this script will replace /sbin/init on your boot floppy. Of course, if your floppy starts something other than /sbin/init, you'll need to replace that.

    Then you'll burn a cd that contains that floppy image as the el Torito boot image, and has that file.tar.gz in the root of the file system.

    This is really rough, and will only work properly with rather specific hardware, but it may get you started. Making a proper distribution is a lot more work than this -- I only spent a few minutes typing this out.

    I have not tested any of this. In particular, the command to do the fdisking probably has issues -- for example, most boot floppies don't have printf by default (you'll need to add it, or a script to just print all the fdisk commands), and I probably got the order of some stuff in the printf statement wrong (it's a string of commands for fdisk.) And of course it'll happily trash whatever is on your disk with no warning. (Installing lilo rather than grub can be done with a similar procedure if needed.)

    But if you're looking for a really quick and dirty way to install lots of identical machines, this may get you started. This is NOT a procedure for anybody who doesn't really understand what all this stuff does and the possible problems -- I just provided it as a first stab at a possible solution under some limited conditions. Note that the general idea can apply to other OSs as well -- I even remember once making a setup that installed OS/2 (off a network share) just like this -- long before Ghost was a gleam in Norton's (or whomever's) eye.

    In any event, I'd suggest seeing what Knoppix has to offer -- if, like another poster suggested, they have a script to just install to a disk, that would probably be far better than this hack.

    1. Re:One really quick, dirty way to do it by dougmc · · Score: 2, Informative
      Already, one typo --
      mount /dev/hda /m
      That would need to mount /dev/hda1 /m, of course. There's probably more typos.

      No, I don't really expect anybody to actually do this -- there's already much better stuff out there. But several years ago, before all those smart people solved the problem elegantly for you, this was one way that people would solve problems like this -- with a nasty `one off'.

  12. Try systemimager by chriskenrick · · Score: 3, Informative

    If you're looking for a "Ghost" like solution, try SystemImager. Should work well if your hardware is fairly standardised.

  13. Use Kickstart. by Thalin · · Score: 4, Informative

    As a couple other people have said, Kickstart is probably your best option. I work at NCSU and we have a bunch of linux machines. When we need to upgrade or reinstall, we just take a boot cd, pop it in, and let it go. It grabs all the configuration and install files off our kickstart server and goes to town. When it's done, the system reboots and sits at a login screen, no other config required. It's a beautiful thing.

    --
    What? You want a sig?
  14. I've done this... by .@. · · Score: 4, Insightful

    I've done something like this for work. Created a custom bootable Linux CD (SuSE 8.2-based), with all the necessary drivers for the hardware it'd run on.

    Then, I have an image server elsewhere on the network, full of dd images of various installs. So, when I build a new machine, I simply boot from the CD, and then pipe dd through ssh ("ssh remotehost 'dd if=foo.dd' |dd of=/dev/sda"), and within an hour (they're 18GB images), the new system is built.

    I can use the same process in reverse for imaging an existing system (or simply use the ssh-piped dd on a live system), to create the stored images.

    I spent so much time rewriting bits of systemimager that I got frustrated. Finally, I ran into hardware systemimager wouldn't support out-of-the-box (devices that only had drivers in 2.4, and SI's 2.2-based), and figured since I was going to have to build a new bootable ROMfs anyway, I may as well make a bootable CD and ditch SystemImager altogether.

    --
    .@.
  15. Catalyst by Shwag · · Score: 4, Informative

    The new gentoo image creation program, called catalyst, does exactly what you are looking for.

  16. Re:For god's sake... by lortho · · Score: 5, Insightful

    Come on, people, enough of the 'just search Google, n00b' mentality - I mean, sure, any one can go search Google for "custom linux boot cd" and get a hundred possible options, just like anyone can search the yellow pages for a doctor and get a list of a hundred names; But people post questions here to see what experiences real, tech-savvy people have had with potential solutions, much like one might ask friends/family members about their experiences w/ certain doctors, in order to make a more educated decision. So next time you see a question like this, don't scorn the poster for wasting your time - be flattered that they have come to seek your personal expertise!

  17. I did this with Slackware by severett · · Score: 2, Informative

    Slackware's simple package and configuration setup made this fairly painless.

    What I did was modify the initrd ram disk to change the custom setup files. I created my own which partitioned the drive, formatted, and started installing packages.

    I modified a couple packages to use defaults the way I liked them, reburned the CD and voila. Perfectly installed systems every time.

    Slackware uses shell scripts exclusively so it's quite easy to figure out what happens when.

  18. What distro do you want to use? by ComputerSlicer23 · · Score: 3, Informative
    I've built a RedHat kickstart CD that loads the kickstart file via HTTP of a web server. You can write a pre-install script to massage the disks (using either python or shell, probably anything you want, but python and shell are the only to utilities I know are there, in shell you are limited to mostly busy box utilities).

    You can use the redhat-config-kickstart to help you build a default install package set (and to build the kickstart file).

    Then you can run a post install script (also specified in the kickstart script). Generally, I always make my pre/post scripts wget the script I really want them to run. This gives me a bit more flexibility. (Actually I've never written a pre-install script, only posts).

    In the post install scripts, I've used wget to download the set of scripts/config files I wanted to replace (I recommend using a tarfile that you unpack from the filesystem, use diff to apply patches to all of the config files, or use sed to edit the config files).

    From there, it's relatively simple matter of deciding what you want changed and how you want it to work. I generally make sure to install AutoRPM, and the autorpm config files that point to my local package repository. Thus anything I can make into an RPM, I can get deployed onto remote machines in mass. I create one extra AutoRPM package pool for each class of machine, so I can put custom packages by machine type onto each machine.

    Either use PXE boot, or boot from CD. The CD image to do a kickstart style install is on the first RedHat CD. Look for the isolinux directory and create your own ISO (if you edit the files to put ks=http://kickstart.server.com/kickstart/file, then it's completely unattended). Or you can use the prebuilt images in /images, but then you have to fiddle with the command line a bit from CD. I've never done a PXE boot for installation of a machine (used it for building X-terminals, but not for this).

    Kirby

  19. Morphix = modular by Louis+Guerin · · Score: 2, Informative

    Knoppix and Mepis are both good, but Morphix seems like it's best suited to this sort of thing. It is designed to be modular, meaning you can *very* easily build an iso to custom requirements. It has solid hardware detection, and has the built-in capacity to execute a script once it's finished booting, so you could write an installer script to install, configure and reboot the box without intervention. Hell, you could even have it apt-get update && apt-get -y upgrade if you wanted.

    MHO.

    L

  20. Debian: Fully Automatic Installation by korpiq · · Score: 2, Redundant

    FAI (http://www.informatik.uni-koeln.de/fai/) is a system that can be used to automatically install Debian on any kinds of different machinery (you define the differentiating classes yourself). Documentation on its site states that "Booting and installing from CD-ROM is in progress".

    If you happen to need that level of complexity, maybe you can lend in a helping hand for them to finish that CD-ROM version.

    Just thought FAI would deserve to be mentioned here along with all the others. It might very well be overly complex for your purposes.

    --

    I think, therefore thoughts exist. Ego is just an impression.
  21. Cool hack :) by korpiq · · Score: 2, Informative
    You really make it sound simple. Sure there'll be problems like really getting the image to boot, but a few trials-and-errors should get those right. And a plain approach such as this spells out total control, a pair of words every root should love.

    As for the partitioning (printf) problem, I'd save a partition table with sfdisk -d /dev/hda >partitions.txt, and restore it with sfdisk /dev/hda <partitions.txt. If you have clients with different-sized disks, leave a partition (say, /home or /scratch) out, and after running sfdisk do something like

    fdisk /dev/hda <<EOT
    n
    l
    <newline>
    <newline>
    w
    EOT


    (notice the two empty lines to use defaults for partition start and end - will use the rest of the disk.)

    Also notice that tar --one-file-system already creates the directories (/proc, /usr, ...) to use as mount points for subsequent filesystems, no need to handle them specially. Of course if the original file system consists of several partitions (like a separate /usr or /var) you'll need to run one tar --one-file-system for each of them - spanning several file systems with one tar command will force you to explicitly exclude sources like /proc, /home, /tmp that should not be copied. Whatever suits you best.

    Also note that even while files under /var/log and /var/run should not be copied, subdirectories therein should be.

    If you choose this 'roll your own dirty solution' I'd like to hear about your experiences.
    --

    I think, therefore thoughts exist. Ego is just an impression.
  22. Not for the newbies by Crayon+Kid · · Score: 2, Insightful

    There are many already available solutions from established distro's out there. Use one of them, like the previous posters suggested. Making a custom boot CD to be used for rescue/backup is not exactly easy for a Linux newbie, since it requires a fair understanding of the operating system's inner workings. Sure, there are tutorials and examples out there, that's how I've learned too, but my guess is that in a corporate environment you can't afford to lose time in this manner.

    --
    i ate crayons when i was a kid and now i have two braincells and the blue ones taste nicer
  23. Kick Start by floydman · · Score: 3, Informative

    At work we have something around 500 Linux desktops, and almost 1K cluster nodes, all of them are installed using Kisck start(well almost all of them). Very neat and good effort, should try it out.

    --
    The lunatic is in my head
  24. The important thing.... by MarkusQ · · Score: 2, Funny

    The important thing is how you lable the CD once you've made it. I would recommend something like:

    Hands-off raw load
    For mature audiences ONLY
    Then you won't have to worry (if you leave it laying around) that someone might stick it in their system not knowing what it was.

    -- MarkusQ

    P.S. If you include X you may want to note that as well.

  25. Sisuite by prefect42 · · Score: 2, Informative

    Sisuite Nuff said. It'll do network or CD based installs.

    --

    jh

  26. Thank you by phorm · · Score: 2, Interesting

    "Google" answers are always annoying, nice to see somebody put the google trolls in their place.

    Indeed, they are trolls for if they had read the question, they would have noted that I have looked at both knoppix/morphix and found them not quite what I wanted (so obviously I have been checking around before slashdot). Freshmeat has some projects too, some of which I've tried, but none of them quite did what I want either (some came close though).

    Google is a great resource for generic information. Slashdot is a better resource for asking people with experience in what is a "good" solution as opposed to a "possible" one. Thanks for the support.