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