FreeBSD packages vs ports

FreeBSD logo
FreeBSD logo

Quick Background

This post is aimed at bringing a practical understanding into the usage and difference between ports and packages. Sometimes big descriptive definitions make things sound so much more complex.

Source vs Binary

Source (source code) is human readable files telling the application and computer how to interact with each other and what to do. Binary on the other hand is the same application that has been compiled, so it is computer readable but not human readable.

See it as a cake

Source is the ingredients and you can still decide what you want to add or remove. Binary is an already baked cake.

  • ports = source (ingredients)
  • packages = binary (pre-baked cake)

Lets look at how it install firefox

Installing a port

cd /usr/ports/www/firefox3; \
make config; \
make install clean; \
rehash; \
cd -

Installing a binary

pkg_add -r firefox3

So why configure, compile and install an application when you can just add the binary? Here we get back to the cake example. Take for instance lighttpd (a web server like apache / IIS). To enable mysql support on it you need to compile it with mysql (this is where the make config comes in). Whereas with firefox, chances are very slim that you need to compile it with specific parameters and you would rather package install it. As you go along you will find what works and does not work for you and your environment.

More on the structure

The FreeBSD ports directory is located in /usr/ports/ and well structured

/usr/ports/category/application_name

The ports directory contains all the applications that has been ported (adapted to work with) to FreeBSD.

What is the package name for the port?

Rule of thumb: the same as the package name.

  • port: /usr/ports/net/samba3
  • package: samba3

When in doubt refer for www.freshports.org

In closing

This is not a detailed in-depth analysis of packages and ports, this is a basic on how to get a working example and to grasp the concept of how it works. Refer to the relevant man pages and documentations for a more detailed insight

Comments 2 comments

Donald Duck 6 years ago

I think that FreeBSD should sign its packages and/or repositories, like many Linux distributions already do. Also NetBSD and DragonFlyBSD have this feature with pkgsrc. It is, maybe small but still, a security risk to install non-signed software from online. How does FreeBSD assure that installed software hasn't been altered by some malicious hacker?


Rhoo 5 years ago

@Donald Duck : anyway, ports and packages in FreeBSD are rolling released - hence meaning you'd be completely crazy to use those for any would it be somewhat a little bit serious activity. "Rolling release is not a tool, it is a toy" : so a signed or unsigned toy, what difference does it make ? Approved or not, crap is still crap. May FreeBSD start supporting a fixed version of each and every port for the lifetime of a given release, and then, you could start worrying about those being signed (in that case, yes, it would be very important for those to be).

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.


    Click to Rate This Article
    working