Friday, February 5, 2010

Solaris for Linux admins - part 2: package management

Unlike most Linux distributions, Solaris doesn't provide an all-purpose package manager. Instead, you use separate tools:
- to add/remove Sun-provided software
- to update the system,
- to add/remove software from external repositories


They come in two flavours, text and graphical. Let's start with the latter.

I want my G-U-I

If your system runs X, you can use graphical package managers. In Utilities menu, there's an Update Manager. It works automatically unless the package requires manual intervention during update process, in which case it will be marked as "download only" (sorry, no screenshot, I already updated my system). If it happens, see patch description - sometimes it says it should only be installed in single-user mode or in some circumstances it should not be installed at all. When you're ready, run "patchadd" with the path to patch spool and the patch ID, for example:
patchadd /var/spool/patch/121431-44
There's also a GUI for package management, although you can't find it in the menu. Type "prodreg" in the terminal to run it. The tool will generally just run pkgrm/pkginst (see below) in the terminal, but might be useful for navigating a list of installed software.


Update from the command line

The update process is simple:
smpatch analyze
smpatch download
smpatch update

Example:
bash-3.00# smpatch analyze
119281-22 CDE 1.6_x86: Runtime library patch for Solaris 10
bash-3.00# smpatch download
119281-22 has been validated.
bash-3.00# smpatch update
Installing patches from /var/sadm/spool...
119281-22 has been applied.
/var/sadm/spool/patchpro_dnld_2010.01.29@15:41:11:CET.txt has been moved to /var/sadm/spool/patchproSequester/patchpro_dnld_2010.01.29@15:41:11:CET.txt
/var/sadm/spool/patchpro_dnld_2010.01.29@15:42:03:CET.txt has been moved to /var/sadm/spool/patchproSequester/patchpro_dnld_2010.01.29@15:42:03:CET.txt
Managing system software

There's a number of commands starting with "pkg" that deal with packages. The most important are:
pkgadd - installs a package from a specified file
pkgchk - checks installation of a package
pkginfo - list of known packages
pkgrm - removes a package

These tools behave like dpkg or rpm, not the high-level Linux package managers APT or Yum. Which means: they will print out dependency info, but won't resolve anything automatically, also pkgadd can install a package from a file or URL, but won't find it for you. Package names always start with a vendor's prefix, Sun uses SUNW.


Let's try removing a package. I have a default install on my testbed VM with lots of software I'll never use. Let's get rid of RealPlayer.

bash-3.00# pkginfo | grep realpl
MOZ17       SUNWrealplayer                   RealPlayer media application
MOZ17       SUNWrealplayer-l10n-de           RealPlayer media application - l10n-de files
MOZ17       SUNWrealplayer-l10n-fr           RealPlayer media application - l10n-fr files
MOZ17       SUNWrealplayer-l10n-pl           RealPlayer media application - l10n-pl files
There's a main package and three translations.

bash-3.00# pkgrm SUNWrealplayer

The following package is currently installed:
   SUNWrealplayer  RealPlayer media application
                   (i386) 10.0.6.1358,REV=10.2.3.2006.03.21.05.47

Do you want to remove this package? [y,n,?,q] y

## Removing installed package instance
## Verifying package dependencies in global zone
WARNING:
    The package depends on the
    package currently being removed.
WARNING:
    The package depends on the
    package currently being removed.
WARNING:
    The package depends on the
    package currently being removed.
Dependency checking failed.

Do you want to continue with the removal of this package [y,n,?,q] y
## Processing package information.
## Removing pathnames in class
/usr/share/pixmaps/realplay.png
/usr/share/pixmaps
/usr/share/mimelnk/video/x-3gpp2.desktop
/usr/share/mimelnk/video/vnd.rn-realvideo.desktop
[...]
/usr/bin/realplay
/usr/bin
## Updating system information.

Removal of was successful.

We can clearly see how these tools (don't) deal with dependencies. They have to be uninstalled manually:
bash-3.00# pkgrm SUNWrealplayer-l10n-de SUNWrealplayer-l10n-fr SUNWrealplayer-l10n-pl

High level package manager

The prodreg software I mentioned before also works as a CLI tool. With a proper magic you can for example uninstall a package with all the dependent software. Using it is a pain in a certain body part. Getting the right package name or UUID requires a long process of "prodreg browse". I'm not going to cover it here, see Solaris Basic Administration Guide if you need it.

Other software

There are several external repositories with tons of software, generally the same as for Linux. The most popular is Blastwave. It even comes with a proper package manager (one that behaves like Apt or Yum). It downloads the software, deals with dependencies and packages are protected by MD5 checksum and GPG signature. The tool is called pkgutil. Setting it up properly requires a few simple steps, so I'll post it as a separate entry.

0 komentarze:

Post a Comment