特殊:Badtitle/NS100:AutomaticSecurityUpdates
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/AutomaticSecurityUpdates }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/af | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|Afrikaans| [[::AutomaticSecurityUpdates/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/ar | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|العربية| [[::AutomaticSecurityUpdates/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/az | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|azərbaycanca| [[::AutomaticSecurityUpdates/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/bcc | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|جهلسری بلوچی| [[::AutomaticSecurityUpdates/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/bg | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|български| [[::AutomaticSecurityUpdates/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/br | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|brezhoneg| [[::AutomaticSecurityUpdates/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/ca | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|català| [[::AutomaticSecurityUpdates/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/cs | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|čeština| [[::AutomaticSecurityUpdates/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/de | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|Deutsch| [[::AutomaticSecurityUpdates/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/el | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|Ελληνικά| [[::AutomaticSecurityUpdates/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/es | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|español| [[::AutomaticSecurityUpdates/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/fa | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|فارسی| [[::AutomaticSecurityUpdates/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/fi | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|suomi| [[::AutomaticSecurityUpdates/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/fr | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|français| [[::AutomaticSecurityUpdates/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/gu | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|ગુજરાતી| [[::AutomaticSecurityUpdates/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/he | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|עברית| [[::AutomaticSecurityUpdates/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/hu | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|magyar| [[::AutomaticSecurityUpdates/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/id | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|Bahasa Indonesia| [[::AutomaticSecurityUpdates/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/it | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|italiano| [[::AutomaticSecurityUpdates/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/ja | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|日本語| [[::AutomaticSecurityUpdates/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/ko | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|한국어| [[::AutomaticSecurityUpdates/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/ksh | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|Ripoarisch| [[::AutomaticSecurityUpdates/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/mr | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|मराठी| [[::AutomaticSecurityUpdates/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/ms | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|Bahasa Melayu| [[::AutomaticSecurityUpdates/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/nl | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|Nederlands| [[::AutomaticSecurityUpdates/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/no | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|norsk| [[::AutomaticSecurityUpdates/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/oc | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|occitan| [[::AutomaticSecurityUpdates/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/pl | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|polski| [[::AutomaticSecurityUpdates/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/pt | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|português| [[::AutomaticSecurityUpdates/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/ro | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|română| [[::AutomaticSecurityUpdates/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/ru | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|русский| [[::AutomaticSecurityUpdates/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/si | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|සිංහල| [[::AutomaticSecurityUpdates/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/sq | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|shqip| [[::AutomaticSecurityUpdates/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/sr | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|српски / srpski| [[::AutomaticSecurityUpdates/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/sv | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|svenska| [[::AutomaticSecurityUpdates/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/th | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|ไทย| [[::AutomaticSecurityUpdates/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/tr | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|Türkçe| [[::AutomaticSecurityUpdates/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/vi | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|Tiếng Việt| [[::AutomaticSecurityUpdates/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/yue | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|粵語| [[::AutomaticSecurityUpdates/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/zh | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|中文| [[::AutomaticSecurityUpdates/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/zh-hans | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|中文(简体)| [[::AutomaticSecurityUpdates/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:AutomaticSecurityUpdates | UbuntuHelp:AutomaticSecurityUpdates | {{#if: | :}}AutomaticSecurityUpdates}}/zh-hant | • {{#if: UbuntuHelp:AutomaticSecurityUpdates|中文(繁體)| [[::AutomaticSecurityUpdates/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:AutomaticSecurityUpdates|:AutomaticSecurityUpdates|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :AutomaticSecurityUpdates/zh | | {{#ifexist: AutomaticSecurityUpdates/zh | | {{#ifeq: {{#titleparts:AutomaticSecurityUpdates|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:AutomaticSecurityUpdates|1|-1|}} | zh | | }}
- title Automatic Security Updates
Introduction
This is a simple tutorial that will teach you to create a script and a cron job to go out and automatically install security updates without requiring you to do anything. There are always some security risks involved in running software upgrades without supervision, but there are also benefits. If you believe it's important to stay up to date with the latest security patches, then you should follow this simple tutorial.
Instructions
To begin, press Alt+F2 and create a new file:
gksudo gedit /etc/cron.weekly/apt-security-updates
If you're using KDE, use this command instead:
kdesu kate /etc/cron.weekly/apt-security-updates
Copy the following text into this new file, save, and exit:
#! /bin/sh echo "**************" >> /var/log/apt-security-updates date >> /var/log/apt-security-updates aptitude update >> /var/log/apt-security-updates aptitude upgrade -o Aptitude::Delete-Unused=false --assume-yes --target-release `lsb_release -cs`-security >> /var/log/apt-security-updates echo "Security updates (if any) installed"
Once you are complete, you want to make the file executable. So, via the terminal, type the following line:
sudo chmod +x /etc/cron.weekly/apt-security-updates
Post-Install Setup and Execution Information
This script will run once weekly and it installs all available packages from the security repository. It also generates a log in ~-/var/log/apt-security-updates-~ for later inspection in case something goes wrong. This script will output information to a log file, so to prevent this log file from getting too large we need to make sure it gets rotated out. To do this, we'll use the ~-logrotate-~ utility, which comes with Ubuntu. Press Alt+F2 and type this command:
gksudo gedit /etc/logrotate.d/apt-security-updates
For KDE, use this command instead:
kdesu kate /etc/logrotate.d/apt-security-updates
Paste this into the editor, save, and exit:
/var/log/apt-security-updates { rotate 2 weekly size 250k compress notifempty }
This will rotate the log file every week (`weekly`), or if it's over 250kB in size (`size 250k`), compressing old versions (`compress`). The previous two log files will be kept (`rotate 2`), and no rotation will occur if the file is empty (`notifempty`).
Using cron-apt to handle automatic updating
Updating can be also done automatically by using package called cron-apt. Please read man page before doing anything.