Monday, May 13, 2024
95
rated 0 times [  95] [ 0]  / answers: 1 / hits: 143791  / 2 Years ago, sat, december 11, 2021, 6:51:00

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.


More From » system-installation

 Answers
7

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.


[#39263] Sunday, December 12, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
fertion

Total Points: 436
Total Questions: 121
Total Answers: 156

Location: England
Member since Sun, May 21, 2023
1 Year ago
fertion questions
Thu, Mar 9, 23, 06:46, 1 Year ago
Thu, Jun 17, 21, 01:06, 3 Years ago
Mon, Jun 13, 22, 07:30, 2 Years ago
Fri, Mar 10, 23, 12:13, 1 Year ago
;