Maintain Debian / Ubuntu Server

Casual Updates

Update/upgrade the system,

apt update
apt full-upgrade
apt autoremove
dpkg -l | grep ^rc
dpkg -l | grep ^rc | awk '{print $2}' | xargs dpkg --purge
#do-release-upgrade

Clean-up the old kernels,

df -h /boot
cd /boot/
uname -r
ls -lhF vmlinuz*
#dpkg -l | egrep 'linux-(image|headers|extra)' | grep ^i
dpkg -l | grep MINOR-NUMBER
dpkg --purge ...
rm -f initrd.img-...MINOR-NUMBER

Enable / disable automatic updates,

apt install unattended-upgrades
#dpkg -l | grep  unattended-upgrades
dpkg-reconfigure -plow unattended-upgrades

or do it manually,

date | mailx -s `hostname` root
mailq
cd /etc/apt/apt.conf.d/

cp -pi 50unattended-upgrades ~/50unattended-upgrades.dist
cat ../sources.list
vi 50unattended-upgrades

Unattended-Upgrade::Allowed-Origins {
        "${distro_id}:${distro_codename}";
        "${distro_id}:${distro_codename}-security";
        "${distro_id}ESM:${distro_codename}";
        "${distro_id}:${distro_codename}-updates";
        "${distro_id}:${distro_codename}-proposed";
};

Unattended-Upgrade::Mail "root";

cp -pi 20auto-upgrades ~/20auto-upgrades.dist
vi 20auto-upgrades

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "1";
APT::Periodic::Unattended-Upgrade "1";

systemctl status unattended-upgrades
systemctl restart unattended-upgrades

Upgrading to a New Ubuntu Release

lsb_release -a
df -h
dpkg -l | grep ^ rc
apt update
apt full-upgrade
apt autoremove
dpkg -l | grep ^ rc
do-release-upgrade

iptables -I INPUT -p tcp --dport 1022 -j ACCEPT

make sure grub is in place,

update-grub2

make sure there’s a few bytes left for the system to start fine,

df -h

and reboot,

reboot

Nethence | Doc | Pub | Lab | Pbraun | SNE Russia | xhtml