Skip to content

A comprehensive, automated setup script for configuring a fresh Debian installation with developer tools, security enhancements, and productivity applications.

Notifications You must be signed in to change notification settings

stefan-hacks/dotfiles

Repository files navigation

πŸš€ Debian Bootstrap Script

A comprehensive, automated setup script for configuring a fresh Debian installation with developer tools, security enhancements, and productivity applications.

Debian Bash Automated

πŸ“‹ Overview

This bootstrap script transforms a fresh Debian installation into a fully-configured development workstation with:

  • Package Management: APT, Flatpak, Snap, and Homebrew integration
  • Security: UFW firewall, fail2ban, and AppArmor configuration
  • Developer Tools: Git, build tools, package managers, and custom scripts
  • System Customization: Terminal emulation, fonts, themes, and keyboard remapping
  • Error Handling: Robust installation with detailed failure reporting

⚑ Quick Installation

wget https://raw.githubusercontent.com/stefan-hacks/dotfiles/refs/heads/main/custom_tools_and_scripts/bash/bootstrap.sh
chmod +x bootstrap.sh
./bootstrap.sh

🎯 Prerequisites

  • Fresh Debian installation (tested on Debian 12/13)
  • sudo privileges
  • Internet connection
  • At least 2GB of free disk space

πŸ—οΈ What The Script Does

Phase 1: System Foundation

  1. Updates System: Updates APT repositories and upgrades existing packages
  2. Installs Core Tools: Git, curl, wget, build-essential, and development headers
  3. Removes Bloatware: Uninstalls unnecessary applications (Audacity, GIMP, LibreOffice)
  4. Security Hardening: Configures fail2ban for SSH protection and UFW firewall

Phase 2: Package Managers

  1. Homebrew Setup: Installs Homebrew for Linux and adds to shell environment
  2. Dotfiles Configuration: Clones and applies personal dotfiles repository
  3. APT Package Management: Installs packages from apt_list.bak with intelligent filtering
  4. Universal Packages: Sets up Flatpak and Snap with package installations

Phase 3: Development Environment

  1. Custom Scripts: Installs personal productivity scripts to /usr/local/bin
  2. Shell Enhancement: Configures ble.sh for advanced Bash features
  3. Font Installation: Installs Nerd Fonts for terminal and development use
  4. Kanata Keyboard: Sets up keyboard remapping service

Phase 4: System Customization

  1. Terminal Configuration: Sets Kitty as default terminal emulator
  2. GRUB Theme: Applies custom GRUB bootloader theme
  3. Driver Installation: Installs Realtek wireless adapter drivers
  4. GNOME Settings: Restores personalized desktop configuration

πŸ›‘οΈ Error Handling & Reliability

The script implements sophisticated error handling:

Package Installation Resilience

  • Individual Package Installation: Each package is installed separately
  • Failure Tracking: Failed packages are logged and displayed at the end
  • Continue On Error: Script proceeds even if some packages fail
  • Detailed Reporting: Clear success/failure indicators with package names

Supported Package Managers

Manager Error Handling Recovery
APT Individual package attempts Continues on failure
Flatpak Per-package installation Tracks failures
Snap One-by-one installation Logs missing packages
Homebrew Brewfile line parsing Individual formula attempts

Installation Summary

At completion, the script displays:

=== INSTALLATION SUMMARY ===
βœ“ APT - All packages installed successfully
βœ— Flatpak - Packages requiring manual installation:
   - package-name-1
   - package-name-2
βœ“ Snap - All packages installed successfully
βœ“ Homebrew - All packages installed successfully
=== END SUMMARY ===

πŸ”§ Customization

Package Lists

The script uses these configuration files from the dotfiles repository:

File Purpose Location
apt_list.bak APT packages dotfiles/backups/
flatpak_list.bak Flatpak applications dotfiles/backups/
snap_list.bak Snap packages dotfiles/backups/
Brewfile Homebrew formulae dotfiles/backups/

Custom Scripts

Personal scripts installed to /usr/local/bin/:

  • fza - Fuzzy apt package manager with tui interface
  • fzm - Fuzzy manpager - search manual pages tool
  • gspb - Gnome settings & package backups
  • idh - A beautiful organized & colorized detailed version of the id command
  • uma - Professional tool to analyze umask values and their effects on file/directory permissions
  • lsgroups - Display detailed group information for users in a beautifully formatted output.

🎨 Visual Customizations

Terminal & Shell

  • Default Terminal: Kitty (replaces GNOME Terminal)
  • Shell Enhancement: ble.sh for advanced Bash features
  • Prompt Customization: Lock icon in sudo password prompt
  • Fonts: Nerd Fonts (Hack, Source Code Pro, JetBrains Mono)

System Themes

  • GRUB Theme: WhiteSur theme with custom background
  • Icon Theme: Tela-circle-icons (commented in script)
  • GNOME Settings: Full desktop configuration restore

πŸ”’ Security Features

  1. Firewall: UFW with default deny incoming, allow outgoing
  2. SSH Protection: fail2ban with systemd backend
  3. Service Hardening: AppArmor profiles (commented)
  4. Port Configuration: Open only 22 (SSH), 80 (HTTP), 443 (HTTPS)

🚦 Post-Installation

Required Reboot

Some changes require a system restart:

sudo reboot

Manual Steps

Check the installation summary for any packages that need manual installation.

Service Verification

Verify these services are running:

systemctl status fail2ban
sudo ufw status
systemctl --user status kanata.service

πŸ› Troubleshooting

Common Issues

  1. Package Installation Failures

    # Check the installation summary
    # Manually install listed packages
    sudo apt install <package-name>
  2. Homebrew Issues

    # Update Homebrew
    brew update
    # Fix Homebrew permissions
    sudo chown -R $(whoami) /home/linuxbrew/.linuxbrew
  3. Permission Problems

    # Reset script permissions
    chmod +x bootstrap.sh
    # Run with sudo for system-wide changes
    sudo ./bootstrap.sh

Debug Mode

Run the script with debug output:

bash -x bootstrap.sh

πŸ“ Repository Structure

dotfiles/
β”œβ”€β”€ backups/
β”‚   β”œβ”€β”€ apt_list.bak          # APT packages
β”‚   β”œβ”€β”€ flatpak_list.bak      # Flatpak applications
β”‚   β”œβ”€β”€ snap_list.bak         # Snap packages
β”‚   β”œβ”€β”€ Brewfile             # Homebrew formulae
β”‚   └── gnome_settings.bak   # GNOME configuration
β”œβ”€β”€ custom_tools_and_scripts/
β”‚   └── bash/                # Custom bash scripts
└── bootstrap.sh            # This installation script

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test the bootstrap script
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

⚠️ Disclaimer

Use at your own risk! This script makes significant changes to your system:

  • Modifies system configuration files
  • Installs/uninstalls packages
  • Changes default applications
  • Modifies security settings

Always review the script before running it on production systems.

πŸ™ Acknowledgments


Made with ❀️ by stefan-hacks

GitHub Debian

About

A comprehensive, automated setup script for configuring a fresh Debian installation with developer tools, security enhancements, and productivity applications.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published