Wednesday, August 26, 2009

FreeBSD Install Applications

SkyHi @ Wednesday, August 26, 2009
Q. How do I install applications under FreeBSD operating systems?

A. Just like any other open source operating system, FreeBSD comes with a rich set of applications. You need to install all 3rd party apps using:

[]a] Ports collection - For installing packages from source code

[b] Binary packages - For installing pre-built binary packages
FreeBSD Install Application using pkg_add command (binary method)

You need to use pkg_add command for installing software package distributions. If your package file name is foo-1.2.tgz, enter:
# pkg_add foo-1.2.tgz
You can install package using internet i.e. use the remote fetching feature. This will determine the appropriate objformat and release and then fetch and install the package.
# pkg_add -r -v {package-name}
# pkg_add -r -v bash
# pkg_add -r -v mysql-server
Task: View installed packages

Use pkg_info command:
# pkg_info
Sample output:

bash-3.2.25 The GNU Project's Bourne Again SHell
cvsup-without-gui-16.1h_3 General network file distribution system optimized for CVS
db41-4.1.25_4 The Berkeley DB package, revision 4.1
gettext-0.16.1_3 GNU gettext package
libiconv-1.11_1 A character set conversion library
mysql-client-5.1.22 Multithreaded SQL database (client)
nagios-statd-3.12 Daemon/client to check remote host information for Nagios
net-snmp-5.3.1_7 An extendable SNMP implementation
perl-5.8.8_1 Practical Extraction and Report Language
portupgrade-2.4.3_2,2 FreeBSD ports/packages administration and management tool s
python25-2.5.1_1 An interpreted object-oriented programming language
rsnapshot-1.3.0 Filesystem snapshot utility based on rsync(1)
rsync-2.6.9_2 A network file distribution/synchronization utility
ruby-1.8.6.111_1,1 An object-oriented interpreted scripting language
ruby18-bdb-0.6.2 Ruby interface to Sleepycat's Berkeley DB revision 2 or lat

You can get detailed package information by entering following command:
$ pkg_info {package-name}
# pkg_info rsync-2.6.9_2
Output:

Information for rsync-2.6.9_2:

Comment:
A network file distribution/synchronization utility

Required by:
rsnapshot-1.3.0

Description:
rsync is a replacement for rcp that has many more features.

rsync uses the "rsync algorithm" which provides a very fast method for
bringing remote files into sync. It does this by sending just the
differences in the files across the link, without requiring that both
sets of files are present at one of the ends of the link beforehand.
This makes rsync a good remote file distribution/synchronization utility
in a dialup PPP/SLIP environment.

Note, requires rsync on the destination machine.

There is a Computer Science Technical Report on the rsync algorithm is
included in the distribution, and is available as
ftp://samba.anu.edu.au/pub/rsync/tech_report.ps

WWW: http://rsync.samba.org/

FreeBSD Install Application using ports (source method)

/usr/ports directory has FreBSD ports collection installed. Always update FreeBSD ports collection before installing a new software:
# portsnap fetch
# portsnap update
Before you can install any applications you need to know what you want, and what the application is called. Use wheris command to find out exact location under /usr/ports directory. For example find out bash package location enter:
# whereis bash
Output:

/usr/ports/shells/bash

To install bash, enter:
# cd /usr/ports/shells/bash
# make install clean
The FreeBSD web site maintains an up-to-date searchable list of all the available applications, at http://www.FreeBSD.org/ports/

Reference: http://www.cyberciti.biz/faq/howto-freebsd-install-application/