Installing and Managing Software Packages

Installing and Managing Software Packages

Applications are the lifeblood of any computer system. Some applications, such as StarOffice, enable you to be productive. Other applications, such as Netscape Navigator and various games, might have questionable productivity value but provide considerable entertainment. Regardless of your productivity or entertainment goals, you need to know how to install and manage software on Solaris 9 computers.

In many cases, an application needs more than one file to run. Sure, one file, the executable, actually opens the application, but additional support files might be needed as well. When you install an application, you need to install the required files, directories, and paths in addition to the executable.

In Solaris, applications are bundled as software packages. A software package is the collection of files and directories needed to run a particular program. Packages might be provided by Sun or a third party, but are always identified by a unique name. Sun packages will always start with the SUNW moniker, whereas other companies' programs will start with their company ticker symbol. As an example, Sun's audio drivers are installed as the SUNWaudd package, whereas Netscape Communicator is the NSCPcom package.

Solaris 9 has multiple options for installing, managing, and removing software. Graphical options include Admintool and the Solaris Product Registry 3.0. Command-line options include pkgadd, pkginfo, pkgchk, pkgask, and pkgrm. To add or remove software packages from Solaris 9, you must have superuser privileges or be able to assume an equivalent role.

Managing Software Graphically

The three options for managing software through a graphical interface in Solaris 9 are Web Start, Admintool (admintool), and the Solaris Product Registry (prodreg). There are both positive and negative aspects to managing your software through graphical interfaces in Solaris 9. On the positive side, if you are unsure of the program's package name but you need to remove it, the list of packages is more manageable with the graphical interfaces. The negative aspect is that the graphical interfaces do not afford you the flexibility of their command-line counterparts.

All three graphical installation programs enable you to add and remove software packages from stand-alone or networked systems, view currently installed software, and choose software from an installation media.

Note 

None of the graphical software management tools enable you to add packages to a spool directory or to use an administration file to eliminate user interaction.

Of the three, Web Start is the least useful after Solaris 9 is installed and running. Web Start is used to install Solaris (as you read about earlier in this chapter), and although it can install software groups, it cannot be used to install individual software packages.

Admintool was a popular administrative tool in Solaris 8 for managing users and groups, in addition to software. Although Admintool is still available in Solaris 9, Sun is phasing it out in favor of the Solaris Management Console. To manage software by using Admintool, launch Admintool by choosing Workspace Menu Tools from Application Manager, or by typing admintool from a command prompt. From the Browse menu, choose Software. The Admintool Software screen is shown in Figure 2.1.

click to expand
Figure 2.1: Admintool Software management

Note 

When you open Admintool in Solaris 9, it warns you that Admintool has been declared obsolete and might not be present in Solaris releases after May 2002. If it's one of your preferred management tools, you might want to find an alternative.

As you can see in Figure 2.1, Admintool lists the various packages that are installed on your machine. To find out detailed information about a package, simply double-click it, or highlight it and click the Show Details button. Software details are shown in Figure 2.2. Packages are added, modified, and removed in Admintool by using the Edit Add, Modify, and Delete menu options.

click to expand
Figure 2.2: Admintool software details

The Solaris Product Registry 3.0 is new to Solaris 9. Like Admintool, the Product Registry provides an easy-to-use graphical interface to manage your software. It also categorizes your software and tracks all software installed on the system. The Product Registry displays all software listed in the /var/sadm/install/contents file, otherwise known as the software installation database.

To launch the Solaris Product Registry, use the icon in Application Manager or type prodreg from a command line. Figure 2.3 shows the Solaris Product Registry.

click to expand
Figure 2.3: Solaris Product Registry

To add or remove software, use the New Install or Uninstall buttons at the bottom of the console. As always, when removing packages, be mindful of software dependencies. If you remove a package that is required for an application to function, your action will obviously cause problems. The Product Registry conveniently displays dependent components to help avoid potential conflicts.

Managing Software via Command Line

Although the command-line interface (CLI) does not offer pretty pictures, it does have one distinct advantage: flexibility. Managing software through the CLI is the only way to use many options, including installing a package into a spool directory and using an administration file to abolish the need for user interaction.

Installing Software

The primary command to install software in Solaris 9 is pkgadd. This command enables you to install software from an installation medium (CD, DVD, or other hard disk) and copy installation files to a spool directory for future installation. By default, pkgadd will look in the default spool directory, /var/spool/pkg, for the installation files. The syntax for pkgadd is as follows:

# pkgadd arguments package_name
 

If you wanted to install a package called SUNWexp from the files directory on a CD-ROM named CDR1, you would type the following:

# pkgadd -d /cdrom/CDR1/files SUNWexp
 

Table 2.1 lists some of the common command-line arguments for pkgadd.

Table 2.1: pkgadd Command-Line Arguments

Argument

Description

-a admin

Defines an installation administration file to be used instead of the default administration file.

-d device

Instructs pkgadd to install or copy a package from a specified directory instead of the default (/var/spool/pkg).

-r response

Identifies a file or directory that contains output from a previous pkgask session. Using this option can eliminate user interaction during the installation.

-s spool

Copies the package into a specified spool directory instead of installing the application.

-Y category

Installs packages based on their category (as defined by the CATEGORY parameter in the packages' pkginfo file), not package name.

When you install a package, pkgadd checks the current directory for an administration file. Administration files provide information as to how the installation should proceed, such as installing without asking the user for confirmation. If there is no administration file in the current directory, pkgadd checks the /var/sadm/install/admin directory or the directory specified by the -a switch.

On a network, perhaps the most useful pkgadd switch is -s. This enables an administrator to set up a network installation server and copy frequently installed packages into a spool directory. The administrator can then mount the remote directory on the local machine (we'll look at how to do that in Chapter 7, "File System Management") and use pkgadd -d to install the package.

After you've installed software, it's a good idea to check the integrity of the installation with the pkgchk command. The syntax for pkgchk is as follows:

# pkgchk arguments package_name
 

Some popular command-line arguments for pkgchk are listed in Table 2.2.

Table 2.2: pkgchk Command-Line Arguments

Argument

Description

-a

Checks only file attributes, not attributes and contents. Checking attributes and contents is the default action.

-c

Checks only file contents, not contents and attributes.

-d device

Specifies the device to check as the spool directory.

-f

Fixes file attributes, if possible.

-n

Does not check editable or volatile files. For any application that has been modified since installation, this is a good option.

-q

Indicates quiet mode, which does not give information about missing files.

-v

Indicates verbose mode, which lists all files as they are checked.

If you do not supply a specific package to check, pkgchk will look at all installed packages on your system. This operation could take a while. If pkgchk does not discover any error messages, it will return you to a command prompt. Any errors will be listed on-screen.

Response Files

If you want to minimize user interaction when installing packages, you can create a response file that provides answers to questions asked by the installation program. First, you need to make the package an interactive package by creating a request script. After the request script is created, you use the pkgask command to create the response file. When installing a package, use pkgadd -r to invoke a response file.

Package Information

To find information about all packages installed on your system or to gain information about a specific package, use the pkginfo command.

If you type pkginfo at the command line, you will receive brief information about all software packages installed on your system. To get information on a specific package, type pkginfo package_name. For more detailed information, use pkginfo -l package_name, as shown in Figure 2.4.

click to expand
Figure 2.4: pkginfo -l output

Removing Software

To remove installed packages in Solaris 9, use the pkgrm command. The syntax of pkgrm is as follows:

# pkgrm arguments package_name
 

Many of the same arguments that are used for pkgadd are also used for pkgrm. For example, the -s switch is used to remove spooled packages. The one major exception is the -A switch, which will remove the package from the computer regardless of any shared files. When removing software on a Solaris machine, keep in mind the following points:

  • By default, files shared with other applications (besides the one you are removing) are not deleted.

  • Be aware of package dependencies. Don't remove a package if a program you need to use requires it.

  • Although you can use the rm command to remove files, don't use it to remove software packages. It will corrupt the software database.

  • The removef command can be used to remove an individual file and it will update the software database. However, it's not recommended for removing packages, which contain many files. Removing one file can cause packages to fail.

It's important to know how to both add and remove software properly. If you add software that corrupts your system, you could have to reinstall your operating system. The same goes for removing software. Doing so improperly could have you performing an installation.

Last but not least, don't forget that to remove software packages, you must have superuser privileges or be able to assume an equivalent role.

start sidebar
Real World Scenario: Problems Installing Software

You have recently been promoted to systems administrator for your small service field office, and the former systems administrator has moved on to greener pastures. You know that the previous administrator set up one of your two Solaris 9 servers as an installation server so she could install software on clients without having to carry the installation media around with her.

One of your users has just received a promotion and needs to have some new software packages installed on his machine. So, you go to the client machine and mount the directory on the server that you know contains the installation files. When you try to use the pkgadd command to install the ACCTwksp package, you get the following error message: WARNING: ACCTwksp <not present on Read Only file system>. What could be the problem?

Behind the scenes, what has happened is that the files necessary to install the ACCTwksp package were for some reason not installed on the server by the first administrator. If you get this warning message, you must first install the package on the server, as opposed to just copying it to a spool directory. After that, the installation should proceed normally. When using installation servers, make sure software installation packages are current.

end sidebar