Debian 12 - Initial Server Setup
A comprehensive step-by-step guide for the initial setup of a fresh Debian 12 server with the most important configuration steps.
Setup Steps
Configure Language and Locale
Configuration of system language and locale settings for correct character display.
Generate UTF-8 locale
locale-gen C.UTF-8Update system locale
update-locale LANG=C.utf8 LC_ALL=C.utf8A restart may be required to fully apply the changes
Set Timezone
Setting the correct timezone for accurate time and date information.
Set timezone to Europe/Berlin
timedatectl set-timezone Europe/BerlinUse timedatectl list-timezones to see all available options
Update Package Sources
Updating APT package sources and the system to the latest state.
Update, upgrade and cleanup system
apt update && apt upgrade -y && apt autoremove -y && apt autoclean -yMore information can be found in the Debian Wiki on APT configuration
Configure Hostname
Setting a unique hostname for server identification in the network.
Edit cloud-init configuration (if present)
Set new hostname
sudo hostnamectl set-hostname server.chad.luRestart system for full application
rebootClean MOTD
Removing the default welcome message for clean login.
Clear default MOTD file
sudo truncate -s 0 /etc/motdShow Hardware Information
Checking and displaying available hardware resources of the server.
Install hardware information tool
apt install inxi -yDisplay complete hardware information
inxi -FazDisplay CPU information
lscpuDisplay memory information
free -hDisplay disk information
df -hSystem Verification
Final verification of all configurations and system status.
Display system version information
lsb_release -aDisplay kernel information
uname -aCheck systemd status
systemctl statusCheck available updates
apt list --upgradableAdditional Tips
Useful commands and tips for better management
Security Measures
Install UFW firewall
apt install ufw -yEnable firewall
ufw enableInstall Fail2Ban for enhanced security
apt install fail2ban -yEssential Tools
Install important system tools
apt install sudo curl wget git nano htop tree -yInstall build tools for compilation
apt install build-essential -yAutomatic Updates
Install automatic updates
apt install unattended-upgrades -yConfigure automatic updates
dpkg-reconfigure unattended-upgrades