Creating A Custom Kali ISO
Last updated
Was this helpful?
Last updated
Was this helpful?
An Introduction to Building Your Own Kali ISO
Building a customized Kali Linux image is not as complex as you may be thinking. It is easy, fun, and rewarding! Kali Linux traditionally, has been a Live Image, but since an Installer Image was introduced. Both these images have , and are also built in different ways.
Live Image - allows you to try Kali, without altering the system (making it great for ). It is created using
Installer Image - allows for you to customize Kali by picking packaging during installation, such as picking the as well as what get installed. This image is powered by (which uses debian-cd
to make Debian-Installer
).
You can configure virtually any aspect of your Kali ISO build, such as adding packages from outside of Kali network repositories, unattended installations to changing the default wallpaper. Our build-scripts provides a framework that uses a configuration set to automate and customize all aspects of building the images. The Kali Linux development team use the same build-scripts to produce the official Kali ISO releases.
Where Should You Build Your ISO?
Ideally, you should build your custom Kali ISO from within a pre-existing Kali environment, as there is less chance of items going wrong. However, it is possible to generate the images on a Non-Kali but still a Debian-Based system.
Kali EnvironmentGetting Ready - Setting Up The build-script Kali System
We first need to prepare the Kali ISO build environment by installing and setting up the required packages with the following commands:
Building an Updated Live Image
Now you can simply build an updated Kali ISO (with our default configuration) by entering the live-build-config/
directory and running our build.sh
wrapper script, as follows:
The build.sh
script will take a while to complete, as it downloads all of the required packages needed to create your ISO. Good time for a drink.
Building an Updated Installer Image
By default, it will generate a Live Image. If you want an Installer Image, add --installer
:
We are using the --verbose
to output more on the screen rather than it being captured in just the build.log
output. If you want even more output, you can use --debug
instead, which will then give even more information.
Non-Kali Debian-Based EnvironmentSetting Up The build-script Non-Kali Debian-Based System
You can build an Kali ISO on a Debian-based systems other than Kali Linux. The instructions below have been tested to work with both Debian and Ubuntu.
First, we prepare the system by ensuring it is fully updated, then proceed to download the Kali archive keyring and packages:
Note: You must check thatkali-archive-keyring_20YY.X_all.deb
& live-build_20YYMMDD+kaliX_all.deb
are the latest files.
With that completed, we install some additional dependencies and the previously downloaded files:
With the environment all prepared, we start the process by setting up the build-script profile and clone out the build config:
At this point, depending on the host OS and its version, we may need to edit build.sh
to bypass a version check for debootstrap. We do this by commenting out the exit 1
below:
With the above change made, build.sh
should look similar:
At this point, we can build our ISO as normal:
Re-building the Latest Kali Image
Configuring The Kali ISO Build (Optional)
Building Kali Live With Different Desktop Environments
This is not required with the installer images, as it includes Xfce, Gnome and KDE by default. You can add others by including their packages as explained in the section below.
Controlling The Packages Included In Your Build
The list of packages included in your build will be present in the the respective kali-config/
directory. For example, if you’re wanting to edit:
The default Installer ISO, you would use the following package lists file - kali-config/installer-default/packages
The default Live ISO, you would use the following package lists file - kali-config/variant-default/package-lists/kali.list.chroot
A non-default Live ISO desktop environment, such as Gnome - kali-config/variant-gnome/package-lists/kali.list.chroot
(You can replace Gnome with any supported desktop environments)
Overlaying Files In Your Build
With Live images, you have the option to include additional files or scripts in your build by overlaying them on the existing file-system, inside the includes.{chroot,binary,installer}
directories, respectively.
For example, if we wanted to include our own custom script into the /root/
directory of the ISO (this would correspond to the chroot stage), then we would drop this script file in the kali-config/common/includes.chroot/
directory before building the ISO.
Build Hooks, Binary and Chroot
As an example, we recommend you check out the existing hooks in kali-config/common/hooks/
.
Building a Kali Linux ISO for Different Architectures (Optional)
By default, the build-script will generate the Kali image based on the architectures of the current operating system. If you wish to alter this:
x64: ./build.sh --verbose --arch amd64
x86: ./build.sh --verbose --arch i386
Building a Kali Linux ISO for Older i386 Architectures
The Kali Linux i386 ISO has PAE enabled. If you require a default kernel for older hardware with PAE disabled, you will need to rebuild a Kali Linux ISO. The rebuilding process is much the same as described above, except that the 686-pae parameter needs to be changed to 686 in auto/config
before building:
Using A Custom Network Mirror For Building (Optional)
If you build multiple images, you will find you are often waiting on build.sh
to finish. There are a few ways to speed up the build process, such as:
Building Installer images as they often build quicker than Live images
Have less packages included (such as switching kali-linux-default
to kali-linux-top10
)
Improve access to packages
We can instruct the build-script to use a different mirror, by doing the following (assuming our network mirror is located at http://192.168.0.101/kali
):
Help Screen
You can see all the available command-line options by doing --help
:
Testing Built Image
Next we produce a hard disk to use:
Afterwards, to boot from the image produced (we will be using the Live image on x64):
The above will be a “BIOS” boot. For a “UEFI” boot:
Note: We have set UEFI configuration file to be read only
By using the branch, you are able to re-create the latest distributed image. We can do this by using --distribution kali-last-snapshot
:
If you want to customize your Kali Linux ISO, this section will explain some of the details. Through the kali-config/
directory, there are a wide range of customization options, which are well-documented for page. Simple-CD is a little more limited with options. For the impatient, here are some of the highlights.
Since , we now support built in configurations for various , including Xfce (default), Gnome, KDE, E17, I3WM, LXDE, MATE. To build any of these, you would use syntax similar to the following:
By default, these lists will includes the , as well as some others. These can be commented out and replaced with a manual list of packages to include in the ISO for greater granularity.
For more information see the .
For live images, live-build supports hooks allows us to “hook scripts” in various stages of the Kali ISO live image. For more detailed information about hooks and how to use them, refer to the .
You often find that you are waiting on packages to be pulled down. You can either setup a local proxy on the same machine (such as apt-cacher
or apt-cacher-ng
). Alternatively, you can setup a .
After producing the issue, you can treat it like any Kali base image, so you can it (either on bare metal or ), or copy to a CD/DVD/.
If you are wanting to quickly test the image before putting it “in production”, we can use (and for UEFI). First we install the packages: