I extremely customized Ubuntu to the core to create my own distro. But I don't know how to create an installable iso for it. Does anyone have an idea how?
- Package your changes
- Include your package in your iso
Designing the package
I expect your package to contain five things:
- New configuration files
- Scripted customizations to existing configuration files
- Scripted commands
- Required Dependencies
- Convenient Dependencies
New configuration files are easy to install as part of a package. Simply add them to your package. If you've changed a file such as
/etc/apt/sources.list, try to put your changes in
/etc/apt/sources.list.d/. Don't deploy your own version of
/etc/sudoers expecting it to override the version deployed by sudo. Your package will be in conflict and fail to install.
If you really need to make changes to an existing configuration file, add it to your
postinst script. Make an attempt to undo the change in the
prerm script. Here are some examples:
echo "192.168.1.1 router" >> /etc/hosts sed 's/PasswordAuthentication yes/PasswordAuthentication no/' -i /etc/ssh/sshd_config
If you need to run any commands (such as
realm) then you should also do that in
You can also add dependencies to this package. If you've made a change to
/etc/ssh/sshd_config, then you probably want to depend on
openssh-server which ensures that file is installed before your script works on it. You can find which packages own each file with
dpkg -S /path/to/file.
You can also add dependencies on packages you know you want in your custom config. If you like chromium and know you'll want that installed everytime you use this image, then go ahead and add a dependency on chromium to avoid the need to manually
apt-get later on.
Making the package
dh_make will make a template for you so you can add the files you like and then use
dpkg-buildpackage to produce the
*.deb file. Understanding all of the options is a little daunting and takes time to study and understand, but it's how native debian/ubuntu packages are produced.
cpack uses a
CMakeLists.txt file to define the rules. Add files to your package with the
install() command and
CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA will help you define your postinst. I find
cpack was easier to learn, especially for trivial packages.
Once you have a package, boot up a new Ubuntu (maybe use a chroot or vm), then test your package by installing it with
dpkg -i. If your system is how you want it, then you've succeeded. Now you can take a basic ubuntu installation and customize it all by installing this single package.
But I see you want to go further... You don't want to run that one command, you want to get this customization out-of-the-box. You can!
You'll need to generate the installation disc in the same way Debian or Ubuntu does it, but add you're own package to the disk and set it to auto-install.
I like the other answer and there is more than one way to solve this use case.
Have you checked out this: https://help.ubuntu.com/community/LiveCDCustomization ?