Ubuntu

如何獲得自動升級以在 Ubuntu Server 上執行?

  • August 25, 2013

我遵循了在 Ubuntu 伺服器中啟用自動升級的文件,但它並沒有真正更新任何東西。

我的 /etc/apt/apt.conf.d/50unattended-upgrades 看起來幾乎像預設設置。

// Automatically upgrade packages from these (origin, archive) pairs
Unattended-Upgrade::Allowed-Origins {
       "Ubuntu karmic-security";
       "Ubuntu karmic-updates";
};

// List of packages to not update
Unattended-Upgrade::Package-Blacklist {
//      "vim";
//      "libc6";
//      "libc6-dev";
//      "libc6-i686";
};

// Send email to this address for problems or packages upgrades
// If empty or unset then no email is sent, make sure that you
// have a working mail setup on your system. The package 'mailx'
// must be installed or anything that provides /usr/bin/mail.
Unattended-Upgrade::Mail "pupeno@example.com";


// Automatically reboot *WITHOUT CONFIRMATION* if a 
// the file /var/run/reboot-required is found after the upgrade 
//Unattended-Upgrade::Automatic-Reboot "false";

目錄 /var/log/unattended-upgrades/ 為空。執行 /etc/init.d/unattended-upgrades start 不是很好:

root@mozart:~# /etc/init.d/unattended-upgrades start
Checking for running unattended-upgrades: root@mozart:~#

有些東西似乎壞了,但我不知道為什麼。

我有待處理的更新,它們沒有被應用:

root@mozart:~# aptitude safe-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Reading extended state information      
Initializing package states... Done
The following packages will be upgraded:
 linux-libc-dev 
1 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/743kB of archives. After unpacking 4096B will be used.
Do you want to continue? [Y/n/?]

在我擁有的所有伺服器中,無人值守升級似乎已被禁用:

root@mozart:~# apt-config shell UnattendedUpgradeInterval APT::Periodic::Unattended-Upgrade
root@mozart:~#

任何想法我錯過了什麼?

你檢查過 /etc/apt/apt.conf.d/10periodic 嗎?

它應該有最後一行

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

在此處查看您的 Ubuntu 版本的實際文件:

/usr/share/doc/unattended-upgrades/README.gz

對於 Ubuntu 11.10,要啟用它,您可以:

sudo dpkg-reconfigure -plow unattended-upgrades

(這是一個互動式對話框),它將/etc/apt/apt.conf.d/20auto-upgrades使用以下內容創建:

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

所以確實Ubuntu 10.04 伺服器指南中的資訊已經過時了。

如果您像我們在BippoSoluvas那樣使用Puppet,您可以使用類似這樣的東西來自動化正確的無人值守升級配置:

# Unattended upgrades
package { unattended-upgrades: ensure => present }
file { '/etc/apt/apt.conf.d/50unattended-upgrades':
 content => template('bipposerver/50unattended-upgrades'),
 mode    => 0644,
 require => Package['unattended-upgrades'],
}
file { '/etc/apt/apt.conf.d/20auto-upgrades':
 source  => 'puppet:///bipposerver/20auto-upgrades',
 mode    => 0644,
 require => Package['unattended-upgrades'],
}
service { unattended-upgrades:
 enable    => true,
 subscribe => [ Package['unattended-upgrades'],
                File['/etc/apt/apt.conf.d/50unattended-upgrades',
                     '/etc/apt/apt.conf.d/20auto-upgrades'] ],
}

確保提供您認為合適50unattended-upgrades的模板/文件。20auto-upgrades

我也在更新Ubuntu Wiki 頁面以反映這一點。

引用自:https://serverfault.com/questions/111201