真实(模拟)自动系统更新¶
我在部署 私有云架构 和 边缘云计算架构 这样的模拟环境中,部署了大量的虚拟机,主要有:
由于都是测试环境,相对来说稳定性要求不如生产环境;同时大量的虚拟机依靠人力来维护升级非常麻烦,所以我在整个 私有云架构 和 边缘云计算架构 环境中部署启用 自动系统更新
Ubuntu Linux¶
Ubuntu无人值守升级 采用如下步骤
安装
unattended-upgrades
软件包:
使用apt命令安装unattended-upgrades软件包¶
sudo apt install unattended-upgrades
生成
/etc/apt/apt.conf.d/20auto-upgrades
配置:
命令行激活unattended-upgrades¶
cat << EOF > /etc/apt/apt.conf.d/20auto-upgrades
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1"
EOF
Fedora¶
Fedora系统自动更新 使用 dnf-automatic
:
安装
dnf-automatic
:
在Fedora系统中安装dnf-automatic¶
sudo dnf install dnf-automatic
修订
/etc/dnf/automatic.conf
:
激活dnf-automatic自动安装补丁¶
sudo cp /etc/dnf/automatic.conf /etc/dnf/automatic.conf_`date +%Y-%m-%d_%H:%M:%S`
sudo sed -i 's/apply_updates = no/apply_updates = yes/g' /etc/dnf/automatic.conf
运行并激活 Systemd进程管理器 的
dnf-automatic.timer
定时器:
运行并激活dnf-automatic.timer¶
sudo systemctl enable --now dnf-automatic.timer