Ubuntu 16.04: Customize Ubuntu Desktop Live CD/USB

Install Prerequisites

sudo apt-get -y install uck syslinux syslinux-utils
  • UCK needs a working directory. By default it is ~/tmp

  • All UCK tools require root privileges for mounting and unmounting

  • When this is done, the root filesystem will be located in ~/tmp/remaster-root

Mount source ISO image

sudo uck-remaster-unpack-iso ubuntu-16.04.4-desktop-amd64.iso
sudo uck-remaster-unpack-rootfs

Change root to the image filesystem. Now you can install packages using apt-get

sudo uck-remaster-chroot-rootfs

Now you can create the remastered ISO image. You MUST exit from the chroot before creating the ISO. Remastered ISO file can be found under ~/tmp/remaster-new-files

exit
sudo uck-remaster-pack-rootfs -c
sudo uck-remaster-pack-iso aziro.iso -h -g -d "Aziro Ubuntu"

Useful Commands

Remove software that you don't need

apt-get remove libreoffice-core libreoffice-common thunderbird --purge -y
apt-get remove unity-lens-shopping unity-lens-applications --purge -y
apt-get autoremove --purge -y

You can see the installed packages using dpkg command

dpkg --list

Check the packages which takes up the most space

dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n

Only the Main and Restricted repositories are enabled by default for apt-get in the image. If you are also running Ubuntu on your host computer, you can fix that by copying the hosts' sources.list to the image root before running uck-remaster-chroot-rootfs

sudo cp /etc/apt/sources.list ~/tmp/remaster-root/etc/apt/sources.list

References: