JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Administration: Common Tasks     Oracle Solaris 11 Information Library
search filter icon
search icon

Document Information

About This Book

1.  Locating Information About Oracle Solaris Commands

2.  Managing User Accounts and Groups (Overview)

3.  Managing User Accounts and Groups (Tasks)

4.  Booting and Shutting Down an Oracle Solaris System

5.  Working With Oracle Configuration Manager

6.  Managing Services (Overview)

7.  Managing Services (Tasks)

8.  Using the Fault Manager

9.  Managing System Information (Tasks)

10.  Managing System Processes (Tasks)

11.  Monitoring System Performance (Tasks)

12.  Managing Software Packages (Tasks)

Managing Software Packages (Task Map)

Image Packaging System

Getting Information About Packages

Installing and Updating Packages

Installing a New Package

Updating All Installed Packages

13.  Managing Disk Use (Tasks)

14.  Scheduling System Tasks (Tasks)

15.  Setting Up and Administering Printers by Using CUPS (Tasks)

16.  Managing the System Console, Terminal Devices, and Power Services (Tasks)

17.  Managing System Crash Information (Tasks)

18.  Managing Core Files (Tasks)

19.  Troubleshooting System and Software Problems (Tasks)

20.  Troubleshooting Miscellaneous System and Software Problems (Tasks)

Index

Installing and Updating Packages

The pkg install command installs packages that are not currently installed and updates packages that are already installed. The pkg install command requires one or more package names.

The pkg update command updates installed packages. If you specify a package that is not already installed to the pkg update command, the system does not install that package. The pkg update command takes zero or more names of packages that are already installed. Specifying no package names updates all packages that are installed in the image. See Updating All Installed Packages.

Installing and updating packages require increased privileges. See Installation Privileges in Adding and Updating Oracle Solaris 11 Software Packages for more information.

Installing a New Package

Use the commands described in Getting Information About Packages to identify a package that you want to install. The examples in that section indicated that the group/feature/amp package contains Apache, MySQL, and PHP, and that the group/feature/amp package is not yet installed in this image. Use the pkg install command to install this package.


Tip - Use the -nv options to see what the command will do without making any changes to your image.


# pkg install -nv group/feature/amp
           Packages to install:         8
     Estimated space available: 112.19 GB
Estimated space to be consumed: 452.42 MB
       Create boot environment:        No
Create backup boot environment:        No
            Services to change:         2
          Rebuild boot archive:        No

Changed packages:
solaris
  database/mysql-51
    None -> 5.1.37,5.11-0.174.0.0.0.0.504:20110920T230125Z
  group/feature/amp
    None -> 0.5.11,5.11-0.174.0.0.0.0.2559:20110921T191255Z
  web/php-52
    None -> 5.2.17,5.11-0.174.0.0.0.0.504:20110921T041858Z
  web/php-52/extension/php-apc
    None -> 3.0.19,5.11-0.174.0.0.0.0.504:20110921T041245Z
  web/php-52/extension/php-mysql
    None -> 5.2.17,5.11-0.174.0.0.0.0.504:20110921T041411Z
  web/server/apache-22/module/apache-dtrace
    None -> 0.3.1,5.11-0.174.0.0.0.0.504:20110921T042357Z
  web/server/apache-22/module/apache-fcgid
    None -> 2.3.6,5.11-0.174.0.0.0.0.504:20110921T042430Z
  web/server/apache-22/module/apache-php5
    None -> 5.2.17,5.11-0.174.0.0.0.0.504:20110921T042738Z
Services:
  restart_fmri:
    svc:/system/manifest-import:default
    svc:/system/rbac:default

The output shows that this command would install eight packages, and the output lists those eight packages in the “Changed packages” section. Comparing this list of “Changed packages” with the list of packages from the pkg contents command in Getting Information About Packages shows that the web/server/apache-22 package that is part of the group package will not be installed. The following command confirms that this package is already installed and at the correct version.

$ pkg list web/server/apache-22
NAME (PUBLISHER)          VERSION                    IFO
web/server/apache-22      2.2.19-0.174.0.0.0.0.504   i--

This package could have been installed separately. The following command shows that the package was required by two other packages that are installed.

$ pkg search -l -o pkg.name -H ':depend:require:web/server/apache-22'
install/installadm
package/pkg/system-repository

The pkg install -nv output also shows that installing the group/feature/amp package does not create a new boot environment by default. A new boot environment is automatically created when you update particular system packages such as some drivers and other kernel components. A new boot environment might be automatically created when you install, uninstall, or update.


Tip - Explicitly specifying a new boot environment is the safest way to install or update.

The new boot environment is a clone of the current boot environment with the specified install, uninstall, or update changes applied. The current boot environment is not modified. The system is not automatically restarted. The new boot environment is the default boot selection the next time you restart the system. The current boot environment is still available to be booted.


Use the --be-name option to force a new boot environment to be created.

# pkg install --be-name s11amp group/feature/amp
           Packages to install:   8
       Create boot environment: Yes
Create backup boot environment:  No

DOWNLOAD                                  PKGS       FILES    XFER (MB)
Completed                                  8/8     640/640    70.9/70.9

PHASE                                        ACTIONS
Install Phase                                942/942

PHASE                                          ITEMS
Package State Update Phase                       8/8
Image State Update Phase                         2/2

PHASE                                          ITEMS
Reading Existing Index                           8/8
Indexing Packages                                8/8

A clone of solaris-174 exists and has been updated and activated.
On the next boot the Boot Environment s11amp will be
mounted on '/'.  Reboot when ready to switch to this updated BE.

# pkg list group/feature/amp
pkg list: no packages matching 'group/feature/amp' installed

The pkg list command reports that the group/feature/amp package is not installed because the group/feature/amp package is not installed in the current boot environment. The group/feature/amp package is installed in the new s11amp boot environment.

Use the beadm list command to check that the system has a new active boot environment named s11amp. The “N” boot environment is currently booted; the “R” boot environment is the default on reboot.

# beadm list
BE           Active Mountpoint Space   Policy Created
--           ------ ---------- -----   ------ -------
s11amp       R      -          20.75G  static 2011-09-23 13:58
solaris      -      -          44.81M  static 2010-11-07 17:45
solaris-151a -      -          158.12M static 2010-11-12 14:37
solaris-174  N      /          30.04M  static 2011-09-02 12:38

Check that the group/feature/amp package is installed in the new boot environment. The “i” in the I column indicates that the group/feature/amp package is installed.

# beadm mount s11amp /mnt
# pkg -R /mnt list group/feature/amp
NAME (PUBLISHER)       VERSION                      IFO
group/feature/amp      0.5.11-0.174.0.0.0.0.2559    i--

Remember to unmount the s11amp boot environment.

# beadm list
BE           Active Mountpoint Space   Policy Created
--           ------ ---------- -----   ------ -------
s11amp       R      /mnt       20.75G  static 2011-09-23 13:58
solaris      -      -          44.81M  static 2010-11-07 17:45
solaris-151a -      -          158.12M static 2010-11-12 14:37
solaris-174  N      /          30.05M  static 2011-09-02 12:38
# beadm unmount s11amp
# beadm list
BE           Active Mountpoint Space   Policy Created
--           ------ ---------- -----   ------ -------
s11amp       R      -          20.75G  static 2011-09-23 13:58
solaris      -      -          44.81M  static 2010-11-07 17:45
solaris-151a -      -          158.12M static 2010-11-12 14:37
solaris-174  N      /          30.06M  static 2011-09-02 12:38

Updating All Installed Packages

Use one of the following commands to update all currently installed packages that have updates available for this image:

All packages that are installed in the current image and that have updates available for this image are updated.

This operation is likely to update key system packages and create a new boot environment. As a best practice, use the -nv option with this command first. Then use the --be-name option if necessary to create a new boot environment with the specified name.