130 likes | 296 Views
Shanker Balan Exocore Consulting Bangalore http://shankerbalan.com/. Trawling The FreeBSD Ports Collection. Introduction. FreeBSD is a source based distribution Everything in FreeBSD system is built from “base” (/usr/src) Kernel, libc, GCC tool chain, Sendmail are all “base”
E N D
Shanker Balan Exocore Consulting Bangalore http://shankerbalan.com/ Trawling The FreeBSD Ports Collection
Introduction • FreeBSD is a source based distribution • Everything in FreeBSD system is built from “base” (/usr/src) • Kernel, libc, GCC tool chain, Sendmail are all “base” • Contributed applications are knows as “ports” (/usr/ports) • Applications not part of “base” are installed from “ports”
Overview of Software Installation • Traditional way of installing 3rd party software under UNIX • “wget http://gaim.sf.net/gaim-0.72.tar.bz2” • “tar jxvf gaim-0.72.tar.bz2” • “less INSTALL && ./configure && make” • “make test && make install” • And the FreeBSD way... • Install from “packages” • Install from “ports” • Over 9200 applications are available this was
What is a “package”? • A “package” is like an “RPM” or a “DEB” • Single file which must be downloaded from the site • Contains pre-compiled copies of all the applications, as well as cfg files, doc etc • Dependency information for the application • To install a package from ftp.freebsd.org • “pkg_add -r bash”
root# cd /usr/ports; ls devel/ audio/ multimedia/ x11/ mail/ www/ net/ root# cd mail/; ls postfix/ mutt/ qmail/ evolution/ fetchmail/ procmail/ root# cd postfix/; ls Makefilefiles/ pkg-install pkg-plist distinfo pkg-descr pkg-message scripts/ What is a “port”?
Ports (contd) • Each “port” contains patches necessary to compile and run the original application on BSD • Do “make build” in the port directory to compile the application • The “Makefile” will fetch the src code from FTP or local disk • Unpack, apply patches and compile it • Do “make install” to install the application. • “make package” will create a binary package for the port
Ports Vs Packages • Package Benefits • Compressed package is typically smaller than a compressed source tarball • Mozilla, GNOME, KDE, OpenOffice take a long time (and disk space) to compile • Packages do not require compilation knowledge • Ports Benefits • Some people dont trust binary distributions • Can tweak the compilation process for CPU (-march athlon) and compiler optimizations (-O2)
Ports Benefits (contd) • User definable “./configure” options. Compile only the features you want to reduce dependencies (See portname/Makefile) • Build Gaim without GNOME support • Build Ghostscript w/o X11 support • Easy to apply local patchsets and build applications
Finding Your Application • Find the latest ported apps at • http://freshports.org • http://www.freebsd.org/ports/ • Or locally using keywords • “cd /usr/ports” • “make search name=”bash”” • “make search key=”ftp””
Updating the ports collection • The “CVSup” Method • CVSup is a network distribution method for CVS repositories • Install “net/cvsup” • Copy /usr/share/examples/cvsup/ports-supfile to /root • Edit ports-supfile and set it to use the closest cvsup server • Run “cvsup -g /root/ports-supfile” • /usr/ports will now be updated with all the recent changes
Upgrading Ports • Using “portupgrade” • Install “sysutils/portupgrade” • “portupgrade -a -i” • Specify compile time options in /usr/local/etc/pkgtools.conf MAKE_ARGS = { 'mail/evolution'=>'WITHOUT_PILOT=yes', 'net/gaim' => 'WITHOUT_GNOME=yes', 'emulators/wine' => 'DEBUG=yes', }
Resources • The FreeBSD Hanbook: http://www.freebsd.org/doc/ • Manual pages • portupgrade(1) • ports(7) • pkg_add(1)
Thank You Shanker Balan Exocore Consulting Bangalore http://shankerbalan.com/ Questions?