FreeBSD Stable Release 6.0 Installer  Guide



Ports & Packages

The 3rd Party Software Applications Collection.

FBSD has a very large collection of over 10,100 Unix flavored software applications which have been 'ported' (IE: converted) to install and run on the FBSD system. The ports collection is constructed using five small config files for each software application port. These config files contain all the necessary information to allow your system to automatically download, unpack, patch, compile, and install the port. Downloading these config files does not install the actual port program. After downloading the port's config files, you have to change into the directory structure on your system where the port you want to install has its port config files located and then issue the 'make install clean' command to really install the port. The FBSD documenters of the port application used the brute force method in the design of how they tell you to manage the ports collection on your system. Their recommended method entails the downloading of all the 5 small config files for each of all the 10,100 ports available. This may consume all your hard drive disk space and on a slow Internet connection take so long that your download task gets suspended or timed out by the FBSD ports FTP server. The ports applications are grouped into categories, and you can bypass categories you have no interest in. But even doing that, most categories still contain hundreds of applications. The shortcuts that eliminate this brute force approach are absent from the official documentation.

The brute force approach is not covered here, only the shortcut approach that results in only downloading the config files of the selected ports is covered.

To simplify the ports collection and eliminate the huge disk storage requirements while also drastically reducing the download bandwidth requirement, a large percent (96%) of the ports have been pre-installed and converted into packages. The ones which are not made into packages have technical or legal license restrictions about distribution of binary versions. Installing a package version of a software application does not require any resident config files or compiling. It's just a matter of the package loading the pre-compiled binary execution modules to their directory locations on your running system. Even the downloaded package is deleted after it installs itself. If the packaged software application depends on one or more other software applications to function, the packaged version of those dependents will be automatically downloaded and installed if they are not already on your system. This is definitely more convenient, uses much less disk space, and most important, the download is smaller and quicker on dial in type of Internet connections.

So really the 3rd Party Software Applications Collection is maintained in two separate collections, the ports collection and the packages collection. The cvsup program is used by the ports collection to control the selection and downloading of the config files, and then the 'make' program does the actual install. The 'pkg_add' program is used for the package collection to select, download, and install the desired package.

Installer Note: Lets be absolutely clear what the FBSD 3rd Party Software Collection is comprised of. When a complete software application, or some special purpose code, or some new function to a member of the current 3rd Party Software Collection is found on any of the other license free Unix flavored operating systems or from any of the Unix shareware development sites, the volunteer members of the ports team create the FBSD five port config files necessary to install that item on a FBSD system. The problem with this process is that there is no documentation generated by the individual creating the port config files on what the intended purpose is, how to use it or configure the software the port delivers. After you cvsup download the port’s config files and install it on your system, it’s just there and it’s up to you to try to figure out from where to use it and just what it’s suppose to do. The FBSD 3rd Party Software Collection is not a library collection of professional grade software. It’s a collection of legally contributed bits and pieces of code, and in some cases complete applications which have their own separate maintenance team and documentation totally unrelated to the FBSD project. Some of the ports you see with massive dependency lists are really pre-configured desktop environments for the x-graphical server. Even the fact that this is what the port is, is not even expressed in any way. This lack of an informative narrative overview on the majority (IE: 95 percent) of the 10,100 members of the 3rd Party Software Collection leaves many a person totally confused as to what to do next. This is just another symptom of the lack of standards and enforcement common to an all volunteer organization. The only way to fix this problem is when you figure out how to configure and use the port, you should write your own narrative overview synopsis of 300 words or less and then submit a port problem report requesting your included synopsis to be added to the ports description or comments config files.


Determining What To Install

With 10,100+ 3rd Party Software Applications to choose from, the task of finding the correct Software Application that meets your needs can be a very hard task indeed.

The FBSD online web site provides three aides to help you in your quest.

1. An application name search by FBSD release distributions                       

2. A category index with application name search

3. And the alphabetic list in internal name order of the latest versions

The overall collection is just so darn large, and even some of the categories are so large it's just such a hard task navigating around looking and reading descriptions, that a person becomes overwhelmed. I found it's easier to ask a question on the FBSD questions mailing list describing what I wanted to do or what I was looking for, and have somebody recommend an application. With an application name in hand, I used one of the tools above to drill down into the listing of the collection, looking to see what other similar applications are out there around the individual application I an interested in.


Finding the Application Download Name

Once you find an application you want to install, you have to find its download name that is used by cvsup for the ports collection and by pkg_add for the package collection. All of the three FBSD online web site aides display the internal application name with its version suffix and this misleads the reader into using it as the application name, which is incorrect.

Example: I am interested in the Apache server application and from the response I received from the questions list I know it’s in the WWW category. Using the FBSD online web site aide  I do the following:

Enter the word apache in the search argument box on the far left.

In the distribution box on the right just before the search button, I use the pull down arrow and select the 4.10-RELEASE/i386 to identify my FBSD system, because this is the release distribution pkg_add defaults to using.

Click on the search button to launch the search.

The search returns a display of every application where the word apache was found grouped by category. The results show me all the applications that are in any way related to apache, most are extensions, add-ons, or plug-ins, until you come to the WWW category. This is what is displayed for apache-1.3.29_1.

The extremely popular Apache http server. Very fast, very clean
Maintained by:
Requires: expat-1.95.6_1
Description : Sources : Changes : Download

The ‘Description : Sources : Changes : Download’ line contain links.

Click on the Description link and another display comes up.

The heading of the display says ‘Port description for www/apache13’

WWW is the category and apache13 is the download name which is used by both the ports and package collections.

You can see that our apache example requires one other application to function, indicated by the 'Requires:' field.

The package system will automatically download and install all the interdependencies for you.

If you chose to use the ports system, you need to click on the required dependent link and it will show you its details. Then click on its Description link to get its category and download name. Sometimes dependents have there own dependences. You have to insure that all the interrelated dependenices have their port config files downloaded by cvsup before you start installing the parent port you selected. You should be writing down the category and port’s download name for the port you want and all of its dependents and their dependents, you will need it later when you go to build the control statements to tell cvsup what config files to download.

You are beginning to see that there is a lot of prep work to installing only port config files for the ports you want. This is why many people just select the complete category and download all the config files so they do not have to mess with the manual research to determine the interrelated dependencies and download their config files. They trade off disk space, longer backup times, and consumed bandwidth for being lazy. It's really up to you how you do it in the end.

You should also realize from this explanation just how convenient the package collection is to use.


Package Benefits

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

Packages do not require any additional compilation. For large applications, such as Mozilla, KDE, OpenOffice or GNOME this can be very important, particularly if you are running on a PC with legacy CPU megahertz’s speeds (IE: less than 800 megahertz).

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

Packages do not require the downloading and permanent inventory on your system's hard drive of the five separate mandatory config files per application and their interrelated dependences config files.

Packages by their very nature are appropriate for users who have 56K modem access to the Internet.

Packages are for users who have no interest in or lack the ability to read or hack the source application code.


Ports Benefits

Some applications have other applications which are add-ons or plug-ins that add additional functions to the base application. For example, Apache can be configured with a wide variety of different add-on functions. By building from the port you do not have to accept the default install 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.


Using the Package Collection

Installer Note: The pkg_add –r command uses the fetch command which is really a wrapper for the FTP command. It defaults to using FTP passive mode. It’s a mandatory requirement that your firewall rules allow the FTP port 21, and FTP’s passive data port > 1024, bi-directional access to the public Internet. Otherwise you will never be able to use the package collection.

The pkg_add command is used to fetch and install a package. The command syntax is

pkg_add -rv xxxxx

Where xxxxx is the download name you retrieved above. The -r means to fetch from the remote FBSD ftp server, the 'v' means to be verbose in displaying messages about what is happening. For example:

pkg_add -rv apache13

This command will fetch the requested package from the remote FTP server, download the package file to a temporary location on your system, determine if it has dependences and first download and install them in correct order, then execute itself to move the execution binaries to the proper locations in the directory tree, and then remove its downloaded package file and all its temporary work files.

After installing a package you have to issue the 'rehash' command which tells your shell to scan through all the /bin directories defined in your /root/.chsrc file path statement looking for new unknown programs or scripts and build an entry in its internal hash table of available commands for it. Remember this command, as you will have to use it after every port or package install.



Alternate Access Method To The Package Collection

When you use one of the FBSD online aids to search the third party software application collection you are always shown the official name with the version suffix. For some unknown reason the pkg_add command does not use this name, but instead uses a name which does not have the version suffix.

The pkg_add command defaults to using a directory path that targets the ‘Latest’ directory. This directory contains the names on all the 10,200 packages without the version suffix, and its massive size makes it almost impossible to manually verify the name by FTPing there by hand. The package FTP site also maintains a directory tree structure of all the categories containing package names with the version suffix which are really links back to the ‘All’ directory, which is where the package really lives.

I have found it much more convenient and reliable to use the pkg_add environment variable ‘PACKAGESITE’ to change the default path location to use the category directory structure and the official package name with its version suffix that is easily found by the online aids. This makes it much easier to manually verify the name by FTPing there by hand, because the target category only contains the names belonging to that category and not all 9,600 packages. Another benefit is the directory ‘packages’ is linked to packages-4-stable which contains more current versions of the packages.


echo $PACKAGESITE will display the contents of the variable.

The pkg_add command will now use a different format:

    pkg_add –rv /category/full-official-name

So using the official package name for apache you would enter:

    pkg_add –rv /www/apache-1.3.29_1


After setting the environment variable ‘PACKAGESITE’, it only stays enabled for the duration of your login session. It’s best to set this permanently.

Edit /root/.cshrc and add the following setenv statement to make this permanent.


Log off and log back on to enable your changes.

Any time you want to temporarily disable this Alternate Access method, just edit your /root/.cshrc file and comment out the setenv PACKAGESITE statement, and logoff and log back on.


For a non-permanent, one-time temporary use of a different directory path, you can use this form of the pkg_add command.

pkg_add -v,1.tgz

pkg_add -v


This FreeBSD Installer Guide is an public domain HOW-TO.  This content may be reproduced, in any form or by any means, and used by all without permission in writing from the author.