henrydenhengst

ATTENDLESS_UBUNTU

Jun 29th, 2016
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.14 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # https://askubuntu.com/questions/122505/how-do-i-create-a-completely-unattended-install-of-ubuntu
  4. #
  5. # Create an unattended install of Ubuntu Server?
  6. # Remaster a CD, ie, download a non graphical ubuntu installation ISO (server or alternate installation CD), mount it
  7. # Check root privileges
  8. if [[ $EUID -ne 0 ]]; then
  9.    echo "This script must be run as root"
  10.    exit 1
  11. fi
  12. #
  13. mkdir -p /mnt/iso
  14. mount -o loop ubuntu.iso /mnt/iso
  15. # Copy the relevant files to a different directory
  16. mkdir -p /opt/ubuntuiso
  17. cp -rT /mnt/iso /opt/ubuntuiso
  18. # Prevent the language selection menu from appearing
  19. cd /opt/ubuntuiso
  20. echo en >isolinux/lang
  21. # Use GUI program to add a kickstart file named ks.cfg
  22. apt-get install system-config-kickstart
  23. system-config-kickstart # save file to ks.cfg
  24. # To add packages for the installation, add a %package section to the ks.cfg kickstart file,
  25. # append to the end of ks.cfg file something like this.
  26. #
  27. # %packages
  28. # @ ubuntu-server
  29. # openssh-server
  30. # ftp
  31. # build-essential
  32. # This will install the ubuntu-server "bundle", and will add the openssh-server, ftp and build-essential packages.
  33. #
  34. # Add a preseed file, to suppress other questions
  35. #
  36. echo 'd-i partman/confirm_write_new_label boolean true
  37. d-i partman/choose_partition \
  38. # select Finish partitioning and write changes to disk
  39. d-i partman/confirm boolean true' > ks.preseed
  40. # Set the boot command line to use the kickstart and preseed files
  41. #
  42. # vi isolinux/txt.cfg
  43. # Search for
  44. #
  45. # label install
  46. #   menu label ^Install Ubuntu Server
  47. #   kernel /install/vmlinuz
  48. #   append  file=/cdrom/preseed/ubuntu-server.seed vga=788 initrd=/install/initrd.gz quiet --
  49. #   add ks=cdrom:/ks.cfg and preseed/file=/cdrom/ks.preseed to the append line.
  50. # You can remove the quiet and vga=788 words. It should look like
  51. #   append file=/cdrom/preseed/ubuntu-server.seed initrd=/install/initrd.gz ks=cdrom:/ks.cfg
  52. #   preseed/file=/cdrom/ks.preseed --
  53. # Now create a new iso
  54. #
  55. 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
Advertisement
Add Comment
Please, Sign In to add comment