As Videonauth pointed out, a custom installer would be a better solution. You can even make an unattended one so that it just installs without asking a bunch of questions.
With that said, according to some instructions, you can create a custom .img
file fairly easily, though it won't be geared toward the hardware on your machine and the partition and so on will be pretty small:
- Download an official Ubuntu
.iso
file that works on the machines you'll be using
- Install VirtualBox to your current operating system
- Create a virtual machine with an acceptable hard drive size (keep in mind that this should be small enough so that the resulting
.img
file fits on your installation medium).
- Insert the Ubuntu installer
.iso
file into the virtual DVD drive
- Boot the virtual machine
- Install Ubuntu onto the virtual machine
- Start the virtual Ubuntu machine
Update virtual Ubuntu's Ubuntu packages with:
sudo apt update
sudo apt dist-upgrade
Install packages you want
- Configure non-hardware-related things
- Get things set up the way you want
- Restart the virtual Ubuntu
- Shut down the virtual Ubuntu
- In the
File
menu of VirtualBox, select Virtual Media Manager…
- Right click on the appropriate hard drive image and select
Properties…
- Copy down the
Location
information
- Open a command prompt
Create the .img
file; in a command prompt on your nonvirtual operating system, run:
cd Desktop
VBoxManage clonehd --format RAW "[hard drive image location]" "[img filename].img"
The .img
file should be on your desktop
.img
file. It won't create an installer, but a real hard drive image. – Chai T. Rex Sep 23 '18 at 15:40