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.

Debian 12Server SetupLinuxSystem Administration

Important Notes

Please note these important points before setup

Root Access Required

Root access or sudo privileges are required for all configuration steps

Internet Connection Required

Active internet connection is needed for package updates and downloads

Create Backup

Create backups of your critical data before making any important changes

Time Required

Total time: approximately 30-45 minutes depending on system performance

Security Aspects

Consider all security aspects during server configuration

Document Changes

Document all changes made for future reference

Setup Steps

List available locales
locale -a
Generate UTF-8 locale
locale-gen C.UTF-8
Update system locale
update-locale LANG=C.utf8 LC_ALL=C.utf8
Check current locale configuration
locale

A restart may be required to fully apply the changes

Display current date and time
date
Check timezone configuration
timedatectl
List all available timezones
timedatectl list-timezones
Set timezone to Europe/Berlin
timedatectl set-timezone Europe/Berlin
Confirm new timezone configuration
timedatectl status
Update, upgrade and cleanup system
apt update && apt upgrade -y && apt autoremove -y && apt autoclean -y
Display main package sources
cat /etc/apt/sources.list
Check additional package sources
ls -la /etc/apt/sources.list.d/

More information can be found in the Debian Wiki on APT configuration

cloud.cfg
# This will cause the set+update hostname module to not operate (if true)
preserve_hostname: true
Set new hostname
sudo hostnamectl set-hostname server.chad.lu
Check hostname configuration
hostname
Restart system for full application
reboot
Clear default MOTD file
sudo truncate -s 0 /etc/motd
Install hardware information tool
apt install inxi -y
Display complete hardware information
inxi -Faz
Display CPU information
lscpu
Display memory information
free -h
Display disk information
df -h
Display system version information
lsb_release -a
Display kernel information
uname -a
Check systemd status
systemctl status
Check available updates
apt list --upgradable

Additional Tips

Useful commands and tips for better management

Setup Complete!

Your Debian 12 server is now basically configured and ready to use. Don't forget to make further security-relevant configurations according to your requirements.