最近裝了不少的FreeBSD的各種版本,有發現到一個方便更新ports的工具先記錄下來,不想每一次都來找了
資料來源: http://www.cyberciti.biz/tips/howto-keep-freebsd-system-upto-date.html
Updating FreeBSD server system is quite easy. You can apply security patch to keep freebsd system up to date.
Required tools aka software
You need to have following tools on system
(a) portmanager - FreeBSD ultimate ports update utility.
(b) portsnap - It is a system for securely distributing the FreeBSD ports tree. Approximately once an hour, a snapshot of the ports tree is generated, repackaged, and cryptographically signed. The resulting files are then distributed via HTTP.
(c) pkg_version - List the installed version of the package is older than the current version.
FreeBSD install portsnap (for older system version <6.0)
On FreeBSD 6.0+, portsnap is contained in the FreeBSD base (core) system. You only need to to install portsanp as follows for older FreeBSD system:
# cd /usr/ports/ports-mgmt/portsnap
# make install clean
FreeBSD install portmanager
# cd /usr/ports/ports-mgmt/portmanager
# make install clean
Upgrade FreeBSD ports collection
Run portsnap as follows:
# portsnap fetch extract
OR
# portsnap fetch
# portsnap extract
Update FreeBSD packages / software
Now run portmanager to upgrade installed ports:
# portmanager -u
It will updates ports in the correct order based on their dependencies. If a port fails to "make" during update it is marked as ignored. Portmanager will continue updating any ports not marked as "ignored" so long as they are not dependent on the ignored port. Also note that it may take some time if you have large number of application installed.
If you need to upgrade all installed ports with logging, enter:
# portmanager -u -l
How do I upgrade a single software only?
portmanager allows you to update a single port and all of its dependencies. For example update port called bash i.e. bash shell (shells/bash), enter:
# portmanager shells/bash -l -u -f