[FreeBSD] package & ports

The package contains pre-compiled copies of all the commands for the application, as well as any configuration files or documentation. A downloaded package file can be manipulated with FreeBSD package management commands, such as pkg_add(1), pkg_delete(1), pkg_info(1), and so on. Installing a new application can be carried out with a single command.

A FreeBSD port for an application is a collection of files designed to automate the process of compiling an application from source code.You run a handful of simple commands and the source code for the application is automatically downloaded, extracted, patched, compiled, and installed for you.

In fact, the ports system can also be used to generate packages which can later be manipulated with pkg_add and the other package management commands

Both packages and ports understand dependencies.

[Package 與 Ports 各自的特色]
Package Benefits


A compressed package tarball is typically smaller than the compressed tarball containing the source code for the application.

Packages do not require any additional compilation. For large applications, such as Mozilla, KDE, or GNOME this can be important, particularly if you are on a slow system.

Packages do not require any understanding of the process involved in compiling software on FreeBSD.

Ports Benefits


Packages are normally compiled with conservative options, because they have to run on the maximum number of systems. By installing from the port, you can tweak the compilation options to (for example) generate code that is specific to a Pentium IV or Athlon processor.

Some applications have compile time options relating to what they can and cannot do. For example, Apache can be configured with a wide variety of different built-in options. By building from the port you do not have to accept the default options, and can set them yourself.

In some cases, multiple packages will exist for the same application to specify certain settings. For example, Ghostscript is available as a ghostscript package and a ghostscript-nox11 package, depending on whether or not you have installed an X11 server. This sort of rough tweaking is possible with packages, but rapidly becomes impossible if an application has more than one or two different compile time options.

The licensing conditions of some software distributions forbid binary distribution. They must be distributed as source code.

Some people do not trust binary distributions. At least with source code, you can (in theory) read through it and look for potential problems yourself.

If you have local patches, you will need the source in order to apply them.

Some people like having code around, so they can read it if they get bored, hack it, borrow from it (license permitting, of course), and so on.

[查詢你不知道在 Ports 目錄樹裡那裡的套件: whereis]
# whereis lsof
lsof: /usr/ports/sysutils/lsof

[若你沒有放在 local的package, pkg_add -r 會自動決定正確的release 並從FTP fetch and install]
# pkg_add -r lsof

[如果你想要指定 mirror server]
If you want to specify an alternative FreeBSD Packages Mirror, instead of the main distribution site, you have to set PACKAGESITE accordingly, to override the default settings.

[如果打開 remote fetching, pkg_add 會自動抓取最新的版本]
Note that in the example above lsof is used instead of lsof-4.56.4. When the remote fetching feature is used, the version number of the package must be removed. pkg_add(1) will automatically fetch the latest version of the application.

[如果FreeBSD是-RELEASE version, 它只會幫你抓取在那個RELEASE版本的application, 如果是-CURRENT or -STABLE version, 它會抓取最新的applicatoin.團契的版本好像是 FreeBSD 4.3. 我找了半天竟然不知道查FreeBSD版本的指令為何!!! ]
[超級大笨蛋: 在phoinfo.php 就可以知道了 FreeBSD http://www.canaan.org.tw 5.4-STABLE FreeBSD 5.4-STABLE #4: Sat Oct 29 23:18:48 CST 2005 ]
Note: pkg_add(1) will download the latest version of your application if you are using FreeBSD-CURRENT or FreeBSD-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 PACKAGESITE environment variable. For example, if you run a FreeBSD 5.4-RELEASE system, by default pkg_add(1) will try to fetch packages from ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5.4-release/Latest/. If you want to force pkg_add(1) to download FreeBSD 5-STABLE packages, set PACKAGESITE to ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5-stable/Latest/.


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: