# Setup Automatic Updates on Debian

1. Log into the Debian device
2. Run the following commands in a terminal:
   # update software repositories
   sudo apt update
   # install software updates
   sudo apt upgrade -y
   # install unattended-upgrades
   sudo apt install unattended-upgrades -y
   # edit unattended-upgrades config
   sudo nano /etc/apt/apt.conf.d/50unattended-upgrades
3. Update the unattended-upgrades conf as needed

   Uncomment the ::Mail line and edit the email address to receive email notifications
   Unattended-Upgrade::Mail "i12bretro@i12bretro.local";
   Uncomment and set the value to true to automatically remove unused dependencies
   Unattended-Upgrade::Remove-Unused-Dependencies "true";

4. Press CTRL+O, Enter, CTRL+X to write the changes
5. Continue with the following commands
   # at the prompt, select Yes to enable automatic updates
   sudo dpkg-reconfigure --priority=low unattended-upgrades
   # enable and start the unattended upgrades service
   sudo systemctl enable unattended-upgrades --now
6. That's it, updates will now be installed automatically. Logs can be found in /var/log/unattended-upgrades
7. To run updates on demand, simply run the following command
   sudo unattended-upgrade -d