
Preseed configuration examples and guides for automated, hands-off Kali Linux installation, including partitioning, package selection, and boot options.
Debian preseed files are useful tools to automate installation and configuration of a Debian-based distribution. Kali is able to utilize these to speedup installations with a hands-off, customized, consistent installation. For much more info on preseed files, please consult the Debian Installation Guide or the Debian example preseed text file.
While there are many ways to customize a preseed file, with installed packages providing even more options, this repository will serve to host and allow creation of more simple files that allow for lightly customized Kali install options.
For a very in depth and helpful guide on using preseed files, we can look to the Debian installation wiki. This includes steps for how to bake the preseed into the iso file, using a USB to hold the preseed file, or utilizing a network connection to pull the preseed file from a URL.
One note that we should make is that to utilize URL preseeding, we must follow the following boot prompt:
/install.amd/vmlinuz vga=788 auto=true priority=critical url=link-to-preseed.cfg initrd=/install.amd/initrd.gz --- quiet
We can edit the boot parameter on a BIOS booted system by either pressing ESC for a blank prompt or pressing E to modify a pre-existing boot option. On UEFI systems we can either press C for a blank prompt or E to modify a pre-existing boot option.
If we wish to utilize a preexisting boot option, we can add the following boot prompts to have an automated install:
language=en country=US locale=en_US.UTF-8 keymap=us auto=true priority=critical url=link-to-preseed.cfg
When creating a preseed file there are certain flags that one should always want to use to have a hands-off installation. Lets take a look at each of these.
The following will automatically choose our location-based settings. The locale, the language, and the country. For more information on locales, we can visit the Debian Wiki entry. If we are unsure on what locale to use, we can either opt for the English option, which is what is set below. Optionally, to find out our locale, we can use a machine that is installed already and run the command locale. Just be sure to enter the information before .UTF-8.
kali@kali:~$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE=en_US.UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
The preseed option:
d-i debian-installer/locale string en_US
However, if we wish to either manually select all of these options, or change only one of them after utilizing the above, we can then use the following to set each one:
d-i debian-installer/language string en
d-i debian-installer/country string US
d-i debian-installer/locale string en_US.UTF-8
We next will need to set the keymap, which is not set by the locale. We can use the command localectl to find our layout, if we have a machine installed already.
kali@kali:~$ localectl
System Locale: (unset)
VC Keymap: (unset)
X11 Layout: us
X11 Model: pc105
The preseed option:
d-i keyboard-configuration/xkb-keymap select us
Keep in mind that both the locale and the keymap are able to be changed later, utilizing dpkg-reconfigure locales and dpkg-reconfigure keyboard-configuration respectively.
We can now edit our network settings. Keep in mind that this will not be used if we are using url preseeding. We first need to choose our interface. For this option, we just use auto as it is easiest. We can however choose a specific interface if necessary, such as eth0.
d-i netcfg/choose_interface select auto
The following preseed options are used to skip the request for hostname and domain name, which will be supplied through DHCP or by using the pre-set values: 'kali' for hostname and a blank domain:
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain
Should we want to set a hostname or domain name ourselves, we can do so by modifying the string to be what we desire. Keep in mind DHCP values will be prioritized over any value we set, but this can be avoided by hard coding the value like so:
d-i netcfg/hostname string personal-hostname
We now move onto network mirrors. The following options serve to set the mirror we wish to use for Kali and proxy settings if we must use them. If you are unsure, you probably don't need to set anything. In our case, we edit the hostname value to be the Kali Cloudflare mirror network, kali.download. If we wish to get the fastest mirror available assigned to us, we can instead use the option http.kali.org:
d-i mirror/country string manual
d-i mirror/http/hostname string kali.download
d-i mirror/http/directory string /kali
d-i mirror/http/proxy string
There are a couple other options we can choose to include as well. These two options will set the protocol to use to connect to the mirror as well as what suite to select. Unless you have a need to change either option, it is best to leave this out of our preseed:
d-i mirror/protocol string http
d-i mirror/suite string kali-rolling
We now move on to user creation. We first set our full name and then our username. The full name is able to be multiple words, however the username is not. Be sure to be using one word for your username. We can then set our password as we like. If you don't wish to have your password be in plain text we can choose to use an encrypted hash. We can generate one using the command mkpasswd or through many other means, which will not be covered:
d-i passwd/user-fullname string Kali Linux
d-i passwd/username string kali
d-i passwd/user-password password kali
d-i passwd/user-password-again password kali
An encrypted hash can be used as follows:
d-i passwd/user-password-crypted password [hash]
We now move on to the clock setup. The options used do the following: Tell the installer that the system clock is set to UTC, apply a time zone value that the Kali install should use as its clock, and then uses NTP to set that time.
d-i clock-setup/utc boolean true
d-i time/zone string US/Eastern
d-i clock-setup/ntp boolean true
We can search for a value to set the timezone to in the folder /usr/share/zoneinfo/, or we can use the following command:
kali@kali:~$ cat /etc/timezone
US/Eastern
We now get into partitioning. This is easily the most complicated part of creating a preseed, as there are a few values to set based off of what type of system you are using, and what type of installation you want.
We first set the auto settings of for partman, the partitioning tool. We say that this will be a regular install, rather than utilizing LVM (lvm) or encrypted (crypto), and then say to use the full amount of the hard drive available. We can also use smaller sizes, such as 20 GB or a percentage of free space. The final option here determines how your files are configured, whether everything is in one partition (atmoic), if the /home folder is in a separate partition (home) or if /home, /var, and /tmp are all in separate partitions (multi).