For today i’ll show how to install software in Freebsd. Freebsd use the tree ports, consist in a tree of directories that contains different source code and scripts that automate the process of compilation and installation. In each port directory we can find these files:
– makefile: contains different entries, like the installation directory and how compile the port.
– distinfo: Contains information about the files has to download to compile the program and the checksum in md5 to check the integrity.
– directory files: contains the necessary patches to compile and install the program in your freebsd system.
– pkg-descr: description of the package.
– pkg-plist: list of all the files that the program will install in your system.
How to install the tree ports
I’ll install and update the tree ports from a cvs repository, is important the /usr/ports directory is empty.
1.- Copy an example file of ports-supfile to our home directory:
# cp /usr/share/examples/cvsup/ports-supfile ~/
2.- Edit ports-supfile file and change the defaukt host and add cvsup.FreeBSD.org
# vi ~/ports-supfile
3.- Run csup for download the port tree:
# csup -L 2 ~/ports-supfile
Keep the port tree updated
1.- Install portsnap:
# cd /usr/ports/ports-mgmt/portsnap && make install clean
2.- Download the last compressed snapshot of the tree ports:
# portsnap fetch
3.- Extract the last fetch of the port tree:
# portsnap extract
4.- To update the port tree:
# portsnap update
Search ports
1.- Use de command whereis:
# whereis portaudit
2.- Using make search in the port directory (/usr/ports/). Before use make search, we have to make an index of ports :
# cd /usr/ports/ && make index # make search name=portaudit
Install ports
1.- We have to enter in the directory of the software code, for example to install portaudit:
# cd /usr/ports/ports-mgmt/portaudit
2.- Next we have to run make install clean, this command will install the software and clean the temporary directories:
# make install clean
– If we want to reconfigure a software you can use the config option or showconfig to show the current config:
# make config # make showconfig
4.- If you want only download files, you can use make fetch:
# make fetch
Package info
With the command pkg_info we can seach about ports installed in our system and know the version number:
Uninstall ports
– We have to change to the port directory and run pkg_delete:
# cd /usr/ports/sysutils/lsof && pkg_delete lsof-4.57
Clean port tree
When we install software from ports, this generate temporary files. Is important clean this, exist a script that automate this cleaning in the port directories:
# portsclean -C
This clean all the distfiles that are not referenciated by any port:
# portsclean -D
And with this option clean all the distfiles that are not referenciated by any port that is currently installed in the system.
# portsclean -DD
Check the vulnerabilities of software
portaudit allow check all the packages installs in our system and search in a vulnerability database and show if our version is affected and the vulnerability.
1.- search for vulnerabilities in our current ports:
# portaudit -Fa
In my case was found a vulnerability of DoS attack in apache. We have to upgrade our system to newer version that the vulnerability has been corrected.
2.- Is recommended to visit regurally the web page: http://www.vuxml.org/freebsd/
Thats it!! More and better in the next entry!! Good bye!