Ubuntu自动更新相关设置

  1. 设置自动更新
apt-get install unattended-upgrades

安装好unattended-upgrades后,需要配置:

/etc/apt/apt.conf.d/50unattended-upgrades 
Unattended-Upgrade::Allowed-Origins {
//      "${distro_id}:${distro_codename}-security";
//      "${distro_id}:${distro_codename}-updates";
//      "${distro_id}:${distro_codename}-proposed";
//      "${distro_id}:${distro_codename}-backports";
};
 
注释掉相关选项。
然后,编辑文件:/etc/apt/apt.conf.d/10periodic

APT::Periodic::Update-Package-Lists "1";   //显示更新包列表  0表示停用设置
APT::Periodic::Download-Upgradeable-Packages "1"; //下载更新包  0表示停用设置
APT::Periodic::AutocleanInterval "7"; // 7日自动删除 
APT::Periodic::Unattended-Upgrade "1"; //启用自动更新 0表示停用自动更新

或者直接使用: dpkg-reconfigure -plow unattended-upgrades 进行相关更新

  1. 禁用相关的包更新,例如Linux-Kernel.
sudo apt-mark hold <package_name>
sudo apt-mark hold linux-image-generic linux-headers-generic

 

发表评论