Files
auto-update-ubuntu/README.md
2025-10-23 15:39:14 +02:00

82 lines
2.2 KiB
Markdown

# Unattended Updates for Ubuntu 24.04 Server
[![OS](https://img.shields.io/badge/ubuntu-24.04-E95420)](#)
[![Shell](https://img.shields.io/badge/shell-bash-121011)](#)
[![Feature](https://img.shields.io/badge/feature-unattended_updates-0078D7)](#)
[![License](https://img.shields.io/badge/License-MIT-green)](./LICENSE)
Automated Bash installer script for configuring unattended updates on Ubuntu 24.04 Server.
> **IMPORTANT**
> This script configures unattended updates with the following defaults:
> - Installs and updates all available packages
> - Installs security updates automatically
> - Creates a crontab entry to run updates every **Saturday at 04:00**
> **Optional Features**
> - Enable removal of unused packages
> - Enable automatic reboot if needed
> - Enable automatic reboot even if users are logged in
> **NOTE**
> Before running the script, decide whether you want to enable the optional features mentioned above. The lines to review in the code are shown below:
```
#
# Uncomment the next 2 lines to enable automatic removal of unused packages. This equals apt autoremove.
#
# sed -i '/Unattended-Upgrade::Remove-Unused-Dependencies/ s/^\/\/\s*//' "$config2"
# sed -i 's/Remove-Unused-Dependencies "false"/Remove-Unused-Dependencies "true"/' "$config2"
#
# Uncomment the next 2 lines to enable automatic reboot
#
# sed -i '/Unattended-Upgrade::Automatic-Reboot/ s/^\/\/\s*//' "$config2"
# sed -i 's/Automatic-Reboot "false"/Automatic-Reboot "true"/' "$config2"
#
# Uncomment the line below to enable automatic reboot even if users are logged in
#
# sed -i '/Unattended-Upgrade::Automatic-Reboot-WithUsers/ s/^\/\/\s*//' "$config2"
```
### Preparing
Update your package index before running the installer:
```
sudo apt update -y
```
### Download the Script
Clone the repository from your Git server:
```
git clone https://git.x-files.dk/server/auto-update-ubuntu.git
```
```
cd auto-update-ubuntu
```
### Usage
Run the script using:
```
sudo ./auto-update-ubuntu
```
### Post-install
Nothing to do.
---
### More Information
More guides and documentation can be found on [wiki.x-files.dk](https://wiki.x-files.dk)
---
### License
Licensed under the [MIT License](./LICENSE).
---