How do I install ports in FreeBSD operating systems using the command line options?
The FreeBSD operating systems offers Ports Collection as a simple way to install various applications. Each port contains any patches necessary to make the original application source code compile and run on FreeBSD.
Get the Ports Collection
Before using ports, you must first obtain the Ports Collection /usr/ports directory. The portsnap command allows you to install ports collection over the Internet. To grab collection, enter:
# portsnap fetch
To extract the snapshot into /usr/ports, enter:
# portsnap extract
Type the above command for the first time only. If you already have a populated /usr/ports and you are just updating, run the following command instead:
# portsnap update
How Do I Search Apps / Ports?
Before you can install any Ports you need to know what you want, and what the application is called. If you know the exact name of the port, you can use the whereis command as follows:
# whereis apache22
# whereis php5
# whereis lsof
You can also use the Ports Collection's built-in search mechanism. To use the search feature, you will need to be in the /usr/ports directory. Once in that directory, run make search name=program-name where program-name is the name of the program you want to find. For example, if you were looking for apache, enter:
# cd /usr/ports
# make search name=apache
The following will perform searches for port names, comments, descriptions and dependencies and can be used to find ports which relate to a particular subject if you do not know the name of the program you are looking for.
# cd /usr/ports
# make search key=string
# make search key=php5
How Do I Install the Port Called apache22?
To install the Apache22 port, enter:
# cd /usr/ports/www/apache22/
# make install clean