BSD Package Management talk By Avleen Vig Presented to UUASC (http://www.uuasc.org/) on Feb 6th 2003 ========================================== My operating system choice is being dictated by factors which shouldn't effect it. The most notable of these is my choice of method of installing applications. There are days when I love installing servers really really fast. I love Debian for this, and their apt-get system. It makes it so easy for me to install publically availible binaries, or my own private ones quickly. But then there are some days I like to take my time, and pay special attention to a server, and compile software from tarballs, applying my own server-specific customisations for that extra *kick*. Until I met the BSD pkg system, combining these two into a reliable package management system was difficult. When I talk about the package management system tonight, I'll primarily be refering the the FreeBSD version, although commands across each of the BSD are equivilent and the process is almost identical. The key I feel, to a good package management system, is one that allows the administrator to install a package any way he chooses, be it precompiled or from source, and still allow easy maintainance of the package once it is installed. FreeBSD has two distinct parts to its package management system, although at times they work closely with each other. The first part we'll be discussing tonight is the Ports Collection, which is located on FreeBSD under /usr/ports. The ports collection is a heirarchy of directories, organised into obvious catagories such as "Mail", "Net" or "Security". Inside each of these catagory directories, are the directories of each package or port. Finally, inside these subdirectories are the makefiles which are used to fetch, compile and install the programs. The process of installation through ports is very simple. CD to the directory of the program you want to install, then run 'make' with the options of your choice. Valid important options for make are: - This fetches the tarball and compiles the source fetch - This only fetches the tarball fetch-list - Show a list of files to fetch fetch-recursive - Fetch files recursively fetch-recursive-list - List files to be fetched recursively extract - This does fetch and extracts the tarball patch - This does fetch, extract and patches the source for freebsd-specific patches aswell configure - This does fetch, extract, patch and runs 'configure' install - This does fetch, extract, patch, configure and install the program reinstall - Reinstall a program, the same way as it was before clean - This removes the source code distclean - This removes the rouce code and the tarball deinstall - Deinstall a program There are many more options that we can use with 'make', that was just a short list of the importand ones :-) In the list, where we mention doing things "recursively", 'make' will perform the action on all dependancies of the package you're trying to install. This is the default behaviour. When you execute 'make' you can specify multiple options on the command-line such as 'make fetch checksum extract patch configure build' You can also specify 'make install', which performs all 'make' functions required for the 'install' to complete. The second method of installation, which fetches and installed precompiled binaries, is even simpler, where you only really need to know two commands to get by: pkg_add pkg_deinstall Specifying the '-r' flag to pkg_add, makes pkg download the correct files for the package name you give, from ftp.freebsd.org and install them. Managing the collection is easy too! The only relevent command I think you would need to know is: pkg_info Applying different switches to this, displays the pkg's installed, displays the files for the pkgs, calculates the size of the pkgs, and can even show the install and deinstall scripts associated with each pkg! In all, this gives managing packages on BSD the beauty of compiling from source with all the options thus related, along with the simplicity of installing packages from precompiled binaries for the ultra-fast installs.