FreeBSDのアップデートは、freebsd-updateと言うツールでアップデート出来ます。詳しくは
こちらも参照してください。
freebsd-updateのコマンドとオプションは以下のようになっています。
DREAMCRAFT2 /root# freebsd-update -h
usage: freebsd-update [options] command ... [path]
Options:
-b basedir -- Operate on a system mounted at basedir
(default: /)
-d workdir -- Store working files in workdir
(default: /var/db/freebsd-update/)
-f conffile -- Read configuration options from conffile
(default: /etc/freebsd-update.conf)
-k KEY -- Trust an RSA key with SHA256 hash of KEY
-r release -- Target for upgrade (e.g., 6.2-RELEASE)
-s server -- Server from which to fetch updates
(default: update.FreeBSD.org)
-t address -- Mail output of cron command, if any, to address
(default: root)
Commands:
fetch -- Fetch updates from server
cron -- Sleep rand(3600) seconds, fetch updates, and send an
email if updates were found
upgrade -- Fetch upgrades to FreeBSD version specified via -r option
install -- Install downloaded updates or upgrades
rollback -- Uninstall most recently installed updates
IDS -- Compare the system against an index of "known good" files.
DREAMCRAFT2 /root#
freebsd-updateは、大きく分けて二つの機能を持っています。
一つはセキュリティアップデート、二つめはfreebsdのマイナーアップデートやメジャーアップデートを行う機能です。
1.セキュリティアップデート
freebsd-update fetch
freebsd-update install
これでセキュリティアップデートが実施されます。
確認方法は、uname -a (又は -r)で確認出来ます。
以下の様に「-p3」と言うように表示されます。
DREAMCRAFT2 /root# uname -r
8.2-RELEASE-p3
DREAMCRAFT2 /root#
2.セキュリティアップデートの自動実行
自動実行と言っても難しい設定はありません。他の自動実行プログラムと同じです。
/etc/crontabに追加します。
0 2 * * * root /usr/sbin/freebsd-update cron
上記の設定は、毎日午前2時にfreebsd-update cronを実行します。
freebsd-update cronが完了すると、root宛にメールが来ます。
あとはfreebsd-update installを実行するだけです。