Loading…
Loading documentation...
Manage APT and DNF packages, unattended security upgrades, sudo users, systemd services, and journald logs across Ubuntu, Debian, Rocky, and AlmaLinux.
Commands checked on 2026-11-23 with Ubuntu 24.04 LTS, Debian 12, Rocky Linux 9, AlmaLinux 9.
A repeatable operational checklist and cross-distro command baseline for administering Debian-family (Ubuntu 24.04 LTS, Ubuntu 22.04 LTS, Debian 12) and Enterprise Linux (Rocky Linux 9, AlmaLinux 9) virtual servers without drift, stale security patches, or full system disks.
sudo access or browser SSH console access; see First Linux server.Always inspect the running distribution and uptime before running package or firewall changes.
cat /etc/os-release
uname -r
hostnamectl
uptime -p
Debian and Ubuntu use apt and systemd-journald with service names like ssh and apache2, whereas Rocky Linux 9 and AlmaLinux 9 use dnf, SELinux (sestatus), and service names like sshd and httpd.
On Ubuntu 24.04 / Debian 12:
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y unattended-upgrades apt-listchanges curl jq ca-certificates
sudo dpkg-reconfigure -f noninteractive unattended-upgrades
On Rocky Linux 9 / AlmaLinux 9:
sudo dnf upgrade -y --refresh
sudo dnf install -y dnf-automatic curl jq ca-certificates
sudo sed -i 's/^apply_updates = no/apply_updates = yes/' /etc/dnf/automatic.conf
sudo systemctl enable --now dnf-automatic-timer
Create a named operator user with explicit SSH key authorization before hardening root login:
sudo adduser deploy || sudo useradd -m -s /bin/bash deploy
sudo usermod -aG sudo deploy 2>/dev/null || sudo usermod -aG wheel deploy
sudo install -d -m 700 -o deploy -g deploy /home/deploy/.ssh
sudo install -m 600 -o deploy -g deploy /root/.ssh/authorized_keys /home/deploy/.ssh/authorized_keys
sudo visudo -cf /etc/sudoers
Verify key login in a separate terminal before closing your original shell session.
Use structured systemd queries rather than parsing /var/log/syslog blindly:
systemctl --failed
systemctl list-units --type=service --state=running
journalctl -u ssh -u sshd -n 50 --no-pager
sudo journalctl --disk-usage
sudo journalctl --vacuum-time=14d --vacuum-size=500M
df -hT
Cap persistent journal size in /etc/systemd/journald.conf.d/size.conf so verbose crash loops cannot exhaust / and break SSH logins or PostgreSQL writes:
[Journal]
SystemMaxUse=500M
SystemKeepFree=2G
MaxRetentionSec=1month
Apply immediately with sudo systemctl restart systemd-journald.
Check that time synchronization (chrony or systemd-timesyncd) and MAC enforcement (AppArmor on Ubuntu/Debian or SELinux on Rocky/AlmaLinux) are healthy:
timedatectl status
sudo aa-status 2>/dev/null || getenforce 2>/dev/null
Run this single validation block and confirm zero failed services, active time sync, and enabled unattended security updates:
systemctl is-system-running
timedatectl show -p NTPSynchronized --value
systemctl is-enabled unattended-upgrades 2>/dev/null || systemctl is-enabled dnf-automatic-timer
You should see running (or degraded resolved to running), yes, and enabled.
apt-get fails with Could not get lock /var/lib/dpkg/lock-frontend. An unattended background upgrade is active at boot. Confirm with ps aux | grep -E 'apt|dpkg|dnf' and wait 30–60 seconds rather than deleting lock files mid-transaction.Permission denied (publickey) after adding a new user. SELinux context or file mode mismatch on Rocky/AlmaLinux. Fix permissions and restore context: chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys && sudo restorecon -Rv /home/deploy/.ssh.No space left on device. Check both blocks (df -h) and inodes (df -i), then locate huge directories with sudo du -xhd 1 /var | sort -h.SystemKeepFree=2G in journald.firewalld and ufw on the same Linux host; keep each distribution's native firewall stack clean.test -f /var/run/reboot-required (Debian/Ubuntu) or sudo dnf needs-restarting -r (Rocky/AlmaLinux).Every Servers Are Up virtual machine and container includes an integrated HTML5 browser-based SSH, RDP, and VNC console in your dashboard, default-off inbound firewall rules with per-IP allow-lists, and full programmatic control via REST API v1 and Model Context Protocol (MCP). Explore our Virtual Datacenter Plans or reach out to Servers Are Up Support.