- Ubuntu or Debian-based Linux system
- Root or sudo access
- Internet connection
unattended-upgrades to ensure your system receives security patches automatically.
Manual System Updates
Before setting up automatic upgrades, understand the basic update commands:Update package lists
Upgrade installed packages
Full system upgrade (optional)
Installing Unattended-Upgrades
Install unattended-upgrades
Verify installation
Configuring Unattended-Upgrades
Configure unattended-upgrades to automatically install security updates.Run configuration wizard
- Automatically download and install stable updates? - Select “Yes”
- Email address for update notifications - Enter your email (optional)
- Automatic reboot options - Choose based on your needs
Manual configuration (alternative)
Configuration File Settings
The main configuration file is located at/etc/apt/apt.conf.d/50unattended-upgrades. Here are key settings:
Update Origins
Update Origins
Package Blacklist
Package Blacklist
Automatic Reboot
Automatic Reboot
Email Notifications
Email Notifications
MailOnlyOnError to false to receive notifications for all updates.Remove Unused Dependencies
Remove Unused Dependencies
Enable Automatic Updates
Enable automatic updates
Configuration values explained
Update-Package-Lists "1"- Update package lists dailyUnattended-Upgrade "1"- Run unattended-upgrade dailyDownload-Upgradeable-Packages "1"- Download upgradeable packages dailyAutocleanInterval "7"- Clean package cache every 7 days
"0" to disable a feature.Verify configuration
Testing Unattended-Upgrades
Test configuration
Manually trigger updates
Check update logs
Monitoring Automatic Upgrades
Check update status
Check update status
View update history
View update history
Check for pending updates
Check for pending updates
Service status
Service status
Recommended Configuration
Here’s a complete recommended configuration for production servers:/etc/apt/apt.conf.d/50unattended-upgrades
/etc/apt/apt.conf.d/20auto-upgrades
Disabling Automatic Upgrades
If you need to disable automatic upgrades:Disable automatic updates
"0" to disable:Stop the service
Troubleshooting
Updates not installing automatically
Updates not installing automatically
- Service status:
sudo systemctl status unattended-upgrades - Configuration files:
cat /etc/apt/apt.conf.d/20auto-upgrades - Logs:
sudo tail -f /var/log/unattended-upgrades/unattended-upgrades.log - Test manually:
sudo unattended-upgrades --dry-run
Too many email notifications
Too many email notifications
Packages being updated that shouldn't be
Packages being updated that shouldn't be
/etc/apt/apt.conf.d/50unattended-upgrades:System rebooting unexpectedly
System rebooting unexpectedly
Disk space issues
Disk space issues
Best Practices
Security Updates Only
Email Notifications
Package Blacklist
Regular Monitoring
Backup Before Updates
Test Environment
Quick Reference
Install and configure
Manual update
Check status