Using the Ports collection

For those who don’t know in FreeBSD you can install software from the ports collection. The propose of this tutorial is to explain how to use and maintain your ports tree.

First of all you need to identify the port’s path by typing this :

# cd /usr/ports

# make search name=<port>

Now you can download, compile, and install software by just typing

# cd /usr/ports/<category>/<port>

# make install && make clean

as root. The ports infrastructure will download the software, change it so
it works on FreeBSD, compile it, install it, register the installation so it
will be possible to automatically uninstall it, and clean out the temporary
working space it used. You can remove an installed port you decide you do not
want after all by typing

# cd /usr/ports/<category>/<port>

# make deinstall

as root.

There are two way to upgrade your ports tree , using cvsup ot portsnp. Personally I prefer portsnap because is faster and less bandwidth consuming, but I’m going to describe both methods.

1. Using portsnap:

# portsnap fetch

If used for the first time will download an approximately 50 MB archive but after the first time it will download only a few KB.

# portsnap extract

This command is used only first time to decompress the archive, and finally

# portsnap update

will bring the ports collection up to date. All you need to do now is run

# portupgrade -arR

in order to actually update the installed packages. If you don’t have it you can install it just by typing :

# cd /usr/ports/ports-mgmt/portupgrade && make install clean

It is a good idea to read portsnap, portupgrade manuals and /usr/ports/UPGRADING before every port upgrade.

2. Using cvsup :

In order to update your ports tree using cvsup you need to install it on your system :

# cd /usr/ports/net/cvsup-without-gui/ && make install clean

or

# pkg_add -r -v cvsup-without-gui

After you have cvsup installed you need to create a ports-supfile which has to look like this :

*default host=cvsup2.ro.FreeBSD.org
*default base=/var/db
*default prefix=/usr
*default release=cvs tag=.
*default delete use-rel-suffix

*default compress

ports-all

Now all you have to do is type :

# cvsup -g -L 2 ports-supfile

and at the end you will have your ports collection up to date.Also I recommend reading cvsup’s man pages in order to have a better idea about it. The nex step is to use portupgrade ( described previously ).

Happy upgrading ! :-)

  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • De.lirio.us
  • Slashdot
  • Technorati
  • YahooMyWeb
  • BlogMemes
  • email
  • Furl
  • LinkedIn
  • Live
  • MySpace
  • SphereIt
  • TwitThis
  • Yahoo! Buzz
  • Socialogs
  • Spurl
  • StumbleUpon
  • Yahoo! Bookmarks
  • Identi.ca
  • PDF
  • RSS
  • Twitter

Leave a comment

You must be logged in to post a comment.