Solaris pkg-get tool

pkg-get is a tool to automate download and installation of binary packages from archive sites that support it.

This tool simplifies fetching the latest version of a package from compatible sites to be as simple as

 # pkg-get install gcc

This will automatically download the appropriate version for your architecture and OS revision (if available), and install the package. If you have an older version of the package already installed, using 'upgrade' instead of 'install' will replace the older version with a newer one, if available.

If the archive supports dependencies, pkg-get will also download any needed dependencies. For example

pkg-get install mod_php
should triger an automatic
pkg-get install apache
which in turn should automatically trigger
pkg-get install openssl

A site that supports these dependencies is
The last I am aware of, does not support dependencies. That means that if you use "pkg-get install apache", it could not automatically pull in any libraries that apache may depend on from

Checking available software

As well as providing easy installation of software, pkg-get provides you with a quick way to see what software is available for download.

Here's some sample output:

junior# pkg-get compare  
       software          localrev         remoterev
          aalib   [Not installed]               1.2
         apache   [Not installed]             1.3.9
       autoconf   [Not installed]              2.13
       automake   [Not installed]               1.4
           bash   [Not installed]              2.03
          bison   [Not installed]              1.28
          bzip2   [Not installed]            0.9.0c
            cvs   [Not installed]            1.10.7
          emacs   [Not installed]              20.4
       enscript   [Not installed]             1.6.1
         expect   [Not installed]              5.32
           flex   [Not installed]            2.5.4a
           gawk   [Not installed]             3.0.4
            gcc            2.95.2              SAME
            gdb   [Not installed]              4.18
	    ...    ...                          ...

If you dont want to see the local status of packages, but just see what is available for download, "pkg-get available" will print out just the software name and remote revision available.

With pkg-get v2.0, you can also see a list of software descriptions, for sites that provide a 'descriptions' file.
Sample output:

$ pkg-get describe    

# (Descriptions from site )
aalib - Ascii art graphics library
achievo - Project Management tool, in PHP
apache - apache webserver with mod_ssl included
autoconf - GNU auto-configuration tool
automake - GNU makefile autogenerator tool
berkeleydb3 - file based pseudo-database library
berkeleydb4 - embedded database libraries and utilities
binutils - GNU 'binary utilities': gas, gld, gprof, and others
bison - GNU yacc parser generator
ccache - Compiler Cache caches gcc output files
cdrtools - tools for ripping from and recording to CDs and DVDs
common - common files and dirs for CSW packages

You can even search for things using regular expressions

# ( -D is synonymous with describe )
$ pkg-get -D '^g.. '
# (Descriptions from site )
gdb - The GNU Debugger
gm4 - GNU m4 Unix macro processor
gtk - the Gimp ToolKit library, libgtk


If you need to use a proxy to reach the outside, you will need to do two things:
  1. Install 'wget' yourself
  2. Adjust the pkg-get config file
To get wget installed, you can install it from the solaris 8 "companion CD", or download the package from the pkg-get archive site you choose to use, or download the source and compile it yourself.

To adjust the config file, you may first have to run 'pkg-get' by itself to generate a default configuration file.
Then edit [basedir]/etc/pkg-get.conf in your favourite editor and follow the directions in it to tell wget to go thorugh the ftp proxy, if it is not already configured to do so.

[basedir] will only be meaningful if you have installed pkg-get to somewhere other than /usr/bin. For example, if pkg-get is in /opt/csw/bin/pkg-get, then the config file will be in /opt/csw/etc/pkg-get.conf

Changing FTP/HTTP server

Usually, a particular package archive has mirror sites. After running pkg-get once to create the default config file "[basedir]/etc/pkg-get.conf", edit that file, and change the url to point to whatever mirror site is closest to you.

To temporarily change the site you connect to, (if the main site is down or slow, for example) specify an alternate siite with pkg-get -s Note that you'll have to first run

pkg-get -s -U
to get the catalog for that site, before you can use the 'install' subcommand.

More info

For more gruesome details, "man pkg-get". Or... read the script!

Catalogs and private archives

To make your own software archive for pkg-get, you can use the makecontents script. This is currently only for the "old(v1) format". Contents file format looks like the following:

VersionLine format spec
v1softname version PKGname filename md5sum
v1softname version PKGname filename md5sum bytecount dependancy1|dependancy2|... category1|category2

v2 format notes: