Pages

Sunday, June 05, 2005

Solaris: Installing apps/packages with pkg-get

Often it is very frustrating to install software on *nix systems, and Solaris is no exception. Most of the times, non-availability of software in "ready to install" form, and/or the lack of installed dependencies on the local system, makes it even hard for the novice end-user. Wouldn't it be nice to have some kind of tool, that does the installation for us automatically, including dependencies (if any)? Fortunately, tools like apt-get, pkg-get do exist on some *nix environments, for automatic package installations.

apt-get (Advanced Package Tool) is available on some Linux distributions, quite for some time. For more on apt-get, have a look at the web page, APT HOWTO.

The following paragraphs concentrate on a similar tool, pkg-get for Solaris environment.

What is pkg-get?
(The following text was borrowed from bolthole.com; full-text can be viewed at: 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 dependancies, pkg-get will also download any needed dependancies. 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.
One of the sites that supports these dependancies is www.blastwave.org. Another one is www.sunfreeware.com. Rest of the instructions focus on installing pkg-get to get packages from blastwave.org. To get packages from sunfreeware.com, /etc/pkg-get.conf has to be modified as explained in the latter parts of "How to install pkg-get?" section.

How to install pkg-get?
(source: blastwave.org; full-text is at: http://www.blastwave.org/howto.html)
  1. Download pkg-get from http://www.blastwave.org/pkg_get.pkg. Since it is a package, it has to be installed with pkgadd command on Solaris.

    % pkgadd -d <path of pkg-get>/pkg-get.pkg
  2. Download and install a copy of wget
    Download locations:
    SPARC version: wget-sparc.bin
    x86 version : wget-i386.bin

    (From GNU wget FAQ) wget is a network utility to retrieve files from the World Wide Web using HTTP and FTP, the two most widely used Internet protocols. It works non-interactively, so it can work in the background, after having logged off. The program supports recursive retrieval of web-authoring pages as well as FTP sites - you can use wget to make mirrors of archives and home pages or to travel the Web like a WWW robot.

    This version of wget is simple, without any dependencies. But this copy is good enough to install the complete wget package as explained later.

    Make the wget, an executable and add it to the PATH environment variable. This step is very important for pkg-get to work properly. So, make sure you have wget in your PATH, before you move on to the next step.
  3. Make sure that you have both wget, and pkg-get in your PATH, with which wget, and which pkg-get commands.
  4. Edit pkg-get configuration file: /etc/pkg-get.conf file, to get software packages from a nearby source. You can find a list of Blastwave mirrors at: http://www.blastwave.org/mirrors.php.
  5. Install the complete wget package with the man pages and dependencies.

    % pkg-get -i wget. -i switch can be used to instruct pkg-get to install something.

    Now remove the simple wget that was installed in step (2).

    Add /opt/csw/bin at the beginning of PATH variable (the essential pkg-get & wget tools will reside under code>/opt/csw/bin directory.). Also add /opt/csw/man to the MANPATH to read the newly installed manual pages.

    man pkg-get is a good starting point to use pkg-get, conveniently.
Quick Reference
  1. pkg-get available, lists all the software that is available for download on the remote server. pkg-get compare is similar to pkg-get available, except that it shows the local status of the packages as well.
  2. A list of software descriptions can be viewed with pkg-get describe.
  3. You can search for software using regular expressions.
    eg.,
    -D is synonymous with describe
    % pkg-get -D '^g.. '
    # (Descriptions from site ibiblio.org )
    gdb - The GNU Debugger
    gm4 - GNU m4 Unix macro processor
    gtk - the Gimp ToolKit library, libgtk

  4. To install a package:
    pkg-get install <pkg> Or pkg-get -i <pkg>
    eg.,
    % pkg-get -i firefox
  5. To upgrade a package:
    pkg-get upgrade <pkg> Or pkg-get -U <pkg>
    eg.,
    % pkg-get -U firefox
Note:
pkg-get is a pure command line interface. If you are more used to Windows environment, you can try pkgadm tool from bolthole.com. More information is available at: Solaris pkgadm tool.

Acknowledgements & recommendations:
  1. bolthole.com
  2. blastwave.org
  3. sunfreeware.com
Technorati Tag:

1 comment:

  1. I have decided that this stuff is the most important tool that I have to masterize in order to reach a successful life. The fact of matter is that I have always loved every single thing which is somehow related to computers and stuff.
    By the way, I have found pretty interesting stuff in this column. In short, I realized this is certainly a great piece of work.

    ReplyDelete