当前位置: 首页>>技术教程>>正文


upgrade – 如何为 Google Chrome 启用静默自动更新?

, ,

问题描述

安装 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

如何从此存储库启用无人值守升级?

最佳方法

  1. 安装无人值守升级:

    sudo apt-get install unattended-upgrades
    
  2. 通过编辑无人值守升级列表并在其中添加 Google Chrome 存储库,在 Google Chrome 存储库上启用无人值守更新:

    sudo gedit /etc/apt/apt.conf.d/50unattended-upgrades
    

    "Google\, Inc.:stable"; 添加到允许的来源:

    Unattended-Upgrade::Allowed-Origins {
        "${distro_id} ${distro_codename}-security";
    //  "${distro_id} ${distro_codename}-updates";
    //  "${distro_id} ${distro_codename}-proposed";
    //  "${distro_id} ${distro_codename}-backports";
     "Google LLC:stable";
    };
    
  3. 测试 使用 sudo unattended-upgrade --dry-run 进行测试,如果一切顺利,您应该安装了 Google Chrome 的更新,而无需您的任何干预。

要检查它是否在空运行后跟踪日志:

cat /var/log/unattended-upgrades/unattended-upgrades.log

您应该在日志中看到与此类似的内容:

2011-10-11 18:03:23,292 INFO Allowed origins are: [‘o=Ubuntu,a=oneiric-security’, ‘o=Google, Inc.,a=stable’]

您可以通过编辑文件 /etc/apt/apt.conf.d/10periodic 来更改无人值守更新的配置,配置选项在 /etc/cron.daily/apt 脚本头中。阅读它们以配置无人值守更新的频率。

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/12475.html,未经允许,请勿转载。