[ Current Issue Home | Issue #2 Home | FAQ ]��

The FreeBSD 'zine
Monthly Articles: Newbie's Corner
## Installing Ports
## Dan Langille <>

FreeBSD programs

FreeBSD has many programs, also known as applications, and are often referred to as ports. Ports are an easy and simple way to install new software. The port knows what other libraries it needs and it goes and gets them. If it can't find them at one site, it will search other sites. I've found ports to be extremely reliable and easy to use. You can also use a package, but my success rate with packages is very low when compare to parts. But for more information in packages, see section "6.1. So, where are all the user applications?" of the FreeBSD Handbook. Another important point is that packages are not available for all ports.

So where are all these ports?

On your machine, you'll find the ports installed at /usr/ports. They are divided into various categories such as graphics, net, security, www, mail, editors, etc. You should be able to find what you want, when you want it. You can also view the list of ports maintained . At the time of writing, there were 2041 ports.

The ports are also maintained on the various FTP servers around the world. You'll find the ports at ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/. This is the main site. But you should also be aware that there are many servers and that the mirror sites will probably be faster for you. I recommend you have a look at for a site close to you.

Installing a single port

Ports are updated all the time. The easiest way to get the latest port is to grab it from the Internet. For that, you should follow the instructions at "4.3.2. Compiling ports from the Internet" in the FreeBSD Handbook.

Here's an example from the that section:

	# cd /usr/ports
	# mkdir databases
	# cd databases
	# ftp ftp.freebsd.org
	        [log in as `ftp' and give your email address when asked for a
	        password.  Remember to use binary (also known as image) mode!]
	> cd /pub/FreeBSD/ports/ports/databases
	> get gnats.tar		[tars up the gnats skeleton for us]
	> quit
	# tar xf gnats.tar	[extract the gnats skeleton]
	# cd gnats
	# make install		[build and install gnats]
  

Getting all the ports

In the previous section, you saw that in order to install a port, you first had to connect to the FTP server, then get the tar file, then extract it, etc. Well, I have a great time saver for you. It consists of doing the repetitive bits first and only once and it only requires a small bit of disk space.

First, I must explain that this step does not install all of the ports. Rather, it sets up the files which will enable you to just issue the "make" command. Here's how I did this:

	/stand/sysinstall
	Configure
	Distributions
	ports
  

When you select ports above, make sure you press the space bar. Then go down and press Exit. Then select the Installation Media. I selected CD-ROM. Note that you may have to go to the Options screen and set the Release Name.

I waited for about 30 minutes while the files were transferred to my hard drive. If you select FTP, you will probably have to wait bit long. But either way, it will make your life easier in the long run.

Using CVSUP

CVSup is a mechanism for maintaining the FreeBSD source code tree. But you can use it to keep a list of the current ports. Here's how to install CVSup and get it running.

I have decided to follow the -stable branch. And as the -stable instructions say, the first thing I did was subscribe to the freebsd-stable and cvs-all mailing lists. Then I installed followed the instructions for CVSup. Ironically, this involves installing a port first. But I'll show you what I did.

There are three options for CVSup. I chose the statically linked executables. This avoids the need for the Modula-3 libraries, which are rather large and compiling them is a lengthy process.

As I already had all the ports installed (as described in the previous section), here's what I did to install CVSup.

	[root@ns:/usr/ports/net/cvsup-bin] # cd /usr/ports/net/cvsup-bin/
	[root@ns:/usr/ports/net/cvsup-bin] # make
	>> cvsup-bin-15.4.2.tar.gz doesn't seem to exist on this system.
	>> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/CVSup/
	fetch: ftp.freebsd.org: Not logged in
	>> Attempting to fetch from ftp://ftp.cs.tu-berlin.de/pub/FreeBSD/CVSup/
	Receiving cvsup-bin-15.4.2.tar.gz (1099198 bytes): 100%
	1099198 bytes transfered in 28.0 seconds  (38.40 Kbytes/s)
	===>  Extracting for cvsup-bin-15.4.2
	>> Checksum OK for cvsup-bin-15.4.2.tar.gz.
	===>  Patching for cvsup-bin-15.4.2
	===>  Configuring for cvsup-bin-15.4.2
	cd /usr/ports/net/cvsup-bin/work/cvsup-bin-15.4.2; gunzip cvsup.1.gz
	[root@ns:/usr/ports/net/cvsup-bin] # make install
	===>  Installing for cvsup-bin-15.4.2
	cd /usr/ports/net/cvsup-bin/work/cvsup-bin-15.4.2;
	install -c  -o bin -g bin -m 555 cvsup /usr/local/bin;
	install -c -o bin -g bin -m 444 cvsup.1 /usr/local/man/man1
	===>   Generating temporary packing list
	===>   Compressing manual pages for cvsup-bin-15.4.2
	===>   Registering installation for cvsup-bin-15.4.2
  

Configuring CVSup

You will need a sup file to start with. And you'll find several examples in /usr/share/examples/cvsup/. We'll be using ports-supfile as found in that directory. I copied that file to /usr/home and modified it to suit my needs.

I changed my cvsup host to the one closest to me:

	*default host=cvsup.au.FreeBSD.ORG
  

I changed the base directory where the status files will be maintained. Don't forget to create this directory.

	*default base=/usr/local/etc/cvsup
  

Running CVSup

I'm behind a firewall, so I used the following command to start my update (you need to do this as root).

	cvsup -P m ports-supfile
  

The -P ensure you get passive mode, which allows cvsup to work behind a firewall.

If you want to know how to run a test of the above, without changing any files, you can do this instead:

	mkdir /var/tmp/dest
	cvsup -P m ports-supfile /var/tmp/dest
  

For this, you don't have to be root. You just need read access to /usr/src. The files will be placed in /var/tmp/dest.

Hope this gets you on your way,

- Dan

Return to Issue #2

Contact: <>
Last modified: $Date: 1999/06/26 05:20:33 $
Copyright � 2023, The FreeBSD 'zine
All rights reserved.