Solaris GNU Utilities

Most of the Solaris utilities (eg. find, grep, awk, sed) are sort of crippled when compared to their GNU counterparts. The GNU versions of the utilities are relatively flexible, in the sense that they most often support additional useful features.

Some GNU related hacks include:

So, how to get the GNU utilities installed on a Solaris system? On Solaris 11, you can find some of the common GNU utilities installed under the /usr/gnu/bin directory. The GNU utilities have soft links in /usr/bin that starts with a ‘g’ prefix. So for /usr/gnu/bin/find, there is soft link at /usr/bin/gfind.

If you need some other GNU utilities or other open source packages, you can either download and compile the source packages yourself or choose to install the binary packages maintained at OpenCSW instead. Previously, Sunfreeware and Blastwave.org offered open source Solaris packages for download. But the support for packages at Sunfreeware has been discontinued and they are moving towards a paid subscription service. As for Blastwave.org, they have ceased operation. In this article, we will explore installing the packages from OpenCSW – a community project with a lot of popular open source software.

Install OpenCSW Solaris Packages

OpenCSW packages are managed using pkgutil. First, install pkgutil using pkgadd – Solaris default package manager. OpenCSW packages work best with Solaris 10. If you are on Solaris 8 or Solaris 9, consider upgrading.

The above command will install pkgutil to /opt/csw/bin. Once installed, update the catalog or package list.

Once the catalog package list has been updated, install the core recommended packages.

Once done, you can now use pkgutil to install additional packages. To list all the available packages for download, use the following syntax.

Now, let’s say that you want to download the GNU awk utility. First, get the list of available packages for awk.

Next, install the package. You can either specify the common name found on the first column or the package name in the 2nd column, both seem to work. pkgutil will also install all dependencies.

OpenCSW binaries will be available under /opt/csw/bin and /opt/csw/gnu directories. Binaries under the /opt/csw/bin directory will have a ‘g’ prefix for all the binary names. So, you will find files named as gbasename, gcat, gfind, gls under /opt/csw/bin. This is to prevent any clashes with binaries in /usr/bin.

To upgrade packages, simply run pkgutil using the below syntax.

To make your life easiser, you can consider adding /opt/csw/bin to your PATH and /opt/csw/man to your MANPATH. MANPATH is no longer required in Solaris 11, if I am not wrong.

ibrahim = { interested_in(unix, linux, android, open_source, reverse_engineering); coding(c, shell, php, python, java, javascript, nodejs, react); plays_on(xbox, ps4); linux_desktop_user(true); }