Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I need a CD or USB stick, that will install Ubuntu on a completely headless machine. Stick CD in and restart, no keyboard or screen should be involved.

There are a few obstacles:

  1. The language selection menu when you first boot the CD.
  2. The fact that the CD menu waits.
  3. The installer's asking questions during installation.
share|improve this question
    
Usefull link: help.ubuntu.com/lts/installation-guide/i386/… –  Nanne Feb 7 '13 at 16:10
    
So I did this. however with the new kickstart iso when I restart my ubunutu server I get the following error ubuntu failed to load file amd-ucode/microcode_amd.bin I tried to search for the file on my "regularly" installed ubunutu-server but I couldn't find it.. and I don't get the error message when I reboot it –  Rayman81 Mar 14 '13 at 18:16
add comment

2 Answers

up vote 23 down vote accepted

The complete solution is:

Remaster a CD, ie, download a non graphical ubuntu installation ISO (server or alternate installation CD), mount it

$ sudo su -
# mkdir -p /mnt/iso
# mount -o loop ubuntu.iso /mnt/iso

Copy the relevant files to a different directory

# mkdir -p /opt/ubuntuiso
# cp -rT /mnt/iso /opt/ubuntuiso

Prevent the language selection menu from appearing

# cd /opt/ubuntuiso
# echo en >isolinux/lang

Use GUI program to add a kickstart file named ks.cfg

# apt-get install system-config-kickstart
# system-config-kickstart # save file to ks.cfg

To add packages for the installation, add a %package section to the ks.cfg kickstart file, append to the end of ks.cfg file something like this.

%packages
@ ubuntu-server
openssh-server
ftp
build-essential

This will install the ubuntu-server "bundle", and will add the openssh-server, ftp and build-essential packages.

Add a preseed file, to suppress other questions

# echo 'd-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition \
select Finish partitioning and write changes to disk
d-i partman/confirm boolean true' > ks.preseed

Set the boot command line to use the kickstart and preseed files

# vi isolinux/txt.cfg

Search for

label install
  menu label ^Install Ubuntu Server
  kernel /install/vmlinuz
  append  file=/cdrom/preseed/ubuntu-server.seed vga=788 initrd=/install/initrd.gz quiet --

add ks=cdrom:/ks.cfg and preseed/file=/cdrom/ks.preseed to the append line. You can remove the quiet and vga=788 words. It should look like

  append file=/cdrom/preseed/ubuntu-server.seed initrd=/install/initrd.gz ks=cdrom:/ks.cfg preseed/file=/cdrom/ks.preseed --

Now create a new iso

# mkisofs -D -r -V "ATTENDLESS_UBUNTU" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o /opt/autoinstall.iso /opt/ubuntuiso

That's it. You'll have a CD that would install an Ubuntu system once you boot from it, without requiring a single keystroke.

share|improve this answer
1  
Thank you for the great explanation, very useful! I found however that one doesn't need to specify the preseed file, just the filled in ks.cfg file was enough (also specified the partitions etc in there through kickstart). [ubuntu 10.04 64bit] –  symaedr Apr 25 '12 at 15:08
    
@symaedr the source dir was missing in the mkisofs line, since I assumed you're running mkisofs from the root directory of the unpacked Ubuntu CD. Thanks for the kind words. –  Elazar Leibovich Apr 25 '12 at 18:36
    
I still seem to need to press enter when it boots up. –  Catskul Jul 10 '12 at 17:35
    
To bypass the need to press enter on boot change the timeout value from 0 to 10 in /isolinux/isolinux.cfg: timeout 10 Note that a value of 10 represents 1 second. –  digitalsanctum Feb 7 '13 at 14:16
    
Make sure copy the .disk folder from the CD or iso. Otherwise, you will get 'Incorrect CD-ROM detected' error –  Joe Kuan May 22 '13 at 20:11
add comment

Here is a shell script which performs this procedure, thanks for the introduction: http://www.utech.de/2013/05/shell-script-creating-a-cd-for-unattended-ubuntu-server-installations/

share|improve this answer
1  
Welcome to Ask Ubuntu! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  Oyibo May 14 '13 at 21:15
    
I see. The script you find following the link basically implements the procedure that Elazar described, so the essential parts are just a screen above. I added the link to save somebody some time, and to make it a bit easier to repeat this for other versions of Ubuntu. –  Michael May 14 '13 at 21:24
    
Please add the explanation from your comment to your answer. –  guntbert May 22 '13 at 20:20
add comment

protected by Community Sep 28 '13 at 13:47

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.