http://bbs.chinaunix.net/thread-1020336-1-1.html

安装portupgrade程序

Shell:

cd /usr/ports

make search name=portupgrade

cd /usr/ports/ports-mgmt/portupgrade/

make install clean;rehash


Options for portupgrade 2.3.1,2

[X]

BDB4

Use Berkeley DB >=2 as backend

至此portupgrade程序安装完成。

使用portupgrade来更新Ports
扫描已安装的port的列表,最好每次升级前执行一下

Shell:

pkgdb -F


升级所有安装过的Ports使用portupgrade -a命令,如果想要系统要求确认,加参数i ( 注: portupgrade -a 只能升级通过 port 方式安装的程序 )

Shell:

portupgrade -ai


要是想指定优先级,优先升级某一个程序,可以使用参数-R。例如升级 ( 注: portupgrade -a 只能升级通过 port 方式安装的程序 )

Shell:

portupgrade -R ruby


升级经由pkg_add方式安装的程序,需要使用portupgrade -P+程序名称命令,系统会在本地查找搜索 PKG_PATH 中指定的本地目录,
如果没有找到,则从远程站点下载。如果远程也没有找到,将使用 ports方式安装。 ( 如果要禁止使用 port
可以指定 -PP )

Shell:

portupgrade -P cvsup-without-gui


查看系统在安装程序时,都安装哪些文件,放到了哪些地方。使用pkg_info -L 程序名称版本号|less命令

Shell:

pkg_info -L axel-1.0b | less

Information for axel-1.0b:

Files:

/usr/local/man/man1/axel.1.gz

/usr/local/bin/axel

/usr/local/etc/axelrc

/usr/local/share/locale/de/LC_MESSAGES/axel.mo

/usr/local/share/locale/nl/LC_MESSAGES/axel.mo

如查不记得程序版本名称,也可以使用pkg_info | grep -i 程序名称
命令进行查询

Shell:

pkg_info | grep -i axel

axel-1.0b
A download accelerator


使用Ports安装程序,会在/usr/ports/distfiles目录留有源文件,清理此目录,可以使用portsclean -DD 命令。

Shell:

portsclean -C

Cleaning out /usr/ports/*/*/work...

portsclean -DD

Detecting unreferenced distfiles...

[Updating the pkgdb <format:bdb_btree> in /var/db/pkg ... - 22 packages found (-1 +1) (...). done]

Delete /usr/ports/distfiles/automake-1.4-p6.tar.gz

Delete /usr/ports/distfiles/ezm3/ezm3-1.2-FreeBSD4-boot.tar.bz2

Delete /usr/ports/distfiles/ezm3/ezm3-1.2-src.tar.bz2

Delete /usr/ports/distfiles/rpm-3.0.6.tar.gz

Delete /usr/ports/distfiles/ezm3