{"id":21669749,"url":"https://github.com/dsgnr/ubuntu-16.04-unattended-install","last_synced_at":"2025-04-12T02:34:07.422Z","repository":{"id":56298347,"uuid":"97762297","full_name":"dsgnr/ubuntu-16.04-unattended-install","owner":"dsgnr","description":null,"archived":false,"fork":false,"pushed_at":"2020-11-16T07:49:16.000Z","size":13,"stargazers_count":52,"open_issues_count":0,"forks_count":14,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-12T02:33:27.978Z","etag":null,"topics":["bash","preseed","ubuntu"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dsgnr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-19T21:21:57.000Z","updated_at":"2025-04-08T15:56:12.000Z","dependencies_parsed_at":"2022-08-15T16:10:49.789Z","dependency_job_id":null,"html_url":"https://github.com/dsgnr/ubuntu-16.04-unattended-install","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsgnr%2Fubuntu-16.04-unattended-install","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsgnr%2Fubuntu-16.04-unattended-install/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsgnr%2Fubuntu-16.04-unattended-install/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsgnr%2Fubuntu-16.04-unattended-install/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dsgnr","download_url":"https://codeload.github.com/dsgnr/ubuntu-16.04-unattended-install/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248506941,"owners_count":21115512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","preseed","ubuntu"],"created_at":"2024-11-25T12:24:44.292Z","updated_at":"2025-04-12T02:34:07.417Z","avatar_url":"https://github.com/dsgnr.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ubuntu 16.04 Unattended-Install for UEFI using preseed\nCreate a Legacy and UEFI automated Ubuntu ISO installer. Using preseed.cfg and post-install scripts, this can completely automate installing Ubuntu 16.04. This may work with other distros, but I have yet to test this. Your personal variables such as default packages, SSH keys and username/password will obviously need to be edited before use.\n\nFollow the steps below to create your own image.\n\n    cd /root\n    wget http://releases.ubuntu.com/16.04.2/ubuntu-16.04.2-server-amd64.iso\n\n### Extract ISO\n    xorriso -osirrox on -indev ubuntu-16.04.2-server-amd64.iso -extract / custom-iso\n\n### Edit /boot/grub/grub.cfg\nThis is for UEFI booting. This specifies the timeout on the grub menu to 1 second, tells grub what network adapter to use and grabs the preseed file.\n\n    cd /root/custom-iso\n    nano boot/grub/grub.cfg\n\nReplace the contents with grub.cfg with the following. __Make sure you alter the HTTP location of your preseed file!__\n\n    if loadfont /boot/grub/font.pf2 ; then\n            set gfxmode=auto\n            insmod efi_gop\n            insmod efi_uga\n            insmod gfxterm\n            terminal_output gfxterm\n    fi\n    set default=0\n    set timeout=1\n    set menu_color_normal=white/black\n    set menu_color_highlight=black/light-gray\n\n    menuentry \"Install Ubuntu Server\" {\n            set gfxpayload=keep\n            linux /install/vmlinuz gfxpayload=800x600x16,800x600 hostname=ubuntu16-04 --- auto=true url=http://preseed.handsoff.local/ubuntu-16-04/preseed.cfg quiet\n            initrd  /install/initrd.gz\n    }\n\n### Edit /isolinux/txt.cfg\nIf you do not want to enable preseeding on a legacy device, this step isn't necessary.\n\n    nano isolinux/txt.cfg\n\nReplace the contents with the following. __Make sure you alter the HTTP location of your preseed file!__\n\n    GRUB_DEFAULT=0\n    GRUB_HIDDEN_TIMEOUT=0\n    GRUB_HIDDEN_TIMEOUT_QUIET=true\n    GRUB_TIMEOUT=1\n\n    default install\n    label install\n    menu label ^Install Ubuntu Server\n    kernel /install/vmlinuz\n    append preseed/url=http://preseed.handsoff.local/ubuntu-16-04/preseed.cfg bga=788 netcfg/choose_interface=auto initrd=/install/initrd.gz priority=critical --\n\n## Obtain isohdpfx.bin for hybrid ISO\n\n    cd ../\n    sudo dd if=ubuntu-16.04.2-server-amd64.iso bs=512 count=1 of=custom-iso/isolinux/isohdpfx.bin\n\n## Create new ISO\n\n    cd custom-iso\n    sudo xorriso -as mkisofs -isohybrid-mbr isolinux/isohdpfx.bin -c isolinux/boot.cat -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot -isohybrid-gpt-basdat -o ../custom-ubuntu-http.iso .\n\n## Confirm partitions\nAs we have created a hybrid ISO, meaning it can be used in both UEFI and Legacy modes, it's good to make sure EFI is showing in the partition table. You can check this by using the following command:\n\n    fdisk -l custom-ubuntu-http.iso\n\nIf the partitions have been created correctly, you should see something similar to the following:\n\n    Disk custom-ubuntu-http.iso: 841 MiB, 881852416 bytes, 1722368 sectors\n    Units: sectors of 1 * 512 = 512 bytes\n    Sector size (logical/physical): 512 bytes / 512 bytes\n    I/O size (minimum/optimal): 512 bytes / 512 bytes\n    Disklabel type: dos\n    Disk identifier: 0x19a15b31\n\n    Device                  Boot Start     End Sectors  Size Id Type\n    custom-ubuntu-http.iso1 *        0 1722367 1722368  841M  0 Empty\n    custom-ubuntu-http.iso2       4036    8899    4864  2.4M ef EFI (FAT-12/16/32)\n    \n## Preseed file\nUpload preseed .cfg file to location specified in grub.cfg/txt.cfg. As we have specified networking within the Grub menu, we are now able to pull the preseed file over network using DHCP.\n\n## User passwords\nYou can either encrypt your password, or pass it over plain text. If you want to use plain text, then comment the line `d-i passwd/user-password-crypted` and uncomment the two lines above containing `passwd/user-password` and `passwd/user-password-again`. __Don't forget to update your password__. If you would like to hash the password, enter the following line. This will prompt for a password and return a hash for you to use. You must then add your hash to the preseed.cfg file. \n    \n    mkpasswd -m sha-512\n\n## Post install script\n\nThe preseed uses wget to download your post-install.sh file to the /tmp folder just before the machine reboots after installation. My script does the following:\n\n* apt-get update \u0026\u0026 upgrade -y\n* apt-get dist-upgrade -y\n* Installs basic packages defined at the head of the script\n* Installs SSH keys for both the default user, and root. __You must edit the post-install.sh file to add your keys__\n* Edits /etc/sshd_config to allow root ssh access, as well as password authentication\n* Configures networking specified at the top of the script\n* Changes the hostname which is defined at the top of the script. \n\n_Unfortunately, there seems to be a bug in Xenial which ignores the hostname set in the preseed file. Therefore, a default hostname is set within grub to remove the prompt during installation. If you know a better way around this, please commit a PR!_\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsgnr%2Fubuntu-16.04-unattended-install","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdsgnr%2Fubuntu-16.04-unattended-install","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsgnr%2Fubuntu-16.04-unattended-install/lists"}