Last active
January 13, 2026 17:12
-
-
Save LucaBazzea/e6b7609780c0e97ba6b19213f399f0c3 to your computer and use it in GitHub Desktop.
Debian server configuration and hardening script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Packages remove | |
| apt purge \ | |
| ed nano \ | |
| x11-common xauth libx11-* gdm3 lightdm \ | |
| apache2 \ | |
| exim4 postfix sendmail \ | |
| perl python2 python3-minimal ruby \ | |
| snapd \ | |
| cloud-init \ | |
| avahi-daemon \ | |
| cups \ | |
| ModemManager | |
| # Update | |
| apt update | |
| apt upgrade -y | |
| # Clean up | |
| apt autoremove --purge | |
| apt clean | |
| apt autoclean | |
| # Packages install | |
| apt install -y \ | |
| ca-certificates \ | |
| ufw \ | |
| curl \ | |
| python3 \ | |
| fastfetch \ | |
| wget | |
| # Firewall | |
| ufw limit ssh | |
| ufw allow http | |
| ufw allow https | |
| ufw enable | |
| ufw status verbose | |
| # Docker | |
| apt purge docker.io docker-compose docker-doc podman-docker containerd runc | |
| install -m 0755 -d /etc/apt/keyrings | |
| curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc | |
| chmod a+r /etc/apt/keyrings/docker.asc | |
| tee /etc/apt/sources.list.d/docker.sources <<EOF | |
| Types: deb | |
| URIs: https://download.docker.com/linux/debian | |
| Suites: $(. /etc/os-release && echo "$VERSION_CODENAME") | |
| Components: stable | |
| Signed-By: /etc/apt/keyrings/docker.asc | |
| EOF | |
| apt update | |
| apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment