更新管理器不断为我提供更新(例如安全修复、来自 PPA 的更新)。
我如何告诉我的 Ubuntu 安装在更新可用时自动下载和安装它们?
我想确定是否在 Ubuntu 12.04 服务器上启用了自动更新。
我该如何检查?
如果已启用,如何禁用自动更新?
安装 Google Chrome 会导致添加第三方软件源,可以从中检索 Google Chrome 升级:
$ cat /etc/apt/sources.list.d/google-chrome.list
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
deb http://dl.google.com/linux/chrome/deb/ stable main
$ head -n 9 /var/lib/apt/lists/dl.google.com_linux_chrome_deb_dists_stable_Release
Origin: Google, Inc.
Label: Google
Suite: stable
Codename: stable
Version: 1.0
Date: Tue, 04 Oct 2011 00:57:43 +0000
Architectures: i386 amd64
Components: main
Description: Google chrome-linux repository.
$ grep '^Package: ' /var/lib/apt/lists/dl.google.com_linux_chrome_deb_dists_stable_main_binary-amd64_Packages
Package: google-chrome-beta
Package: google-chrome-stable
Package: google-chrome-unstable
Run Code Online (Sandbox Code Playgroud)
如何从此存储库启用无人值守升级?
我设置了无人值守升级,但有些软件包没有自动更新。
root@survey:/home/martin# apt update
root@survey:/home/martin# unattended-upgrade -v --dry-run
Initial blacklisted packages:
Initial whitelisted packages:
Starting unattended upgrades script
Allowed origins are: o=Ubuntu,a=xenial, o=Ubuntu,a=xenial-updates, o=Ubuntu,a=xenial-security, o=UbuntuESM,a=xenial
No packages found that can be upgraded unattended and no pending auto-removals
root@survey:/home/martin# /usr/lib/update-notifier/apt-check -p
python-rfc3339
python-zope.hookable
python-configargparse
python-zope.component
Run Code Online (Sandbox Code Playgroud)
origins 中的配置/etc/apt/apt.conf.d/50unattended-upgrades:
Unattended-Upgrade::Allowed-Origins {
"${distro_id}:${distro_codename}";
"${distro_id}:${distro_codename}-updates";
"${distro_id}:${distro_codename}-security";
"${distro_id}ESM:${distro_codename}";
};
Run Code Online (Sandbox Code Playgroud)
据我所知,待处理的软件包来自官方的 ubuntu 存储库(Launchpad 链接),所以我看不出为什么unattended-upgrade.
命令的输出确实说
没有发现可以无人值守升级的软件包,也没有挂起的自动删除。
是否存在这样的情况,该工具获取了一个包,来自允许的来源,但由于某种原因不允许无人值守升级?哪些进一步的措施能做些什么来找出为什么一些包没有资格?
我希望设置一个 PPA 来向现场数百台 ubuntu 12.04 机器发送简单的更改。简单的更改意味着 bash 脚本更改和配置文件更新以及可能的其他软件更新,包括可以通过 apt-get install 安装的新软件安装。我想到的几个问题是,
我知道这是一个广泛的问题,但是非常感谢您提供很少有指导意义的答案。
我学会了使用带有 DOS 的计算机,因此我尝试近似批处理/.bat 文件来运行系统的所有更新并创建结果的日志文件。
#!/bin/bash
#update system in one step
cd ~
date > aupdate.log
echo Launching updates...
echo Beginning apt update
sudo apt update >> aupdate.log
sudo apt upgrade -y >> aupdate.log
echo Completing apt autoremove process
sudo apt autoremove -y >> aupdate.log
echo Beginning snap update
sudo snap refresh >> aupdate.log
echo Beginning flatpak update
flatpak update -y >> aupdate.log
echo Updates complete. Review aupdate.log for details.
Run Code Online (Sandbox Code Playgroud)
我走在正确的轨道上吗?到目前为止,我有两个问题需要解决。
编辑:这是我运行脚本时的结果:
Launching updates...
Beginning …Run Code Online (Sandbox Code Playgroud) apt ×3
updates ×3
upgrade ×2
12.04 ×1
automation ×1
command-line ×1
log ×1
ppa ×1
repository ×1
scripts ×1
server ×1