Post-install automation for Kali Linux that handles system setup, tool installation, and optional debloating.
Two complementary scripts for getting a fresh Kali Linux install into a comfortable, usable state:
- setup.sh - Updates system, installs baseline tools, configures firewall, optionally installs popular apps
- debloat.sh - Removes unnecessary packages to free disk space and reduce clutter
Both scripts follow a "keep going" approach - they continue even if a step fails, then show you what went wrong at the end.
Run setup.sh first to set up your system:
chmod +x setup.sh
sudo ./setup.sh --brave --vscodiumThen optionally run debloat.sh to remove bloat:
chmod +x debloat.sh
sudo ./debloat.sh --kernelsBoth scripts are designed to continue execution even if a step fails. At the end, you'll see a clear summary of what failed. This prevents losing progress just because one repo was unreachable.
- All output is captured while scripts run
- Log files are only saved if something fails or if you use
--log - On successful runs without
--log, the temporary logs are automatically discarded
This keeps your directory clean while making troubleshooting easy when needed.
Before running apt commands, scripts wait for package manager locks to clear so they don't fail if another process is using APT.
Sets up a fresh Kali install with updates, baseline tools, firewall configuration, and optional applications.
1) Updates your system
- Runs
apt-get updateandapt-get upgrade -y
2) Installs baseline packages
Installs practical tools most people want:
- Basics:
curl,wget,git,ca-certificates,gnupg - Admin tools:
btop,net-tools,ufw - Archive tools:
zip,unzip,p7zip-full - Editor + restore tool:
vim,timeshift - Media player:
vlc
3) Enables firewall (UFW)
- Default deny incoming
- Default allow outgoing
- Enable firewall
Suitable for most personal Kali systems. Add rules afterward if you need inbound access for services.
4) Optional applications
Nothing extra is installed unless you explicitly request using flags.
5) Cleanup
- Removes unused packages
- Cleans APT cache
- Runs
systemd-tmpfiles --clean - Removes thumbnail cache
chmod +x setup.sh
sudo ./setup.shView help:
sudo ./setup.sh --help| Flag | What it does |
|---|---|
--log |
Always keep setup.log (even if everything succeeds) |
--pwfeedback |
Enables sudo password feedback |
--brave |
Adds Brave's repo + installs brave-browser |
--mullvad |
Adds Mullvad's repo + installs Mullvad VPN and browser |
--rustdesk |
Installs RustDesk remote desktop client from latest release |
--vscodium |
Adds VSCodium repo + installs codium |
--docker |
Installs Docker Engine using Docker's Debian repo for Kali |
Baseline only:
sudo ./setup.shInstall common apps:
sudo ./setup.sh --brave --vscodium --dockerEnable sudo password feedback:
sudo ./setup.sh --pwfeedbackAlways save a log:
sudo ./setup.sh --logKali reports its codename as kali-rolling, which doesn't work with Docker's Debian repos. This script:
- Infers the Debian base (
trixieorbookworm) using the installedlibc6version - Removes stale Docker repo entries if present
- Installs Docker from Docker's official Debian repository
- Adds the user to the
dockergroup
After installation, log out and back in (or reboot) before using Docker without sudo.
When --rustdesk is used:
- Detects system architecture (
amd64orarm64) - Queries RustDesk's latest GitHub release
- Downloads and installs the matching
.debpackage - Cleans up temporary files
RustDesk is installed without adding a persistent APT repository.
Depending on flags used, may create or modify:
- UFW firewall state and defaults
/etc/sudoers.d/setup-pwfeedback(only with--pwfeedback)- APT source files for Brave, Mullvad, VSCodium, Docker (with their respective flags)
- Temporary files under
/tmpduring installs setup.log(only on failure or with--log)
Removes unnecessary packages from Kali Linux to free disk space and reduce clutter.
1) Shows what will be removed and asks for confirmation
Before doing anything, displays a list of packages that will be removed and waits for your confirmation. Nothing happens until you enter y.
2) Removes default bloat packages
Removes packages most Kali users don't need:
| Package | What it is |
|---|---|
| totem | GNOME Videos player |
| orca | Screen reader |
| rygel | DLNA/UPnP media streaming server |
| bolt | Thunderbolt device manager |
| gnome-user-docs | GNOME help documentation |
| yelp | Help viewer app |
| malcontent | Parental controls |
| gnome-remote-desktop | GNOME's remote desktop server |
| packagekit | Software center backend |
These have minimal dependencies and won't break your desktop environment.
3) Optional: removes old Linux kernels
With --kernels, detects and removes old kernel packages while keeping:
- Currently running kernel
- Meta-package (
linux-image-amd64)
Can free significant disk space on older installations.
4) Optional: removes Firefox
With --firefox, removes Firefox ESR using a stub package approach.
Kali's kali-desktop-core depends on firefox-esr | firefox. You can't just purge it without breaking some dependencies. The script:
- Creates a stub package (
debloat-firefox-stub) that satisfies the dependency - Installs the stub
- Purges
firefox-esr - Removes leftover
~/.mozillafiles - Sets Brave as default browser if installed
The stub package is tiny (~1KB) and just tells APT "the Firefox dependency is satisfied."
5) Cleanup
- Removes unused dependencies
- Cleans APT cache
chmod +x debloat.sh
sudo ./debloat.shView help:
sudo ./debloat.sh --help| Flag | What it does |
|---|---|
--log |
Always keep debloat.log (even if everything succeeds) |
--kernels |
Also remove old Linux kernels (keeps currently running kernel) |
--firefox |
Remove Firefox ESR and replace with stub package |
Remove default bloat only:
sudo ./debloat.shAlso remove old kernels:
sudo ./debloat.sh --kernelsAlso remove Firefox:
sudo ./debloat.sh --firefoxRemove everything and keep a log:
sudo ./debloat.sh --kernels --firefox --logReinstall removed packages:
sudo apt install totem orca rygel bolt gnome-user-docs yelp malcontent gnome-remote-desktop packagekitReinstall Firefox after using --firefox:
sudo apt purge debloat-firefox-stub
sudo apt install firefox-esrNote: Old kernels cannot be easily restored. If you need a previous kernel, install it manually from Kali repositories.
Depending on flags used, may create or modify:
- Removed packages and their config files (purged)
debloat-firefox-stubpackage installed (only with--firefox)~/.mozilladirectory removed (only with--firefox)- Default browser setting (only with
--firefoxif Brave is installed) debloat.log(only on failure or with--log)
Common causes:
- Not in the same directory as the script
- Script isn't executable
- Filename doesn't match what you typed
Fix:
cd /path/to/the/script
chmod +x setup.sh
sudo ./setup.shIf a script reports errors or you used --log:
less ./setup.logCheck if:
equivsfailed to install (possible network issue)- Stub package failed to build (check logs)
firefox-esrwas already removed some other way
None of the target packages are currently installed. System is already debloated.
After Docker installation, you may need to log out and back in (or reboot) for the group membership to take effect.
Setup:
- You need custom firewall rules for inbound services
- You prefer a very minimal Kali install
- You already manage packages and repositories manually
Debloat:
- You use GNOME Videos (totem) or other removed apps
- You rely on accessibility features (orca screen reader)
- You use Thunderbolt devices (bolt)
- You want to keep Firefox as your browser
- You want old kernels as fallback options