|Skip Navigation Links|
|Exit Print View|
|Oracle Solaris Administration: Common Tasks Oracle Solaris 11 Information Library|
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.
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
Use one of the following commands to update all currently installed packages that have updates available for this image:
Do not specify any packages to update.
# pkg update --be-name updateBEname
Specify '*' as the packages to update.
# pkg update --be-name updateBEname '*'
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.