|
|||||||||||||||
|
1. Image Packaging System (IPS) For New Users Basic Rules of pkg(5) Command Multi-Repository Support |
Using IPS Commands (Tasks)The following section provides information for end users to install, upgrade, search, and manage packages in the IPS repository. Installing, Upgrading, and Managing PackagesThe pkg(1) command is the retrieval client for the image packaging system. pkg(1) can be invoked to perform the following actions :
Refer to the Chapter 8, pkg(1) Command Reference and the pkg(1) man page to learn more about the subcommands and options for the pkg(1) command. pkg(1) Uses FMRIsEach IPS package is represented by a Fault Management Resource Identifier (FMRI). The pkg(1) command uses valid FMRI package information to perform its command actions. The FMRI includes descriptive information about the package, such as the package name, version information, and date. For example, the FMRI, pkg://opensolaris.org/library/libc@5.11,5.11-0.75:20071001T163427Z, consists of the following sequence of information :
Creating ImagesThe pkg(1) command is used to create an image. An installed OpenSolaris 2008.11 release on your system, constitutes an image. Packages can be installed directly within this image. New images are created to mark a boundary between the packages installed in different images. The image-create command sets up a relationship between the image and a server that can be accessed to add packages to the image. Images can be of three types:
Note - Refer to the Table 8-1 for a table of all the options and their descriptions associated with the pkg(1) commands. How to Create an ImageBefore You BeginEnsure that you have write privileges to the directory where you are attempting to create an image.
Example 2-1 Creating a Full ImageIn this example, a full image is created with a repository server, http://pkg.example.com set as the preferred authority. The image is created in the directory, /aux0/example_root. The -a option is used to specify a server such as http://pkg.example.com:10000. $ pfexec pkg image-create -F -a example.com=http://pkg.example.com:10000 /aux0/example_root Image Creation: Important Considerations
How to Display Image Property
Example 2-2 Displaying Image Property$ pkg property PROPERTY VALUE send-uuid False require-optional False lush-content-cache-on-success False display-copyrights True preferred-authority opensolaris.org pursue-latest True How to Set An Image Property
Example 2-3 Set the Value of an Image PropertyThis example sets the value of the send-uuid property. pkg property PROPERTY VALUE send-uuid False require-optional False flush-content-cache-on-success False display-copyrights True preferred-authority opensolaris.org pursue-latest True pkg -R set-property send-uuid True pkg property PROPERTY VALUE send-uuid True require-optional False flush-content-cache-on-success False display-copyrights True preferred-authority local pursue-latest True How to Remove an Image Property
Example 2-4 Remove an Image PropertyThis example removes the send-uuid property. $ pkg unset-property send-uuid $ pkg property PROPERTY VALUE send-uuid False require-optional False flush-content-cache-on-success False display-copyrights True preferred-authority local pursue-latest True How to Perform a Dry-Run Installation Inside a New ImageBefore installing packages, you have the option to perform a dry run installation. A dry run enables you to execute the command without making persistent changes to the image. The dry run option does not install any packages and only shows the changes that are made if the packages are installed.
Example 2-5 Performing a Dry-Run Installation of the SUNWzsh PackageThe following example shows a dry-run installation of the SUNWzsh package with verbose (-v) output. $ pkg install --nv SUNWzsh UNEVALUATED:+pkg:/SUNWzsh@4.2.5,5.11-0.75:20071019T203321Z one -> pkg:/SUNWlibms@0.5.11,5.11-0.75:20071024T204210Z [dir, file, link, and other actions for each resource delivered by this package and succeeding packages omitted] None -> pkg:/SUNWzlib@1.2.3,5.11-0.75:20071024T204906Z None -> pkg:/SUNWlxml@2.6.23,5.11-0.75:20071024T204221Z None -> pkg:/SUNWpool@0.5.11,5.11-0.75:20071024T204717Z None -> pkg:/SUNWpr@0.5.11,5.11-0.75:20071024T204720Z None -> pkg:/SUNWlibsasl@0.5.11,5.11-0.75:20071024T204217Z None -> pkg:/SUNWtls@0.5.11,5.11-0.75:20071024T202854Z None -> pkg:/SUNWopenssl@0.9.8,5.11-0.75:20071024T204623Z None -> pkg:/SUNWcsl@0.5.11,5.11-0.75:20071024T202529Z None -> pkg:/SUNWlibC@0.5.11,5.11-0.75:20071024T204202Z None -> pkg:/SUNWpcre@7.0,5.11-0.75:20071019T202909Z None -> pkg:/SUNWzsh@4.2.5,5.11-0.75:20071019T203321Z How to Install a Package
Example 2-6 Install a PackageThis example installs a SUNWphp524-mysql package. The output displays the status of the download, number of packages that were installed, number of files that were installed and the size (in megabytes) of the download. $ pfexec pkg install SUNWphp524-mysql DOWNLOAD PKGS FILES XFER (MB) Completed 3/3 301/301 123.70/123.70 PHASE ACTIONS Update Phase 2/2 Install Phase 404/404 Example 2-7 Install a Package From a Different RepositoryWhen an image is created, a preferred authority is set and this is the default authority from which packages are downloaded and installed. See the How to Add or Update an Authority section to set an authority. The package is then installed from the set authority. This example installs the SUNWphp524-mysql package from the http://example.opensolaris.org authority. $ pfexec pkg install pkg:/example.opensolaris.org/SUNWphp524-mysql Example 2-8 Install a package in a Mounted, Inactive Boot EnvironmentThis example installs a package in a boot environment that is mounted at /mnt. # beadm mount BE1 /mnt # pkg -R /mnt install SUNWphp524-mysql See the Getting Started with OpenSolaris 2008.11 to learn about the beadm command and boot environments. How to Verify a Package Installation
Example 2-9 Verify Package InstallationIn this example, the installation of SUNWphp524-mysql package is verified. $ pkg verify -v SUNWphp524-mysql PACKAGE STATUS pkg:/SUNWphp524-mysql OK How to Fix a Package
Example 2-10 Fix a PackageIn this example, the package SUNWfreetype2 does not install correctly and pkg verify reports the errors in the package contents. $ pkg verify SUNWfreetype2
PACKAGE STATUS
pkg:/SUNWfreetype2 ERROR
[ ... some lines removed ... ]
file: usr/include/freetype2/freetype/ftxf86.h
Group: 'root' should be 'bin'
Mode: 0644 should be 0444
file: usr/include/freetype2/freetype/t1tables.h
Group: 'root' should be 'bin'
Mode: 0644 should be 0444
file: usr/include/freetype2/freetype/ttnameid.h
Group: 'root' should be 'bin'
Mode: 0644 should be 0444
file: usr/include/freetype2/freetype/tttables.h
Group: 'root' should be 'bin'
Mode: 0644 should be 0444
file: usr/include/freetype2/freetype/tttags.h
Group: 'root' should be 'bin'
Mode: 0644 should be 0444
file: usr/include/freetype2/freetype/ttunpat.h
Group: 'root' should be 'bin'
Mode: 0644 should be 0444
file: usr/include/ft2build.h
Group: 'root' should be 'bin'
Mode: 0644 should be 0444
file: usr/lib/amd64/libfreetype.so.6
Elfhash: c1a90b38212c745d0698adfa66e4b644aefef154 should be
efd14575d6af7df5dd8022d03d4766a8e6129c08
file: usr/lib/libfreetype.so.6
usr/lib/libfreetype.so.6 is not a regular file
Group: 'root' should be 'bin'
Mode: 0777 should be 0755
Elfhash: 1db8340c2119903fad4833579b7187e671c96ba6 should be
10a061f9241ce83d86369cef4f7d174b61cb5021
file: usr/lib/pkgconfig/freetype2.pc
Group: 'root' should be 'bin'
Size: 278 bytes should be 284
Hash: b7d784e06c03bd90d87cf96f79f6753b9e683390 should be
ee16a04987cbb9f0b5c4d21cf1333e167427917a
file: usr/share/aclocal/freetype2.m4
Group: 'root' should be 'bin'
Mode: 0644 should be 0444$ pfexec pkg fix SUNWfreetype2 How to Search for Packages
Example 2-11 Search for a Package in the Installed ImageThe following example searches and locates the SUNWbash package in the installed image. $ pkg search SUNWbash INDEX ACTION VALUE PACKAGE fmri set fmri pkg:/SUNWbash@3.2.25-0.99 legacy_pkg legacy SUNWbash pkg:/SUNWbash@3.2.25-0.99 Example 2-12 Search For a Package in a Remote RepositoryIf you want to install the WebStack development package , search for the amp package in the remote (-r) repository associated with the current image. $ pkg search -r amp INDEX ACTION VALUE PACKAGE description set AMP pkg:/amp@0.5.11-0.86 description set AMP pkg:/amp@0.5.11-0.86 description set AMP pkg:/amp-dev@0.5.11-0.86 description set AMP pkg:/amp-dev@0.5.11-0.86 description set AMP pkg:/amp-dev@0.5.11-0.86 description set AMP pkg:/amp-dev@0.5.11-0.86 description set AMP pkg:/amp-dev@0.5.11-0.86 description set AMP pkg:/amp-dev@0.5.11-0.86 How to Update An Image (Update All Installed Packages)This task will update all installed packages in the current image to the latest available version. Note - All packages that have been updated in the repository will be downloaded and installed.
Example 2-13 Update an Image in a Mounted, Inactive Boot EnvironmentThis example updates an image in a boot environment that is mounted at /mnt. See the Getting Started with OpenSolaris 2008.11 to learn about the beadm command and boot environments. # beadm mount BE1 /mnt # pkg -R /mnt image-update See AlsoThe pkg image-update command can also be used to upgrade an installed boot environment. For more information, see the Upgrading and Managing Your Boot Environment section. How to Display the State of Packages
Example 2-14 Displaying the State of an Installed PackageThe following example shows the status of the SUNWbash package with the -v option, which displays the full FMRI information. This example shows information only about the installed SUNWbash package. $ pkg list -v SUNWbash FMRI STATE UFIX pkg:/SUNWbash@3.2.25,5.11-0.79:20080205T152506Z installed ---- Example 2-15 Displaying the State of All Instances of a PackageThis example shows the state of all instances of the SUNWbash package. $ pkg list -a SUNWbash NAME (AUTHORITY) VERSION STATE UFIX SUNWbash 3.2.25-0.86 installed ---- SUNWbash 3.2.25-0.79 known u--- SUNWbash 3.2.25-0.75 known u--- SUNWbash 3.2.25-0.75 known u--- How to List the Contents of a Package
Example 2-16 Listing the Contents of a PackageIn this example, we will list the name, mode of the file, size, path and the target of the following actions in the zfs package:
$ pkg contents -t dir,file,link,hardlink -o action.name,mode,pkg.size,path,target zfs NAME MODE SIZE PATH TARGET
dir 0755 etc
dir 0755 etc/fs
dir 0755 etc/fs/zfs
link etc/fs/zfs/mount ../../../sbin/zfs
link etc/fs/zfs/umount ../../../sbin/zfs
dir 0755 etc/zfs
dir 0755 lib
dir 0755 lib/amd64
link lib/amd64/libzfs.so libzfs.so.1
file 0755 469616 lib/amd64/libzfs.so.1
file 0644 62057 lib/amd64/llib-lzfs.ln
link lib/libzfs.so libzfs.so.1
[ ... ]Example 2-17 Displaying Complete Contents of a PackageThis example uses the -m option with the pkg contents command to display all actions of the SUNWbash package. $ pkg contents -m SUNWbash
set fmri = pkg://opensolaris.org
/SUNWbash@3.2.25,5.11-0.79:20080205T152506Z
dir owner=root path=usr group=sys mode=0755
dir owner=root path=usr/bin group=bin mode=0755
dir owner=root path=usr/gnu group=bin mode=0755
dir owner=root path=usr/gnu/bin group=bin mode=0755
depend fmri=pkg:/SUNWcsl@0.5.11-0.79 type=require
file 66d09735123ad3a7bdcf7640dd60acbe843d8a13
elfhash=28106285f73f97274cf99b1a7e63d7d73c31c153 elfarch=i386 mode=0555
pkg.size=730604 owner=root group=bin path=usr/bin/bash elfbits=32
legacy category=system vendor="Sun Microsystems, Inc."
name="GNU Bourne-Again shell (bash)"
version=11.11.0,REV=2007.11.29.14.44 hotline="Please contact your local service provider"
pkg=SUNWbash arch=i386 desc="GNU Bourne-Again shell (bash) version 3.2"
license ed881c52c54b67457db33ba23a1d53615e366440 path=copyright
license=SUNWbash.copyright
transaction_id=1202253906_pkg%3A%2FSUNWbash%
403.2.25%2C5.11-0.79%3A20080205T152506Z pkg.size=1207
link path=usr/gnu/bin/sh target=../../bin/bash
set name=description value="GNU Bourne-Again shell (bash)"
set fmri = pkg://VERSION_1
/SUNWbash@3.2.25,5.11-0.79:20080205T152506Z
dir owner=root path=usr group=sys mode=0755
dir owner=root path=usr/bin group=bin mode=0755
dir owner=root path=usr/gnu group=bin mode=0755
dir owner=root path=usr/gnu/bin group=bin mode=0755
depend fmri=pkg:/SUNWcsl@0.5.11-0.79 type=require
file 66d09735123ad3a7bdcf7640dd60acbe843d8a13
elfhash=28106285f73f97274cf99b1a7e63d7d73c31c153
elfarch=i386 mode=0555 pkg.size=730604 owner=root group=bin path=usr/bin/bash elfbits=32
legacy category=system vendor="Sun Microsystems, Inc."
name="GNU Bourne-Again shell (bash)" version=11.11.0,REV=2007.11.29.14.44
hotline="Please contact your local service provider"
pkg=SUNWbash arch=i386 desc="GNU Bourne-Again shell (bash) version 3.2"
license ed881c52c54b67457db33ba23a1d53615e366440 path=copyright
license=SUNWbash.copyright
transaction_id=1202253906_pkg%3A%2FSUNWbash%403.2.25
%2C5.11-0.79%3A20080205T152506Z
pkg.size=1207
link path=usr/gnu/bin/sh target=../../bin/bash
set name=description value="GNU Bourne-Again shell (bash)"
How to List Information About a Package
Example 2-18 Display Package InformationThis example displays information about the SUNWbash package. Name: SUNWbash Summary: GNU Bourne-Again shell (bash) Authority: pkg.com (preferred) Version: 3.2.25 Build Release: 5.11 Branch: 0.79 Packaging Date: Tue Feb 5 15:25:06 2008 Size: 714 kB FMRI: pkg:/SUNWbash@3.2.25,5.11-0.79:20080205T152506Z Example 2-19 Display Copyright and License Information About a PackageThis example displays the copyright and license information about the SUNWGlib package. $ pkg info --license -r SUNWGlib Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. Modified by the GLib Team and others 1997-1999. See the AUTHORS file for a list of people on the GLib Team. See the ChangeLog files for a list of changes. These files are distributed with GLib at ftp://ftp.gtk.org/pub/gtk/. How to Uninstall Packages
Example 2-20 Uninstalling a PackageThis example uninstalls the SUNWphp524-mysqlpackage. $ pfexec pkg uninstall SUNWphp524-mysql PHASE ACTIONS Removal Phase 39/39 How to Add or Update an Authority
Example 2-21 Adding an Additional Package Authority$ pfexec pkg set-authority -O http://pkg.sunfreeware.com:9000 sunfreeware.com $ pkg authority AUTHORITY URL opensolaris.org (preferred) http://pkg.opensolaris.org:80/ sunfreeware.com http://pkg.sunfreeware.com:9000/ Example 2-22 Setting a Preferred AuthorityUse the -P option along with the -O option to set an authority as the preferred authority. This is the default authority from which packages are downloaded and installed. $ pfexec pkg set-authority -P -O http://pkg.sunfreeware.com:80 sunfreeware.com $ pkg authority AUTHORITY opensolaris.org http://pkg.opensolaris.org:80/ sunfreeware.com (preferred) http://pkg.sunfreeware.com:80/ See AlsoThe pkg set-authority command is also used to add and remove mirror repositories. See the Chapter 6, Mirroring Repositories section for more information. How to Remove Authority Configuration
Example 2-23 Removing an Authority$ pfexec pkg unset-authority sunfreeware.com $ pkg authority AUTHORITY URL opensolaris.org (preferred) http://pkg.opensolaris.org:80/ How to Display Authority Information
Example 2-24 Displaying Authority Information$ pkg authority AUTHORITY URL opensolaris.org (preferred) http://pkg.opensolaris.org:80/ How to View the Command History
Example 2-25 View Detailed Command History$ pkg history -l
Operation: purge-history
Outcome: Succeeded
Client: pkg
Version: 71eab3488987
User: root (0)
Start Time: 2008-10-28T09:00:35
End Time: 2008-10-28T09:00:35
Command: /usr/bin/pkg -R /export/home/dc/build_data/pkg_image purge-history
Operation: uninstall
Outcome: Succeeded
Client: pkg
Version: 71eab3488987
User: jack (65432)
Start Time: 2008-10-29T11:15:09
End Time: 2008-10-29T11:16:41
Command: /usr/bin/pkg -R /a uninstall -q SUNWslim-utils
Start State:
UNEVALUATED:
-pkg:/SUNWslim-utils@0.5.11,5.11-0.100:20081025T020505Z
End State:
pkg:/SUNWslim-utils@0.5.11,5.11-0.100:20081025T020505Z -> None
Operation: install
Outcome: Failed (Unknown)
Client: packagemanager
Version: 71eab3488987
User: jack (101)
Start Time: 2008-10-29T11:31:13
End Time: 2008-10-29T11:32:04
Command: /usr/bin/packagemanager
How to Delete The Command History Information
How to View The List of Available Commands
Authority vs RepositoryAn authority and a repository definition are sometimes used interchangeably in IPS and have different meanings at other times. The following points expound upon the definitions and clarify their usage.
|
||||||||||||||
|