Install FreeBSD ports using Subversion Lite (svnlite)

Using subversion (svn), we can create a local copy of FreeBSD repository. It’s real fast and I like it more than portsnap. Subversion is more flexible and allows and allows us to install different versions (revisions) of ports. It can read logs of changes in the repository and much more.

Before the start

If you have used portsnap in the past, or installed ports during FreeBSD installation process then you need to remove ports directory, because svn uses other mechanisms to synchronize with FreeBSD repository:

sudo rm -rf /usr/ports

It is also recommended to install ca_root_nss package. It installs symlinks to certificates, so applications that use OpenSSL can find these certificates and use them:

sudo pkg install ca_root_nss

Now everything is ready.

Subversion Lite

Subversion Lite (svnlite) is a lightweight version of Subversion. It is already installed in FreeBSD by default:

whereis svnlite
...
svnlite: /usr/bin/svnlite    /usr/share/man/man1/svnlite.1.gz

At the first synchronization, we need to run the following command:

sudo svnlite checkout https://svn.FreeBSD.org/ports/head /usr/ports

This will download a local copy of FreeBSD repository. It took 3 minutes on my computer.

FreeBSD supports http, svn protocols, so it can be used by svn://, http:// if needed. But HTTPS is the preferred protocol (Requires ca_root_nss package to be installed). Also this server has GeoDNS mechanism, so this command will select the server closest to you.

To update repository copy, go to the ports directory and run the following command:

cd /usr/ports
sudo svnlite update

Or we can pass the path to the ports as an argument:

sudo svnlite update /usr/ports

It’s really fast. To read the information for which server this directory is assigned to and when the repository was last updated, use the following command:

cd /usr/ports
svnlite info

Or simpler:

svnlite info /usr/ports

To show where the port is located, we can use whereis command:

whereis mpg123
...
mpg123: /usr/ports/audio/mpg123

To install a port, go to its directory and execute:

cd /usr/ports/audio/mpg123
sudo make install clean

Then the port will be installed. If the port is no longer needed, we can delete it. This can be done by using pkg delete command. It is more general command and not specific to the package version:

sudo pkg delete mpg123

Use the following command to delete dependencies:

sudo pkg autoremove

Leave a Reply

Your email address will not be published.