FreeBSD  Release  12.0  Install  Guide

Home______________________________________________________________________

 

Using the Ports Collection

Installer Note: The svn command uses the tcp port 3690. It’s a mandatory requirement that your firewall rules allow the tcp port 3690 bi-directional access to the public Internet. Otherwise you will never be able to use svn to manage your ports collection.

The svn command "IE; subversion" and the "pkgng" system is not delivered in the base FBSD system. You have to issue commands to install them. The base system does contain a small bootstrap program to download and install the "pkgng" application. After logging in as user "root", issue this command.

    pkg

It issues a message "Reply Y to continue", to disable this, issue this commend

    echo "ASSUME_ALWAYS_YES  :  yes" > /usr/local/etc/pkg.conf


To install the svn command subversion software issue this command

    pkg install subversion



At this point your ready to populate the hosts /usr/ports directory filesystem with a complete ports collection. There are 2 ways to do this, you can use svn or portsnap. As shown here this will populate your host with the complete ports collection.

    svn checkout svn://svn.freebsd.org/ports/head /usr/ports

or

    portsnap fetch && portsnap extract

 

Downloading Makefiles for Single Port

As the host administrator you have the option to choose what method you want to use to manage the software applications you want running on your host. You can choose the "port method" or the "package method". If you choose the "package method" there may be certain ports that for whatever reason they have to be compiled using the "port method". There is no mandatory requirement to populate your host's hard drive with port config files for the complete ports collection just to compile a few ports. All you really need is the port config files for the few ports you want to install minus their dependents.

Before a port will compile the /usr/ports filesystem needs to be populated with the basic things necessary for the "make" command to work. The following svn commands will populate the correct items.


    svn checkout svn://svn.freebsd.org/ports/head/MK /usr/ports/MK
    svn checkout svn://svn.freebsd.org/ports/head/Templates /usr/ports/Templates
    svn checkout svn://svn.freebsd.org/ports/head/Tools /usr/ports/Tools



This can also be accomplished by modifying the /etc/portsnap.conf file by enabling REFUSE statements for categories like shown below.


# These catagories will not be populated to /usr/ports directory.
#
REFUSE arabic chinese french german hebrew hungarian japanese
REFUSE korean polish portuguese russian ukrainian vietnamese
REFUSE accessibility astro audio benchmarks biology cad finance games
REFUSE irc java math mbone multimedia net-im net-p2p news palm science
REFUSE x11 x11-clocks x11-drivers x11-fm x11-fonts x11-servers
REFUSE x11-themes x11-toolkits x11-wm
#
REFUSE archivers shells comms converters databases deskutils devel
REFUSE dns editors emulators ftp graphics lang mail misc net net-mgmt
REFUSE ports-mgmt print security textproc www sysutils
#
# The following catagories will be populated to /usr/ports directory
# They are necessary in the ports tree so the "make command"  will work.
#REFUSE MK Templates Tools
 

Then execute the portsnap commands

    portsnap fetch && portsnap extract

 

Now your ready to populate the /usr/ports filesystem with the make files for the port you need to compile. This can be done using svn or portsnap, staying with our apache22 example;

    svn checkout svn://svn.freebsd.org/ports/head/www/apache22 /usr/ports/www/apache22

or

    portsnap extract www/apache22

Now your ready to to compile the apache22 port

cd /usr/ports/www/apache22         # change into directory

pkg install apache22               # install package and all dependents

pkg delete apache22                # delete apache package leaving behind dependents

make install clean                 # show config screen and compile the port

This last command will read the apache22 port config files; present you with a configuration option screen where you select the options you want, then download the apache22 distribution source file, compile and install it; and finish up by posting them as installed into the ports/package install history database. During this process you will see massive messages roll off your screen. There is no log to review later if there is a problem installing.

What I do to create a log of the install process; is start the script program to capture everything displayed to the console screen to a file for later review before issuing the ‘make install’ command. You do that like this:

script /root/apache22.install.rpt   # you can name the file anything you want
exit                                # exit to stop script recording.

 

Ports/Package Install History Database Commands

There are five package commands; two are specific to the package applications and the remaining apply to both the installed ports and installed packages. I am not going into details about the commands, because the man pages are pretty clear and easy to understand. Where xx is the port/package name.

pkg install xx # Fetch package from remote server and install it, 
 
pkg_create xx  # Create package out of port you have installed

pkg info xx    # Create list of installed ports and packaged on your 
               # system from the installed software history database.

pkg delete xx  # Delete installed port or package. Uses the name 
               # from the pkg info list display.
              
 

 

Port Make Commands

The 'man make' info is not the correct place to look for the 'make sub-commands' for installing ports. Instead use the 'man ports' page instead. It's very important that you understand that for the make command to be successful, all the config files for all the dependencies and all their dependencies have to be on your system’s hard drive in the correct directory tree layout. If you missed downloading one of the sub-dependency's config files then the parent port does not know it's missing and you will get compile errors for something missing.

You must cd into the directory of the port you want to install before executing any of the following commands.

make install             # Normal way to install port

make install clean       # Remove the expanded source code,
                         # including the dependencies at completion
                    
make install distclean   # Remove expanded source code &  
                         # distribution files, including the
                         # dependencies at completion
                      
make all-depends-list    # List all dependent ports

make fetch               # This will fetch the distribution file

make fetch-recursive     # This will fetch all the distribution  
                         # files of the port and for all its
                         # dependencies.

make checksum-recursive  # This will fetch all the distribution  
                         # files of the port and for all its 
                         # dependencies and checksums them.



 

 

Previous Page                                        Next Page         

This FreeBSD Install 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.