Working with Packages¶
Unlike other operating systems, SmartOS is distributed as a single (mostly) read-only image with no packaging system to allow for installation of additional software packages. To fill this void we leverage The NetBSD Packages Collection, also known as "pkgsrc".
pkgsrc is a cross-platform framework for building software from source and distributing binary packages. Each "package" consists of a Makefile and several metadata files which specify how to build the software (as an example, look at the tmux package). The flexibility of this framework allows for easy porting of software en mass for OS's like ours without reinventing the wheel as well as allowing us to participate in and contribute to the larger pkgsrc community at large.
pkgsrc is not present by default in the SmartOS global zone but can be easily installed using a bootstrap. Please refer to Installing pkgsrc-tools.
In SmartOS Zones, however, pkgsrc takes center stage by providing all the software you require from compilers to web servers to editors.
pkgin utility is the typical way to manage packages. Use
av to list the available packages for installation. Use
pkgin ls to
view already installed packages. Use
pkgin in somepackage to install a
package. All software will be installed under
/opt/local and should
therefore be included in your path.
This table lists common
||Lists all the installed packages|
||Lists all of the available packages|
||Installs a package|
||Removes a package|
||Searches for a package|
||With no additional arguments, lists all of the available
For example, to install
tidy, you run this:
sudo pkgin update sudo pkgin in tidy
Directory Paths used by pkgsrc¶
The pkgsrc utility installs files into
/opt/tools in the
global zone). Under this root, pkgsrc uses a fairly standard filesystem
heirarchy layout (e.g.,
|This is where pkgsrc installs software including binaries, libraries, configuration files, supporting files, examples, documentation etc.|
|Contains configuration files.|
|Example configuration files. When you add a new package, pkg src installs sample configuration f iles here, and then copies them to
|This directory contains two directories that contain the database of installed and avail able packages. If you delete or damage these directories, you will not be able to use the pkgsrc management tools.|
As noted in the table above, pkgsrc copies configuration files
/opt/local/etc only if they do not already exist. That means that
you will not lose any custom configurations when you update, remove, or
reinstall a pacakage. If you break your configuration file, you can
always get a clean one from