- Update handbook/ports

PR:		docs/101392
Submitted by:	chinsan.tw at gmail.com
This commit is contained in:
Vanilla I. Shu 2006-08-05 05:08:38 +00:00
parent 74e108b259
commit fd078ee364
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=28417

View file

@ -94,7 +94,7 @@
<para>事實上ports 機制還可以用來產生 packages以便他人可以用 <para>事實上ports 機制還可以用來產生 packages以便他人可以用
<command>pkg_add</command> 來安裝,或是稍後會介紹到的其他套件管理指令。</para> <command>pkg_add</command> 來安裝,或是稍後會介紹到的其他套件管理指令。</para>
<para>而 packages 以及 ports 它們都是一樣,都會認 <emphasis>dependencies(軟體相依關係)</emphasis>。 <para>而 packages 以及 ports 它們都是一樣會認 <emphasis>dependencies(軟體相依關係)</emphasis>。
假設:您想安裝某程式,但它有相依另一個已裝的函式庫(library) 假設:您想安裝某程式,但它有相依另一個已裝的函式庫(library)
而在 FreeBSD 的 port 以及 package 都有這程式以及該函式庫了。 而在 FreeBSD 的 port 以及 package 都有這程式以及該函式庫了。
所以無論是用 <command>pkg_add</command> 指令或者 port 方式來裝該程式, 所以無論是用 <command>pkg_add</command> 指令或者 port 方式來裝該程式,
@ -237,33 +237,26 @@
</listitem> </listitem>
<listitem> <listitem>
<para>If you know the exact name of the port, but just need to <para>若知道該 port 的正確名稱,但不知道放在哪個分類目錄,
find out which category it is in, you can use the 可以用 &man.whereis.1; 指令來找出來。
&man.whereis.1; command. 只要打 <command>whereis
Simply type <command>whereis <replaceable>file</replaceable></command> 即可,而
<replaceable>file</replaceable></command>, where <replaceable>file</replaceable> 的地方請改為想裝的軟體名稱。
<replaceable>file</replaceable> is the program you want to 若找到該軟體,就會告訴你,就像下面這樣:</para>
install. If it is found on your system, you will be told
where it is, as follows:</para>
<screen>&prompt.root; <userinput>whereis lsof</userinput> <screen>&prompt.root; <userinput>whereis lsof</userinput>
lsof: /usr/ports/sysutils/lsof</screen> lsof: /usr/ports/sysutils/lsof</screen>
<para>This tells us that <command>lsof</command> (a system <para>如此一來,就會知道 <command>lsof</command> (系統工具程式) 是放在
utility) can be found in the <filename>/usr/ports/sysutils/lsof</filename> 目錄。</para></listitem>
<filename>/usr/ports/sysutils/lsof</filename>
directory.</para></listitem>
<listitem> <listitem>
<para>Yet another way to find a particular port is by using the <para>還有另一招,就是用 Ports Collection 本身內建的搜尋機制。
Ports Collection's built-in search mechanism. To use the 要用的時候,請先切換到 <filename>/usr/ports</filename> 目錄。
search feature, you will need to be in the 然後,打 <command>make search
<filename>/usr/ports</filename> directory. Once in that name=<replaceable>program-name</replaceable></command>,其中
directory, run <command>make search <replaceable>program-name</replaceable> 請改為想找的軟體名稱。
name=<replaceable>program-name</replaceable></command> where 舉例來說,若要找的是 <command>lsof</command> 的話,那麼就是:</para>
<replaceable>program-name</replaceable> is the name of the
program you want to find. For example, if you were looking
for <command>lsof</command>:</para>
<screen>&prompt.root; <userinput>cd /usr/ports</userinput> <screen>&prompt.root; <userinput>cd /usr/ports</userinput>
&prompt.root; <userinput>make search name=lsof</userinput> &prompt.root; <userinput>make search name=lsof</userinput>
@ -275,23 +268,19 @@ Index: sysutils
B-deps: B-deps:
R-deps: </screen> R-deps: </screen>
<para>The part of the output you want to pay particular <para>這些搜尋結果中,要注意的是 <quote>Path:</quote> 這行,
attention to is the <quote>Path:</quote> line, since that 因為這行會告訴你可以在哪邊找到該 port。
tells you where to find the port. The other information 而搜尋結果的其他部分,因為與 port 安裝較無關係,所以這裡就不講了。</para>
provided is not needed in order to install the port, so it
will not be covered here.</para>
<para>For more in-depth searching you can also use <command>make <para>若要更徹底的搜尋,那麼可以改用 <command>make
search key=<replaceable>string</replaceable></command> where search key=<replaceable>string</replaceable></command>,其中
<replaceable>string</replaceable> is some text to search for. <replaceable>string</replaceable> 請改為想搜尋的關鍵字。
This searches port names, comments, descriptions and 如此一來會找 port 名稱、軟體簡介(comments)、軟體敘述檔(descriptions)
dependencies and can be used to find ports which relate to a 以及軟體相依關係(dependencies)裡面是否有符合關鍵字,
particular subject if you do not know the name of the program 此外,不清楚軟體名稱的話,也可以拿來找有符合關鍵字主題的 port。</para>
you are looking for.</para>
<para>In both of these cases, the search string is case-insensitive. <para>剛講的這兩種方式,搜尋字眼都是 case-insensitive(不必區分大小寫)。
Searching for <quote>LSOF</quote> will yield the same results as 比如,搜尋 <quote>LSOF</quote> 與 <quote>lsof</quote> 兩者結果都會是一樣的。</para>
searching for <quote>lsof</quote>.</para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
@ -351,71 +340,52 @@ local: lsof-4.56.4.tgz remote: lsof-4.56.4.tgz
&prompt.root; <userinput>pkg_add <replaceable>lsof-4.56.4.tgz</replaceable></userinput></screen> &prompt.root; <userinput>pkg_add <replaceable>lsof-4.56.4.tgz</replaceable></userinput></screen>
</example> </example>
<para>If you do not have a source of local packages (such as a <para>若手邊沒有 package 來源(像是 FreeBSD 光碟)的話,
FreeBSD CD-ROM set) then it will probably be easier to use the 那麼建議使用 &man.pkg.add.1; 時,加上 <option>-r</option>
<option>-r</option> option to &man.pkg.add.1;. This will 選項來更輕鬆安裝 package。如此一來就會自動判斷正確的 package 格式、
cause the utility to automatically determine the correct 以及所搭配的作業系統 release 版本,
object format and release and then fetch and install the 然後會自己從 FTP 站抓回、安裝相對應的 package。
package from an FTP site.
</para> </para>
<indexterm> <indexterm>
<primary><command>pkg_add</command></primary></indexterm> <primary><command>pkg_add</command></primary></indexterm>
<screen>&prompt.root; <userinput>pkg_add -r <replaceable>lsof</replaceable></userinput></screen> <screen>&prompt.root; <userinput>pkg_add -r <replaceable>lsof</replaceable></userinput></screen>
<para>The example above would download the correct package and <para>上面這例子會自動下載正確的 package 並安裝。
add it without any further user intervention. 若想改換用其他 &os; Packages Mirror 站,那麼就要設定 <envar>PACKAGESITE</envar> 環境變數,
If you want to specify an alternative &os; Packages Mirror, 如此一來才會取代預設設定。 &man.pkg.add.1;
instead of the main distribution site, you have to set 會用 &man.fetch.3; 指令來下載檔案,而 &man.fetch.3; 本身則會使用相關環境變數的設定,
<envar>PACKAGESITE</envar> accordingly, to 像是:
override the default settings. &man.pkg.add.1; <envar>FTP_PASSIVE_MODE</envar>、<envar>FTP_PROXY</envar> 以及
uses &man.fetch.3; to download the files, which honors various <envar>FTP_PASSWORD</envar>。 如果你網路環境處於 firewall 後面,或者需要用
environment variables, including FTP/HTTP proxy 的話,那麼就需要設定。 設定細節請參閱 &man.fetch.3;。
<envar>FTP_PASSIVE_MODE</envar>, <envar>FTP_PROXY</envar>, and 請注意:上面所說的例子是寫 <literal>lsof</literal> 而非
<envar>FTP_PASSWORD</envar>. You may need to set one or more <literal>lsof-4.56.4</literal>。 當使用遠端抓取功能時,該 package 版號就不必加上去了。
of these if you are behind a firewall, or need to use an &man.pkg.add.1; 會自動下載該軟體的最新版回來安裝。</para>
FTP/HTTP proxy. See &man.fetch.3; for the complete list.
Note that in the example above
<literal>lsof</literal> is used instead of
<literal>lsof-4.56.4</literal>. When the remote fetching
feature is used, the version number of the package must be
removed. &man.pkg.add.1; will automatically fetch the latest
version of the application.</para>
<note> <note>
<para>&man.pkg.add.1; will download the latest version of <para>若用的是 &os.current; 或 &os.stable; 的話,&man.pkg.add.1;
your application if you are using &os.current; or 會自動下載該軟體最新版回來。
&os.stable;. If you run a -RELEASE version, it will grab 若用的是屬於 -RELEASE 版本,那麼他會抓回屬於該 release 上所編譯的 package。
the version of the package that was built with your 也可以更改 <envar>PACKAGESITE</envar> 環境變數,以改變下載方式。
release. It is possible to change this behavior by 舉例來說,如果是 &os;&nbsp;5.4-RELEASE 的話,那麼 &man.pkg.add.1; 預設會從
overriding the <envar>PACKAGESITE</envar> environment <literal>ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5.4-release/Latest/</literal>
variable. For example, if you run a &os;&nbsp;5.4-RELEASE 來抓 package。若要強制 &man.pkg.add.1; 下載 &os;&nbsp;5-STABLE 所用的 package
system, by default &man.pkg.add.1; will try to fetch ,那麼就把 <envar>PACKAGESITE</envar> 改設為
packages from <literal>ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5-stable/Latest/</literal>即可。
<literal>ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5.4-release/Latest/</literal>.
If you want to force &man.pkg.add.1; to download
&os;&nbsp;5-STABLE packages, set <envar>PACKAGESITE</envar>
to
<literal>ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5-stable/Latest/</literal>.
</para> </para>
</note> </note>
<para>Package files are distributed in <filename>.tgz</filename> <para>Package 檔有 <filename>.tgz</filename> 以及 <filename>.tbz</filename> 兩種格式。
and <filename>.tbz</filename> formats. You can find them at <ulink 這些都可透過 <ulink
url="ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/"></ulink>, url="ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/"></ulink>,或者 FreeBSd 光碟內取得。
or on the FreeBSD CD-ROM distribution. Every CD on the Every CD on the
FreeBSD 4-CD set (and the PowerPak, etc.) contains packages FreeBSD 4 光碟套件內以及 PowerPak(威力包) 等等..每一片光碟都會在 <filename>/packages</filename>
in the <filename>/packages</filename> directory. The layout 目錄內放 package。裡面的目錄架構類似 <filename>/usr/ports</filename> 的目錄架構。
of the packages is similar to that of the 每個分類都各自有專屬目錄,且每份 package 都會放在 <filename>All</filename> 目錄內。
<filename>/usr/ports</filename> tree. Each category has its
own directory, and every package can be found within the
<filename>All</filename> directory.
</para> </para>
<para>The directory structure of the package system matches the <para>package 目錄架構與 port 的都一致;它們共同構成整個 package/port 系統機制。</para>
ports layout; they work with each other to form the entire
package/port system.
</para>
</sect2> </sect2>
@ -426,9 +396,7 @@ local: lsof-4.56.4.tgz remote: lsof-4.56.4.tgz
<primary>packages</primary> <primary>packages</primary>
<secondary>managing</secondary> <secondary>managing</secondary>
</indexterm> </indexterm>
<para>&man.pkg.info.1; is a utility that lists and describes <para>&man.pkg.info.1; 可用來列出所有已安裝的軟體、軟體簡介。</para>
the various packages installed.
</para>
<indexterm> <indexterm>
<primary><command>pkg_info</command></primary> <primary><command>pkg_info</command></primary>
@ -437,9 +405,8 @@ local: lsof-4.56.4.tgz remote: lsof-4.56.4.tgz
cvsup-16.1 A general network file distribution system optimized for CV cvsup-16.1 A general network file distribution system optimized for CV
docbook-1.2 Meta-port for the different versions of the DocBook DTD docbook-1.2 Meta-port for the different versions of the DocBook DTD
...</screen> ...</screen>
<para>&man.pkg.version.1; is a utility that summarizes the <para>&man.pkg.version.1; 則是列出所有已安裝的軟體版本。
versions of all installed packages. It compares the package 它會顯示已裝版本以及目前機器上 port tree 的版本差異。
version to the current version found in the ports tree.
</para> </para>
<indexterm> <indexterm>
<primary><command>pkg_version</command></primary> <primary><command>pkg_version</command></primary>
@ -449,9 +416,7 @@ cvsup =
docbook = docbook =
...</screen> ...</screen>
<para>The symbols in the second column indicate the relative age <para>第二欄的符號表示:已安裝的軟體版本與目前機器上 port tree 的版本差異。</para>
of the installed version and the version available in the
local ports tree.</para>
<informaltable frame="none" pgwide="1"> <informaltable frame="none" pgwide="1">
<tgroup cols="2"> <tgroup cols="2">
@ -464,27 +429,22 @@ docbook =
<tbody> <tbody>
<row> <row>
<entry>=</entry> <entry>The version of the <entry>=</entry> <entry>已裝的版本與目前機器上 port tree 的版本是同一版的。
installed package matches the one found in the </entry>
local ports tree.</entry>
</row> </row>
<row><entry>&lt;</entry> <row><entry>&lt;</entry>
<entry>The installed version is older than the one available <entry>與目前機器上 port tree 版本相比起來,已裝的版本較舊。</entry>
in the ports tree.</entry>
</row> </row>
<row><entry>&gt;</entry><entry>The installed version is newer <row><entry>&gt;</entry><entry>與目前機器上 port tree 版本相比起來,
than the one found in the local ports tree. (The local ports 已裝的版本較新。(可能是目前機器上 port tree 尚未更新。)</entry></row>
tree is probably out of date.)</entry></row>
<row><entry>?</entry><entry>The installed package cannot be <row><entry>?</entry><entry>已裝的軟體在 ports 索引內找無相關資料。
found in the ports index. (This can happen, for instance, if an (通常可能是,舉例來說:已安裝的該 port 已從 Ports Collection 中移除或改名了。)
installed port is removed from the Ports Collection or </entry></row>
renamed.)</entry></row>
<row><entry>*</entry><entry>There are multiple versions of the <row><entry>*</entry><entry>該軟體同時有許多版本。</entry></row>
package.</entry></row>
</tbody> </tbody>
</tgroup> </tgroup>
@ -557,41 +517,37 @@ docbook =
<para>請把 <para>請把
<replaceable>cvsup.tw.FreeBSD.org</replaceable> 請改成離你比較近(快)的 <replaceable>cvsup.tw.FreeBSD.org</replaceable> 請改成離你比較近(快)的
<application>CVSup</application> Server <application>CVSup</application> 主機
這部分可以參閱完整的 <link linkend="cvsup-mirrors">CVSup mirror</link> 站列表(<xref 這部分可以參閱完整的 <link linkend="cvsup-mirrors">CVSup mirror</link> 站列表(<xref
linkend="cvsup-mirrors">)。</para> linkend="cvsup-mirrors">)。</para>
<note> <note>
<para>One may want to use his own <para>若想改用自己設的
<filename>ports-supfile</filename>, for example to avoid <filename>ports-supfile</filename>,比如說,不想每次都得打指令來指定所使用的
the need of passing the <application>CVSup</application> <application>CVSup</application> 主機。</para>
server on the command line.</para>
<procedure> <procedure>
<step> <step>
<para>In this case, as <username>root</username>, copy <para>這種情況下,請以 <username>root</username> 權限把
<filename>/usr/share/examples/cvsup/ports-supfile</filename> <filename>/usr/share/examples/cvsup/ports-supfile</filename>
to a new location, such as 複製到其他位置,比如
<filename>/root</filename> or your home <filename>/root</filename> 或者自己帳號的家目錄。</para>
directory.</para>
</step> </step>
<step> <step>
<para>Edit <filename>ports-supfile</filename>.</para> <para>修改新的 <filename>ports-supfile</filename> 檔。</para>
</step> </step>
<step> <step>
<para>Change <para>
<replaceable>CHANGE_THIS.FreeBSD.org</replaceable> <replaceable>CHANGE_THIS.FreeBSD.org</replaceable>
to a <application>CVSup</application> server near 改為離你比較近(快)的 <application>CVSup</application> 主機。
you. See <link linkend="cvsup-mirrors">CVSup 這部分可以參閱完整的 <link linkend="cvsup-mirrors">CVSup
Mirrors</link> (<xref linkend="cvsup-mirrors">) for Mirrors</link> (<xref linkend="cvsup-mirrors">) 站列表</para>
a complete listing of mirror sites.</para>
</step> </step>
<step> <step>
<para>And now to run <command>cvsup</command>, use the <para>然後就開始以類似下列指令跑 <command>cvsup</command></para>
following:</para>
<screen>&prompt.root; <userinput>cvsup -L 2 <replaceable>/root/ports-supfile</replaceable></userinput></screen> <screen>&prompt.root; <userinput>cvsup -L 2 <replaceable>/root/ports-supfile</replaceable></userinput></screen>
</step> </step>
@ -600,52 +556,47 @@ docbook =
</step> </step>
<step> <step>
<para>Running the &man.cvsup.1; command later will download and apply all <para>執行 &man.cvsup.1; 之後,就會開始更新 Ports Collection。
the recent changes to your Ports Collection, except 不過這動作只是『更新』並不是『升級』,不會把已裝的軟體重新編譯、升級。</para>
actually rebuilding the ports for your own system.</para>
</step> </step>
</procedure> </procedure>
<procedure> <procedure>
<title>Portsnap 方式</title> <title>Portsnap 方式</title>
<para>&man.portsnap.8; is an alternative system for distributing the <para>&man.portsnap.8; 也是更新 Ports Collection 的方式之一。
Ports Collection. It was first included in &os;&nbsp;6.0. On older &os;&nbsp;6.0 起開始內建 Portsnap 機制,而較舊的系統,則可透過 <filename
systems, you can install it from <filename role="package">sysutils/portsnap</filename> port 來安裝:</para>
role="package">sysutils/portsnap</filename> port:</para>
<screen>&prompt.root; <userinput>pkg_add -r portsnap</userinput></screen> <screen>&prompt.root; <userinput>pkg_add -r portsnap</userinput></screen>
<para>Please refer to <link linkend="portsnap">Using Portsnap</link> <para><application>Portsnap</application> 細節功能,請參閱
for a detailed description of all <application>Portsnap</application> <link linkend="portsnap">Portsnap 使用篇</link>。</para>
features.</para>
<step> <step>
<para>Create an empty directory <filename <para> <filename
role="directory">/usr/ports</filename> if it does not exists.</para> role="directory">/usr/ports</filename> 目錄不存在的話,就建立一下吧:</para>
<screen>&prompt.root; <userinput>mkdir /usr/ports</userinput></screen> <screen>&prompt.root; <userinput>mkdir /usr/ports</userinput></screen>
</step> </step>
<step> <step>
<para>Download a compressed snapshot of the Ports Collection into <para>接下來,下載壓縮的 Ports Collection 定期更新檔到
<filename role="directory">/var/db/portsnap</filename>. You can <filename role="directory">/var/db/portsnap</filename> 目錄。
disconnect from the Internet after this step, if you wish.</para> 完成下載後,要斷線與否都可以。</para>
<screen>&prompt.root; <userinput>portsnap fetch</userinput></screen> <screen>&prompt.root; <userinput>portsnap fetch</userinput></screen>
</step> </step>
<step> <step>
<para>If you are running <application>Portsnap</application> for the <para>若是第一次跑 <application>Portsnap</application> 的話,則需要先解壓到 <filename
first time, extract the snapshot into <filename role="directory">/usr/ports</filename>
role="directory">/usr/ports</filename>:
</para> </para>
<screen>&prompt.root; <userinput>portsnap extract</userinput></screen> <screen>&prompt.root; <userinput>portsnap extract</userinput></screen>
<para>If you already have a populated <filename <para>若已有 <filename
role="directory">/usr/ports</filename> and you are just updating, role="directory">/usr/ports</filename> 而且只是想更新而已,那麼就照下面作:</para>
run the following command instead:</para>
<screen>&prompt.root; <userinput>portsnap update</userinput></screen> <screen>&prompt.root; <userinput>portsnap update</userinput></screen>
</step> </step>
@ -655,55 +606,51 @@ docbook =
<procedure> <procedure>
<title>Sysinstall 方式</title> <title>Sysinstall 方式</title>
<para>This method involves using <application>sysinstall</application> <para>這方式要用 <application>sysinstall</application> 透過安裝來源來裝 Ports Collection。
to install the Ports Collection from the installation media. Note 請注意:所安裝的 Ports Collection 版本只是該 release 發佈時的版本而已,而非最新。
that the old copy of Ports Collection from the date of the release 若能上網(Internet)的話,請使用上述方式之一會比較好。</para>
will be installed. If you have Internet access, you should always
use one of the methods mentioned above.</para>
<step> <step>
<para>As <username>root</username>, run <para>以 <username>root</username> 權限執行
<command>sysinstall</command> <command>sysinstall</command>
(<command>/stand/sysinstall</command> in &os; (在 &os; 5.2 之前版本則是 <command>/stand/sysinstall</command>),方式如下:</para>
versions older than 5.2) as shown below:</para>
<screen>&prompt.root; <userinput>sysinstall</userinput></screen> <screen>&prompt.root; <userinput>sysinstall</userinput></screen>
</step> </step>
<step> <step>
<para>Scroll down and select <guimenuitem>Configure</guimenuitem>, <para>請以方向鍵移動選擇項目,選擇 <guimenuitem>Configure</guimenuitem>,然後按
press <keycap>Enter</keycap>.</para> <keycap>Enter</keycap> 鍵。</para>
</step> </step>
<step> <step>
<para>Scroll down and select <para>選擇
<guimenuitem>Distributions</guimenuitem>, press <guimenuitem>Distributions</guimenuitem>,然後按
<keycap>Enter</keycap>.</para> <keycap>Enter</keycap> 鍵。</para>
</step> </step>
<step> <step>
<para>Scroll down to <guimenuitem>ports</guimenuitem>, press <para>選擇 <guimenuitem>ports</guimenuitem>,然後按
<keycap>Space</keycap>.</para> <keycap>Space</keycap> 鍵。</para>
</step> </step>
<step> <step>
<para>Scroll up to <guimenuitem>Exit</guimenuitem>, press <para>選 <guimenuitem>Exit</guimenuitem>,然後按
<keycap>Enter</keycap>.</para> <keycap>Enter</keycap> 鍵。</para>
</step> </step>
<step> <step>
<para>Select your desired installation media, such as CDROM, <para>選擇要用的安裝來源比如CDROM(光碟)、FTP 等方式。</para>
FTP, and so on.</para>
</step> </step>
<step> <step>
<para>Scroll up to <guimenuitem>Exit</guimenuitem> and press <para>選 <guimenuitem>Exit</guimenuitem>,然後按
<keycap>Enter</keycap>.</para> <keycap>Enter</keycap> 鍵。</para>
</step> </step>
<step> <step>
<para>Press <keycap>X</keycap> to exit <para>按下 <keycap>X</keycap> 鍵就可離開
<application>sysinstall</application>.</para> <application>sysinstall</application> 程式。</para>
</step> </step>
</procedure> </procedure>
</sect2> </sect2>
@ -715,113 +662,88 @@ docbook =
<primary>ports</primary> <primary>ports</primary>
<secondary>installing</secondary> <secondary>installing</secondary>
</indexterm> </indexterm>
<para>The first thing that should be explained when it comes to <para>提到 Ports Collection首先要先說明的是何謂 <quote>skeleton</quote>。
the Ports Collection is what is actually meant by a 簡單來講port skeleton 就是讓軟體如何在 FreeBSD 順利編譯、安裝的最基本檔案組合。
<quote>skeleton</quote>. In a nutshell, a port skeleton is a 每份 port skeleton 基本上會有:</para>
minimal set of files that tell your FreeBSD system how to
cleanly compile and install a program. Each port skeleton
includes:</para>
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para>A <filename>Makefile</filename>. The <para><filename>Makefile</filename> 檔。
<filename>Makefile</filename> contains various statements 這個 <filename>Makefile</filename> 內容有分許多部分,
that specify how the application should be compiled and 是用來指定要如何編譯,以及該裝在系統的何處。</para>
where it should be installed on your system.</para>
</listitem> </listitem>
<listitem> <listitem>
<para>A <filename>distinfo</filename> file. This file <para><filename>distinfo</filename> 檔。
contains information about the files that must be 編譯該軟體所需下載的檔案、checksum(檢驗檔案用)都會記錄在這檔,
downloaded to build the port and their checksums, to 並會用 &man.md5.1; 相關工具來確保所下載的檔案是正確無誤的。</para>
verify that files have not been corrupted during the
download using &man.md5.1;.</para>
</listitem> </listitem>
<listitem> <listitem>
<para>A <filename>files</filename> directory. This <para><filename>files</filename> 目錄。 這目錄放的是讓軟體正常編譯、安裝的 patch 檔。
directory contains patches to make the program compile and Patches 檔基本上是一些小檔案,並針對特定檔案來做修改,且是純文字檔格式,
install on your FreeBSD system. Patches are basically 基本上內容通常會像是 <quote>Remove line 10(刪除第 10 行)</quote> 或
small files that specify changes to particular files. <quote>Change line 26 to this ...(把第 26 行改為...)</quote> 之類的。
They are in plain text format, and basically say 這些 Patches 通常也稱為 <quote>diffs</quote>
<quote>Remove line 10</quote> or <quote>Change line 26 to ,因為都是由 &man.diff.1; 程式所產生的。</para>
this ...</quote>. Patches are also known as
<quote>diffs</quote> because they are generated by the
&man.diff.1; program.</para>
<para>This directory may also contain other files used to build <para>此外,本目錄也可能會放一些協助編譯該 port 的檔案。</para>
the port.</para>
</listitem> </listitem>
<listitem> <listitem>
<para>A <filename>pkg-descr</filename> file. This is a more <para><filename>pkg-descr</filename> 檔,內容是比較詳細的軟體介紹,通常會寫得比較多行。</para>
detailed, often multiple-line, description of the program.</para>
</listitem> </listitem>
<listitem> <listitem>
<para>A <filename>pkg-plist</filename> file. This is a list <para><filename>pkg-plist</filename> 檔,該 port 會安裝的所有檔案清單。
of all the files that will be installed by the port. It 也是告訴系統在移除該 port 時,需要刪除哪些檔案。</para>
also tells the ports system what files to remove upon
deinstallation.</para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
<para>Some ports have other files, such as <para>有些 port 還會有其他檔案,像是 <filename>pkg-message</filename> 檔。
<filename>pkg-message</filename>. The ports system uses these port 系統在一些情況時,會用這些檔案。
files to handle special situations. If you want more details 如果想知道這些檔案的更多細節用途,以及 port 一般用法,請參閱 <ulink
on these files, and on ports in general, check out the <ulink
url="&url.books.porters-handbook;/index.html">FreeBSD Porter's url="&url.books.porters-handbook;/index.html">FreeBSD Porter's
Handbook</ulink>.</para> Handbook</ulink></para>
<para>The port includes instructions on how to build source <para>port 內寫的是告訴系統如何編譯 source code 的相關指令,但並不是真正的 source code。
code, but does not include the actual source code. You can 而 source code 可以從光碟或網路(Internet)來取得,
get the source code from a CD-ROM or from the Internet. 該軟體開發者可能會把 source code 以各種格式來發佈。
Source code is distributed in whatever manner the software 通常是以 tar 以及 gzip 這兩者工具一起壓縮的檔案,也有可能是以其他工具壓縮,或根本沒壓縮。
author desires. Frequently this is a tarred and gzipped file, 而軟體的 source code 無論是以哪一種壓縮檔型態,我們都稱之為 <quote>distfile</quote>。
but it might be compressed with some other tool or even 下面將介紹兩種安裝 &os; port 的方式。</para>
uncompressed. The program source code, whatever form it comes
in, is called a <quote>distfile</quote>. The two methods for
installing a &os; port are described below.</para>
<note> <note>
<para>You must be logged in as <username>root</username> to <para>要安裝 port 的話,請務必切為 <username>root</username> 身份。</para>
install ports.</para>
</note> </note>
<warning> <warning>
<para>Before installing any port, you should be sure to have <para>在安裝任何 port 之前,請務必確認有更新 Ports Collection 到最新版,
an up-to-date Ports Collection and you should check <ulink 此外請檢閱 <ulink
url="http://vuxml.freebsd.org/"></ulink> for security issues url="http://vuxml.freebsd.org/"></ulink> 來檢查所要裝的 port
related to your port.</para> 是否有相關安全漏洞議題需要注意的。</para>
<para>A security vulnerabilities check can be automatically <para><application>portaudit</application> 會在安裝任何 port 之前,
done by <application>portaudit</application> before any new 先自動檢查是否有相關已知的安全漏洞。這個工具在 Ports Collection 內有
application installation. This tool can be found in the (<filename role="package">security/portaudit</filename>)。
Ports Collection (<filename 在安裝 port 之前,可以先跑 <command>portaudit -F</command> 指令,
role="package">security/portaudit</filename>). Consider 如此一來就會抓最新的資安漏洞資料庫回來核對。
running <command>portaudit -F</command> before installing a 每天的系統定期安檢會自動更新資料庫,並作安全稽核。
new port, to fetch the current vulnerabilities database. A 詳情請參閱 &man.portaudit.1; 以及 &man.periodic.8; 的線上說明。</para>
security audit and an update of the database will be
performed during the daily security system check. For more
information read the &man.portaudit.1; and &man.periodic.8;
manual pages.</para>
</warning> </warning>
<para>The Ports Collection makes an assumption that you have a working <para>Ports Collection 會假設你的網路是可正常連線的。
Internet connection. If you do not, you will need to put a copy of the 如果沒有的話,那麼需手動把所需的 distfile 檔複製到
distfile into <filename>/usr/ports/distfiles</filename> <filename>/usr/ports/distfiles</filename> 才行。</para>
manually.</para>
<para>To begin, change to the directory for the port you want to <para>開始操作之前,要先進入打算安裝的 port 目錄內:</para>
install:</para>
<screen>&prompt.root; <userinput>cd /usr/ports/sysutils/lsof</userinput></screen> <screen>&prompt.root; <userinput>cd /usr/ports/sysutils/lsof</userinput></screen>
<para>Once inside the <filename>lsof</filename> directory, you <para>一旦進入 <filename>lsof</filename> 目錄後,就可以看到這個 port 的 skeleton 結構。
will see the port skeleton. The next step is to compile, or 接下來,就是編譯,也就是 <quote>build</quote> 這個 port。
<quote>build</quote>, the port. This is done by simply 只需簡單輸入 <command>make</command> 指令,就可輕鬆完成編譯。
typing <command>make</command> at the prompt. Once you have 完成後,應該可以看到類似下面訊息:</para>
done so, you should see something like this:</para>
<screen>&prompt.root; <userinput>make</userinput> <screen>&prompt.root; <userinput>make</userinput>
&gt;&gt; lsof_4.57D.freebsd.tar.gz doesn't seem to exist in /usr/ports/distfiles/. &gt;&gt; lsof_4.57D.freebsd.tar.gz doesn't seem to exist in /usr/ports/distfiles/.
@ -843,11 +765,9 @@ docbook =
... ...
&prompt.root;</screen> &prompt.root;</screen>
<para>Notice that once the compile is complete you are <para>請注意:編譯完成後,就會回到提示列(prompt)。接下來就是安裝該 port 了,
returned to your prompt. The next step is to install the 要裝的話,只需在原本的 <command>make</command> 指令後面再加上一個字即可,
port. In order to install it, you simply need to tack one word 那個字就是 <command>install</command></para>
onto the <command>make</command> command, and that word is
<command>install</command>:</para>
<screen>&prompt.root; <userinput>make install</userinput> <screen>&prompt.root; <userinput>make install</userinput>
===&gt; Installing for lsof-4.57 ===&gt; Installing for lsof-4.57
@ -862,42 +782,35 @@ docbook =
increased privileges. increased privileges.
&prompt.root;</screen> &prompt.root;</screen>
<para>Once you are returned to your prompt, you should be able to <para>一旦回到提示列(prompt),就可以執行剛裝的程式了。
run the application you just installed. Since 另外,因為 <command>lsof</command> 這程式執行時會有額外權限,
<command>lsof</command> is a 所以會出現安全警告。在編譯、安裝 port 的時候,
program that runs with increased privileges, a security 請留意任何出現的警告。</para>
warning is shown. During the building and installation of
ports, you should take heed of any other warnings that
may appear.</para>
<para>It is a good idea to delete the working subdirectory, <para>此外,建議刪除編譯用的工作目錄(預設是 <filename>work</filename>)
which contains all the temporary files used during compilation. 這目錄內為在編譯過程中所用到的一些臨時檔案,
Not only it consumes a valuable disk space, it would also cause 這些檔案不只佔硬碟空間,而且也可能會在該 port 升級新版時,
problems later when upgrading to the newer version of the port.</para> 造成不必要的困擾。</para>
<screen>&prompt.root; <userinput>make clean</userinput> <screen>&prompt.root; <userinput>make clean</userinput>
===&gt; Cleaning for lsof-4.57 ===&gt; Cleaning for lsof-4.57
&prompt.root;</screen> &prompt.root;</screen>
<note> <note>
<para>You can save an extra step by just running <command>make <para>用 <command>make install clean</command> 就可以一口氣完成剛所說
install clean</command> instead of <command>make</command>, <command>make</command>、<command>make install</command>、
<command>make install</command> and <command>make clean</command> <command>make clean</command> 這三個步驟了。</para>
as three separate steps.</para>
</note> </note>
<note> <note>
<para>Some shells keep a cache of the commands that are <para>有些 shell 會依據 <envar>PATH</envar> 環境變數的路徑,
available in the directories listed in the 把那些路徑的執行檔 cache 起來,來加速搜尋執行檔。
<envar>PATH</envar> environment variable, to speed up 如果你用的是這類的 shell那麼在裝完 port 後需要打
lookup operations for the executable file of these <command>rehash</command> 指令,才能執行新裝的執行檔,而
commands. If you are using one of these shells, you might <command>rehash</command> 指令可以在 <command>tcsh</command>
have to use the <command>rehash</command> command after 之類的 shell 上使用,若是 <command>sh</command> 的話,則是
installing a port, before the newly installed commands can <command>hash -r</command>。
be used. This command will work for shells like 詳情請參閱你所使用的 shell 相關文件。</para>
<command>tcsh</command>. Use the <command>hash -r</command>
command for shells like <command>sh</command>. Look at the
documentation for your shell for more information.</para>
</note> </note>
<para>Some third party DVD-ROM products such as the FreeBSD Toolkit <para>Some third party DVD-ROM products such as the FreeBSD Toolkit