Update
Update package list
Upgrade packages
Upgrade and remove if necessary
Auto updates
Install needed packages.
Configure updates. By default only security updates are enabled.
vim /etc/apt/apt.conf.d/50unattended-upgrades
---
Unattended-Upgrade::Allowed-Origins {
[...]
"origin=Debian,codename=${distro_codename}-updates";
[...]
}
Enable the timer.
Check if a reboot is needed.
[ -f /var/run/reboot-required ] && reboot apt autoremove -y apt clean echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu focal main" | tee -a /etc/apt/sources.list.d/ansible.list apt install software-properties-common apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" gpg --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 /etc/network/interfacessource /etc/network/interfaces.d/*
auto lo iface lo inet loopback
The primary network interface
allow-hotplug enp1s0 iface enp1s0 inet static address 192.168.1.2 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 1.1.1.1 8.8.8.8 9.9.9.9 pre-up echo "nameserver 1.1.1.1\nnameserver 8.8.8.8\nnameserver 9.9.9.9" > /etc/resolv.conf
systemctl restart networking
ifup enp1s0
systemctl restart ifup@enp1s0
groupadd --gid 1000 --system user useradd --comment "user" --home-dir /var/lib/user --gid 1000 --create-home --system --shell /bin/false --uid 1000 user ```Info
apt
is meant for interactive use, and should not be used in scripts. In scripts one should useapt-get
, which has a stable output better suitable for parsing.