Ports 101
I thought it would be a good idea before I went on to Benchmarking to finish the prerequisites for it. I don't think it would make sense to demonstrate benchmarking without 1st having a blog spot on how to actually install ports.
I have already discussed ports and packages in this post. Here however we will actually install ports on FreeBSD.
To do those steps you require no prerequisites besides that is, having already successfully completed a FreeBSD 8.1 installation. If you're not sure how to do that, refer to my post here.
So in the words of the mighty Zohan, “So let's go”.
Start by booting up your FreeBSD VirtualBox.
Before we can start downloading ports we need to download the entire FreeBSD source tree to our computer. This essentially only downloads a skeleton of all ported FreeBSD applications(called a snapshot). It doesn't download the actual applications. Since we are downloading it from the servers, we're sure to get the latest version of everything. The tool we'll use is called 'portsnap'.
time portsnap fetch extract
What this does is:
'time' will time the whole process as discussed in the 'Time Chronicles post'
'portsnap fetch extract' will download the Source Tree Skeleton verify it's integrity and Extract it.
Extracting will look something like this..
Press Enter – Note: If like me, you are doing this in a VirtualBox it might take about 20 minutes.
Look at the time results to see how long the whole process took.
Now that this is done and as you may have noticed the port skeleton was extracted in /usr/ports
There are a couple of ways to search through it. Let's say we're looking for the packet analyzer WireShark. One way to search for it would be,
cd /usr/ports
make search key="wireshark"
But sometimes the result is something like that which .. doesn't tell us much to be honest.
A different method which I find more convenient:
Go to www.freebsd.org/ports/
Search for the port you want
Pick the one you need from the results and make a note of the name
Let's say we need the wireshark-lite-1.4.3 – We can see that this is in the category net.
In FreeBSD we'd do the following:
Go to the noted category (In our case “net”) and type:
cd /usr/ports/net
And press Enter
Do an ls to find the exact directory name, type:
ls wireshark\*
And press Enter
voila!
That's what we need.
Type:
cd wireshark-lite
And press Enter
Now that we're finally at the port directory all we need to do is type
make install clean
That will take care of a)downloading the actual port , b)extracting it, c)compiling it. Note: It will do the same for all of it's dependencies automatically! This is good but just remember that it might take time. Let's go ahead and do it! Remember to prefix it with the “time” command so we know how long the whole thing took!
Type:
time make install clean
And press Enter
RED-Checks to see if the source code for WireShark exists in /usr/ports/distfiles
BLUE-Attempts to download it
ORANGE-Extracts and Verifies the source code
GREEN-Dependency checks – checks to see if all the prerequisites of WireShark are present and if not, repeats the previous steps!
Don't you feel like a Finnish hacker right about now???????
Since WireShark is a graphical application we will need to be already in X-Windows. Follow my instructions here if you don't know how to setup a basic X-Windows system in FreeBSD under a VirtualBox.
To startx X type
startx
And press Enter.
Then click on Xterm
Type this in Xterm
wireshark
and press Enter.
Success!!
In the next tutorials we'll see more options for Ports.
Related Links/Sources: