0

I'm looking for a way to create a Ubuntu 16.04 LTS auto-installer, as we're regularly installing new VM's, and the installation process (and some adjustments afterwards) are mostly the same for all installations.

Some things are custom, such as IPv4 and IPv6 addresses, hostname, root password

Is there an easy way to create a custom ISO (or other way) we can use for automatic installation?

  • Search “preseeding”. – Gilles Feb 3 '17 at 22:04
0

You didn't say which VM software you are working with so I'll keep this answer very general.

Note that there are far more efficient and cleaner methods but they are heavily dependent on the virtualization solution you're using. Check the documentation for imaging/cloning/snapshotting methods supported.


You should create a new VM disk image, install and configure Ubuntu completely to your liking but only settings which you want on all newly created VMs.

For example: omit network settings, don't add a user unless the username/uid happens to be the same every time you create new VMs.

Once you have your base VM set up, shutdown the VM.

On the host workstation you created the VM on, mount the filesystems from the disk image and zero out the free space in each partition.

This will do it on Linux host:

mnt is the mount point of where you mounted the VM disk image's partitions, which depends on where you actually mounted it.

dd if=/dev/zero of=/mnt/zerofile bs=1M conv=sync
rm -f /mnt/zerofile
umount /mnt

Once complete for each partition of the image, you can compress the image with your favorite compression utility.

xz -9 /path/to/disk.img

Now you can decompress copies of an almost configured disk image and finish the customized settings and deploy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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