---
title: "利用CVSUP更新Port Tree"
author: "kingoal"
date: "2009-05-23T17:18:12Z"
tags: ["CVS", "Firefox", "FreeBSD", "MySQL", "Ruby"]
slug: "cvsup-port-tree"
draft: false
lastmod: "2009-05-23T17:27:13Z"
id: 394226
url: "https://kingoal.iteye.com/blog/394226"
---

#cd /usr/ports/net/cvsup-without-gui/  
#make install clean //安裝  
#cd /usr/share/examples/cvsup/ //存放更新範例路徑  
文件範例說明：  
cvs-supfile //更新Main source tree and ports collection  
doc-supfile //更新Document  
gnats-supfile //更新FreeBSD bug database  
ports-supfile //更新Ports collection  
stable-supfile //更新Main source tree  
standard-supfile //更新Main source tree  
www-supfile //更新FreeBSD 官方網頁  
#cp ports-supfile /root/ //複製ports-supfile到root目錄底下  
#cd /root //切換到root目錄底下  
#vi ports-supfile //修改ports-supfile內容

修改以下內容  
default host CHANGE\_THIS.FreeBSD.org //官方站台(預設值)  
default host cvsup.tw.freebsd.org //改為國內站台交大資工如此下載速度較快(還有cvsup1~13都可使用)

#rehash  
#cvsup -g -L 2 ports-supfile //更新ports-tree

———————-省略——————————-  
Shutting down connection to server  
Finished successfully  
//看到上面訊息代表更新成功  
#portsdb -Fu //當每次採用 CVSup 更新完 port tree 後，執行portsdb -Fu 來及時更新您的 port INDEX資料庫

 

 

**portupgrade -r** pkg\_name 升级单个软件和与其相关的  
其中 pkg\_name 是 pkg\_info 中显示的名字

**portupgrade** -ar 就会自动更新全部了。  
如果加上 P 参数，则先看是否有已经编译好的 pkg 下载，直接从 pkg 升级，省去自己编译。  
下载站点可以通过修改 /usr/local/etc/pkgtools.conf 更改

portupgrade -arR 升级所有已经安装的软件，并且检查依赖关系

 

使用 Ports 系统  
1 查询  
比如，你想知道 ports 中是否有 pidgin 这个软件，那么可以这样：  
$cd /usr/ports  
$make search key=pidgin  
同样也可以使用  
$cd /usr/ports  
$make search name=pidgin  
/usr/ports/README 中还有更多的例子可以参考。[]()

2 安装  
非常简单。比如你要安装 firefox，那么作为超级用户 root：  
#cd /usr/ports/www/firefox  
#make install clean  
3 卸载  
要卸载 firefox 的话：  
#cd /usr/ports/www/firefox  
#make deinstall clean  
4 升级  
要升级 firefox：  
#cd /usr/ports/www/firefox  
#make deinstall reinstall clean  
用ports安装东东很简单，但是有的时候在安装完后就会忘记make clean make distclean，一个一个找好麻烦，OK，follow me.....  
先删除make world和编译内核留下的垃圾文件  
rm -r /usr/obj/*  
常用的 Ports 管理工具portsnap  
这是推荐的升级 Ports 系统树的工具。  
portupgrade  
相当好用的升级 Ports 中软件的 Ruby 工具。支持从源码/包升级。  
pkg 工具  
FreeBSD 基本系统中自带的包管理工具。方便实用。都是 pkg\_* 类型的系统命令，比如 pkg\_add, pkg\_delete 之类的!

2.安装个小东西，可以升级soft，也可做清理  
cd /usr/ports/sysutils/portupgrade && make install clean

portupgrade升级soft  
portupgrade -riv -m \`参数，如WITH\_MYSQL=yes\` vpopmail

下面进行清理  
portsclean -C  
Cleaning out /usr/ports/\*/\*/work...  
完成每个目录下的make clean功能

portsclean -DD  
Detecting unreferenced distfiles...  
[Rebuilding the pkgdb in /var/db/pkg ... - 33  
packages found (-0 +33) ................................................................ done]  
删除不存在于pkg\_info中的/usr/ports/distfiles下的文件包

如果想把存在于pkg\_info中的distfiles也删了，直接去目录删就好了  
rm -r /usr/ports/distfiles/*

还有个portclean，自己man一下吧  
man portclean  
http://4dian.org/post/2/28