22. Adding and Installing Software
Introduction to FreeBSD

Adding/installing software in FreeBSD is easy. FreeBSD maintains a set of "packages" that are pre-built, ready to run binaries of almost all the popular programs out there. If you have the CD set, they are all on CD#1, which you can browse directly (there's a directory called packages..), or use the "/stand/sysinstall" tool, go to Post Configuration, and choose Packages. You'll get a nice little screen with all the packages categorized with a short description.

Often, you might want to ftp to ftp.freebsd.org to get the latest version of a package - ftp://ftp.freebsd.org/pub/FreeBSD/packages-stable is probably where you want to look. If you download a package, it will have a .tgz ending. You don't need to manually untar/expand this file. Just use the command pkg_add".

Ex: I've downloaded the packages called spaz-1.32.tgz

  • 1. su to root (you need to be root to install packages)

  • 2. pkg_add spaz-1.32.tgz

That's it! Now the package is installed and setup on your system. If you're using csh or tcsh, you should type rehash for your shell to rescan your system bin directories...

The package is registered in the /var/db/pkg directory - you can cd to there and get a directory listing to see what packages you have installed on your system. If you no longer want a package, you can remove it with the pkg_delete command: pkg_delete spaz-1.32.tgz (from the /var/db/pkg directory)

The FreeBSD ports system works exactly the same, with port registration making it easy to remove things you don't want afterwards.. The difference is that the ports are in "Source" form, and need to be compiled. If you have an Internet connection up, and have the ports tree installed (you were asked if you wanted it installed during the installation of FreeBSD) you can cd /usr/ports and take a look around.

Say you wanted to install the port from the /usr/ports/net/spaz directory -

  • 1. su root

  • 2. cd /usr/ports/net/spaz

  • 3. make

    Note:

    (-> at this point the make program will actually download the port for you!

  • 4. make install (if the make above succeeded fine, you can "make install" to actually install the fruits of your labour to the system bin/lib directories where it's now ready to use

  • 5. make clean (if you want to save space and clean up the object files and such that were created from the compile

Once again, you use the pkg_delete program in /var/db/pkg to remove the ports that you have installed.

Return to Table of Contents

Visit the Gifcom