HOW-TO: using pkg-get to install CSW packages in Solaris

As I’ve mentioned already, a couple day ago I’ve installed Solaris Express 2/06 on my desktop. And while the system isn’t tuned for the maximum comfort, I thought I’d write a few entries for those of you who have just started learning and using Solaris 10.

CSW software repository

CSW (Community SoftWare) available through openCSW.org is wonderful repository with hundreds of software packages for Solaris 8, Solaris 9 and Solaris 10. Armed with the mighty pkg-get tool, this is definitely one of the easiest and quicked ways to get new software installed without having to compile anything to meet dependencies.

Today I’ll just give you a very brief intro, with a promise to revisit CSW in more detail later.

1. Packages storage
Create a directory where all the downloaded packages will be stored. It will be better if this directory is on a filesystem with plenty of space – it’s hard to make any space usage predictions, but I believe a couple of available gigabytes would be useful.

WARNING: this directory is merely a storage for the packages. The software installed from these packages will reside in a different directory structure – under /opt/csw (read on).

solaris# mkdir /export/dist/csw
solaris# cd /export/dist/csw

2. Using pkg-get command

This command line tool is all you’re going to ever need to download, install or update your CSW packages. Before you do anything else, you have to download the package with this tool and get it installed. I’m not showing the standard output commands will give you. Here I’m only giving you the commands you may use.

solaris# /usr/sfw/bin/wget http://www.opencsw.org/pkg_get.pkg
solaris# pkgadd -d ./pkg_get.pkg

At this stage you’ll have a /opt/csw directory created, where all the installed software will be put. pkg-get is the first installed software, and the full path to this command will be /opt/csw/bin/pkg-get

3. Configuring pkg-get

To change configuration parameters of pkg-get you’re going to edit the /opt/csw/etc/pkg-get.conf file. There are parameters you may want to change.

URL parameter in pkg-get

url – this specifies what mirror of the openCSW repository we want to use.

For best results, visit the openCSW mirrors page and select the mirror closest to you geographically.

In the pkg-get.conf file you have to find this:

# default site, in USA:
url=http://ibiblio.org/pub/packages/solaris/opencsw/current

and now edit the line to include your new mirror server, and not the default ibiblio.org. The closest one to me is heanet.ie:

# default site, in USA:
url=http://ftp.heanet.ie/pub/opencsw/current

WARNING: updating mirrors is a responsibility of their personnel, and not the opencsw.org maintainers. Because of this, some of the official mirrors might not have all the latest changes of the main repository ibiblio.org. So, if something doesn’t work, try changing this url parameter back.

UPDATED: for instance, heanet.ie didn’t seem to have the Solaris 11 support – which is essentially what all the latest Solaris Express builds are. Because of his, pkg-get couldn’t find the 5.11 catalog file for my Solaris version, so I had to get back to ibiblio.org, even though my access to it can some be really slow.

PKGADDFLAGS=-G – this line has to be uncommented if you don’t want pkg-get trying to install new packages into any Solaris zones but the global one

PKGGET_DOWNLOAD

This parameter has to be changed to reflect the location of packages storage directory:

PKGGET_DOWNLOAD_DIR=/export/dist/csw

4. CSWcommon package

This package has all the core files and directories pkg-get needs to begin with. This is also the necessary package to be installed as most of other openCSW packages depend on it.

solaris# /opt/csw/bin/pkg-get -i common

That’s it! Now you’re ready to install any CSW software packages!