Using Portsnap to Update FreeBSD Ports Tree Collection使用portsnap更新FreeBSD的港口樹收集
Portsnap is a alternative system for securely distributing and updating the FreeBSD ports tree, which is easier to use than CVSup. portsnap是一個替代系統的安全分發和更新FreeBSD的港口樹,這是更容易使用,比cvsup 。 Portsnap was first included in FreeBSD 6.0. portsnap最早包含在FreeBSD的6.0 。 Like CVSup, Portsnap uses a pull model of updating: The packaged and signed ports trees are placed on a web server which waits passively for clients to request files by either run portsnap manually by users or set up a cron job to download updates automatically on a regular basis.像cvsup , portsnap使用拉模型的更新:包裝,並簽署了港口的樹木,放置在Web服務器上等待被動地為客戶要求的檔案,無論運行portsnap手動由用戶或成立一個作業下載自動更新就一定期的基礎上。
On older FreeBSD systems, Portsnap is not automatically included, but it can be installed from sysutils/portsnap port by using command:對老年人的FreeBSD系統, portsnap是不會自動列入,但它可以安裝在從sysutils / portsnap港口使用命令:
# pkg_add -r portsnap # pkg_add - R的portsnap
Portsnap first fetch and update compresses snapshots of the FreeBSD ports tree stored in /var/db/portsnap/ (in /usr/local/portsnap/ if Portsnap is installed from FreeBSD Ports Collection) by default, and then only extract and update the uncompressed live ports tree at /usr/ports. portsnap第一,市值和更新壓縮快照的FreeBSD的港口樹存放在/ var /分貝/ portsnap / (在/ usr / local / portsnap / portsnap如果是從安裝FreeBSD的港口徵收)默認情況下,然後只提取和更新未壓縮住在港口的樹在/ usr /端口。
The behaviour and operation of Portsnap is controlled by configuration file portsnap.conf located in /etc (in /usr/local/etc/ if Portsnap is installed from the FreeBSD Ports Collection, and the configuration file is not automatically generated when freshly installed, instead you’ll found portsnap.conf.sample, just copy it as portsnap.conf).行為和運作portsnap控制配置文件portsnap.conf設在/ etc (在/ usr /本地的/ etc /如果portsnap安裝從FreeBSD的港口,收集,和配置文件是不會自動時所產生的新鮮,安裝,而不是您會發現portsnap.conf.sample ,只要複製它作為portsnap.conf ) 。 Generally, default configuration file will does its jobs.一般來說,默認配置文件是否將其就業機會。
At command line, the following options are supported, although most of the time it no need to be used, some can be configured in configuration file itself:在命令行中,下列選項的支持,雖然大部分的時間,沒有必要使用,有些可以配置在配置文件本身:
-d workdir : Store working files (eg downloaded updates) in workdir.三維workdir :存儲工作文件(例如下載更新)在workdir 。 (default: /var/db/portsnap, or as given in the configuration file) (默認:和/ var /分貝/ portsnap ,或作為給在配置文件)
-f conffile : Read the configuration from from conffile. - F的conffile :讀取配置從從conffile 。 (default: /etc/portsnap.conf) (預設:在/ etc / portsnap.conf )
-I : For the update command, update INDEX files, but not the rest of the ports tree.我是:為更新命令,更新索引文件,而不是其餘的港口樹。
-k KEY : Expect a public key with given SHA256 hash.鉀的關鍵:期望公鑰與給sha256哈希。 (default: read value from configuration file) (默認:讀取值從配置文件)
-p portsdir : When extracting or updating an uncompressed snapshot, operate on the directory portsdir. - P的portsdir :當提取或更新未壓縮的快照,操作上的目錄portsdir 。 (default: /usr/ports/, or as given in the configuration file.) (預設:在/ usr /港口/ ,或作為給在配置文件) 。
-s server : Fetch files from the specified server or server pool. - s服務器:市值檔案,從指定的服務器或服務器池。 (default: portsnap.FreeBSD.org , or as given in the configuration file.) (默認: portsnap.freebsd.org ,或作為給在配置文件) 。
path : For extract command only, operate only on parts of the ports tree starting with path.路徑:為解壓縮命令只,只對部分港口的樹開始路徑。 (eg portsnap sysutils/port would extract sysutils/portsman, sysutils/portsnap, sysutils/portupgrade, etc.) (例如portsnap sysutils /港口將提取sysutils /伯茨曼, sysutils / portsnap , sysutils / portupgrade等)
The Synopsis for the Portsnap command line is:概要為portsnap的命令行是:
portsnap [-I] [-d workdir] [-f conffile] [-k KEY] [-p portsdir] [-s server] command … [path] portsnap [我] [三維workdir ] [ - F的conffile ] [鉀的關鍵] [磷portsdir ] [ - s服務器]命令… [路徑]
Usage of Portsnap 使用portsnap
- Create an empty directory /usr/ports if it does not exists.創建一個空目錄為/ usr /港口,如果它不存在。
# mkdir /usr/ports # mkdir在/ usr /港口
- Fetch and download a compressed snapshot of the Ports Collection into /var/db/portsnap (or any other location specified in configuration file).市值並下載一個壓縮的快照港口收集到的/ var /分貝/ portsnap (或任何其他指定的位置配置文件) 。 Internet connection needed at this stage) and update the existing snapshot.網際網路連線,需要在這個階段)和更新現有的快照。
# portsnap fetch # portsnap市值
- If you are running Portsnap for the first time (even if a ports tree has already been created or populated, to let Portsnap establishes a baseline from which portsnap can determine which parts of the ports tree need to be updated) or /usr/ports hasn’t been populated, extract the snapshot and replaces the existing files and directories, and establishes Portsnap-maintained ports tree into /usr/ports:如果您正在運行portsnap為第一次(即使港口的樹已經建立或人口稠密,讓portsnap建立了一個基線從哪個portsnap可以確定哪些部分港口的樹木需要更新)或/ usr /港口hasn '噸填充,提取的快照,並取代現有的文件和目錄,並建立了portsnap維持港口的樹到/ usr /端口:
# portsnap extract # portsnap提取物
This step can be skipped if you’re only updating the ports tree.這一步可以略過如果您只是更新港口樹。
- If you already have a populated /usr/ports and you are just updating, run the following command instead:如果您已經有一個人口為/ usr /港口和你只是更新,運行以下命令,而是:
# portsnap update # portsnap更新
Note: For updating of FreeBSD Ports Tree, step 1 and 3 can be combined into single command: portsnap fetch update (not support in older version of Portsnap).注意:對於更新的FreeBSD港口樹,第1步和第3款可以合併成單一的命令: portsnap市值更新(不支持在舊版本的portsnap ) 。
Running Portsnap as Cron Job 運行portsnap作為作業
portsnap fetch will not be able to execute from a cron job to avoid burden of sudden surge of downloading request to Portsnap servers. portsnap市值將無法執行,從作業,以避免負擔驟增下載要求portsnap服務器。 Instead, a special portsnap cron command exists, which waits and sleeps for a random duration up to 3600 seconds before fetching updates, as if the fetch command is specified.反之,一個特別portsnap的CRON指揮存在,等待和睡一個隨機的時間長達3600秒之前,擷取更新,如果市值是指定的命令。
To run portsnap automatically with cron job, just add the line into /etc/crontab (the line set the time to 3 AM everyday, you can choose your own timing):運行portsnap自動作業,只是行添加到的/ etc / crontab (線設置的時間,每天凌晨三時,您可以選擇您自己的時間) :
0 3 * * * root /usr/sbin/portsnap cron 0 3 * * *根在/ usr / sbin / portsnap的CRON
This will ensure that the FreeBSD snapshot of ports collection is always up-to-date and can be quickly extracted into /usr/ports.這將確保該FreeBSD的快照港口收集始終是切合時宜的和可以很快提取到/ usr /端口。
Note: Running portsnap update from cron is not recommended as it may cause problem if installing or updating of a port happens at the time the cron job runs.注意:運行portsnap更新的CRON是不推薦,因為它可能導致的問題,如果在安裝或更新的一個港口發生的時間,該作業運行。 Portsnap will updates or removes files which are being used by the port build. portsnap將更新或刪除的檔案,其中正在使用的港口建設。 However, running portsnap -I update to update the ports Index files is possible, and can be used together with portversion to identify installed software which is out of date.然而,運行portsnap我更新來更新港口索引文件是有可能的,可用於連同portversion以確定安裝的軟件,這是不合時宜。
To update ports compressed snapshot and the INDEX files in /usr/ports/, and send an email if any installed ports are out of date, use the following line in /etc/crontab:更新港口壓縮的快照,並索引文件在/ usr /港口/和發送電子郵件,如果任何已安裝的港口已經過時,請使用下列線在/ etc / crontab :
0 3 * * * root portsnap -I cron update && pkg_version -vIL= 0 3 * * *根portsnap我的CRON更新& & pkg_version - vil =
Note: Older version of portsnap does not support listing multiple commands (eg, cron update) in the same invocation of portsnap.注:舊版本的portsnap不支持上市多個命令(例如,玉米更新)在同一援引portsnap 。 If the line above fails, try replacing portsnap -I cron update with portsnap cron && portsnap -I update.如果將上述行失敗,嘗試更換portsnap我的CRON更新與portsnap的CRON & & portsnap我更新。
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. 重要說明 :這是一個機器翻譯網頁是“按原樣”提供的擔保。 Machine translation may be difficult to understand.機器翻譯可能很難理解。 Please refer to請參閱 original English article英文原版的文章 whenever possible.只要有可能。
Share and contribute or get technical support and help at分享和貢獻,或取得技術的支持和幫助,在 My Digital Life Forums 我的數字生活論壇 . 。
Related Articles相關文章
- Update FreeBSD Ports Collection to Latest Version with Security Update with Portmanager and Portaudit更新FreeBSD的港口收集到最新版本,與安全性更新與portmanager和portaudit
- Searching for Application in FreeBSD’s Ports Collection搜尋的應用在FreeBSD上的港口收集
- Easy Way to Upgrade FreeBSD’s Ports簡單的方法來升級的FreeBSD的港口
- Update FreeBSD Ports Collection Up to Date and Latest更新FreeBSD的港口收集到的日期和最新
- Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 - Part 4安裝Web服務器在FreeBSD的6.0與2.2的Apache , MySQL 5.0的和PHP 5 -第4部分
- Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 - Part 3安裝Web服務器在FreeBSD的6.0與2.2的Apache , MySQL 5.0的和PHP 5 -第3部分
- Portdowngrade - Downgrade to Previous Version of FreeBSD’s Ports portdowngrade -降級為以前版本的F reeBSD上的港口
- Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 - Part 1安裝Web服務器在FreeBSD的6.0與2.2的Apache , MySQL 5.0的和PHP 5 -第1部分
- FreeBSD 6.0 on VMware Server Time and Clock Slow Down在FreeBSD 6.0就VMware服務器的時間和時鐘放緩
- Checking Free Disk Space on FreeBSD Server檢查可用磁盤空間在FreeBSD服務器



















February 9th, 2008 18:04 2008年2月9日18時04分
[...] at My Digital Life, there is an excellent tutorial on using portsnap. [ … … ]在我的數位生活,是一個很好的補習就使用portsnap 。 It covers not only the basics, but all the rest as [...]它不僅包括基本知識,但所有的休息[ … … ]