solaris10软件包管理
solaris10软件包管理Software package administration adds software to
systems
and removes software from systems. Sun and its third-party vendors deliver software products to users in software packages.
The term package refers to the method of distributing
software products
and installing them in systems. In its simplest form, a package
is a collection of files and directories.
Note: The Solaris
OS software
installation process installs all the required software packages automatically, based on the
software group configuration choice.
Software packages
contain:
Files that describe the package and the amount of disk space required for installation
Compressed
software
files to be installed on the system
Optional scripts that run when the package is added or removed
The /var/sadm/install/contents file is a complete record of all the software packages installed on the local system disk. It references every
file and directory belonging to every software package and shows the configuration of each product installed. To list the contents of
the /var/sadm/install/contents file, perform the command:
# more /var/sadm/install/contents
(output edited for brevity)
/bin=./usr/bin s none SUNWcsr
/boot d none 0755 root sys SUNWcakr SUNWrmodr CADP160 SUNWadp
SUNWradpu320 SUNWcadp SYMhisl
/boot/mdboot f none 0644 root sys 512 46527 1102750707 SUNWrmodr
/boot/mdbootbp f none 0644 root sys 512 46527 1102750707 SUNWrmodr
/boot/rc.d d none 0755 root sys SUNWrmodr
/boot/rc.d/icdinst9.sh f none 0644 root sys 2680 21138 1102750707 SUNWrmodr
The pkgadd command updates the /var/sadm/install/contents file each time new packages are installed.
The pkgrm command uses the /var/sadm/install/contents file to determine where the files for a software package are located on the system.
When a package is removed from the system, the pkgrm command updates the /var/sadm/install/contents file.
To determine if a particular file was installed on the system disk and to find the directory in which it is located, use the pkgchk command with either
the full or partial pathname of the command you wish to report on. For example, to verify that the showrev command is installed on the system disk,
perform the command:
# pkgchk -l -P showrev
Pathname: /usr/bin/showrev
Type: regular file
Expected mode: 0755
Expected owner: root
Expected group: sys
Expected file size (bytes): 29980
Expected sum(1) of contents: 57864
Expected last modification: Dec 14 06:17:58 AM 2004
Referenced by the following packages:
SUNWadmc
Current status: installed
Pathname: /usr/share/man/man1m/showrev.1m
Type: regular file
Expected mode: 0644
Expected owner: root
Expected group: root
Expected file size (bytes): 3507
Expected sum(1) of contents: 35841
Expected last modification: Dec 10 10:42:54 PM 2004
Referenced by the following packages:
SUNWman
Current status: installed
Solaris OS packages can be in one of two formats:
File system
(or Directory) format
Data stream format
Packages delivered in file system format consist of multiple files and directories. Packages delivered in data stream format consist of a single file only.
File System Format
An example of a package (SUNWzsh) in file system format:
# ls -ld SUNWzsh
drwxr-xr-x 5 root staff 2048 Dec 14 03:53 SUNWzsh
# cd SUNWzsh
# ls -l
total 127
drwxr-xr-x 2 root staff 2048 Dec 14 03:53 archive
drwxr-xr-x 2 root staff 2048 Dec 14 03:53 install
-rw-r–r– 1 root staff 445 Dec 14 02:55 pkginfo
-rw-r–r– 1 root staff 58248 Dec 14 02:55 pkgmap
drwxr-xr-x 3 root staff 2048 Dec 14 03:53 reloc
#
The package consists of a directory that matches the package name, and other files and directories including the pkginfo and pkgmap files.
Data Stream Format
An example of a package in data stream format:
# ls -l SUNWzsh.pkg
-rw-r–r– 1 root root 924672 Jan 20 18:30 SUNWzsh.pkg
# file SUNWzsh.pkg
SUNWzsh.pkg: package datastream
# head SUNWzsh.pkg
# PaCkAgE DaTaStReAm
SUNWzsh 1 1790
# end of header
NAME=Z shell (zsh)
ARCH=i386
VERSION=11.10.0,REV=2004.12.10.01.10
SUNW_PRODNAME=SunOS
SUNW_PRODVERS=5.10/SunOS Development
SUNW_PKGTYPE=usr
MAXINST=1000
#
Packages downloaded from the Internet are most often in data stream format.
From the command line, you can translate, add, remove, check the state of, and display information about packages.
The command-line tools for translating packages, viewing software, adding software, and removing software from a
workstation
after the Solaris
OS software is installed on a system include:
Command-line Package Tools
Tool
Description
pkgtrans
Translates packages from one format to another
pkgadd
Installs software
packages to the system
pkgrm
Removes a package from the system
pkginfo
Displays software package information
pkgchk
Checks package installation state
Use the pkgtrans command to translate a package from file system format to data stream format, or from data stream format to file system format. The
command syntax for the pkgtrans command is:
# pkgtrans file_or_dir_path file_or_dir_path [ package_name …]
For example to translate a package from file system format in /var/tmp to data stream format, use:
# pkgtrans /var/tmp /tmp/SUNWzsh.pkg SUNWzsh
Transferringpackage instance
The first argument above is the directory where the file system format package is stored. The second argument is the package data stream file. The third
argument is the package to translate.
If a package name is not given, the pkgtrans command provides a list of all packages in the directory and prompts the user for the packages to translate.
Note: Students need to insert the appropriate
Solaris 10
Software CD-ROM x86 Platform Edition or Solaris 10 OS Software DVD to demonstrate
the steps described in this module.
Use the pkginfo command to display information about the software packages installed on the local system’s disk. The /var/sadm/pkg directory
maintains a record of all installed packages.
For example, to display information about software packages installed on the local system’s disk, perform the command:
# pkginfo | more
system SUNWaccrSystem Accounting, (Root)
system SUNWaccuSystem Accounting, (Usr)
system SUNWaclg
Apache
Common Logging
system SUNWadmap System administration applications
system SUNWadmcSystem administration core libraries
system SUNWadmfw System & Network Administration Framework
system SUNWadmjAdmin/Install Java Extension Libraries
system SUNWadmrSystem & Network Administration Root
ALE SUNWciu8Simplified Chinese (EUC) iconv modules for UTF-8
CTL SUNWctpls Portable layout services for Complex Text Layout support
The column on the left displays the package category, such as application, system, Complex Text Layout (CTL), or Alternate Language
Environment (ALE). A CTL language is any language which stores text differently than it is displayed. An ALE is an alternate language, different
from the basic Solaris OS languages.
The center column displays the software package name. If it begins with SUNW, it is a Sun Microsystems product.
Otherwise, it represents a third-party package.
The column on the right displays a brief description of the software product.
Displaying Information for All Packages
To display all the available information about the software packages, use the pkginfo command with the -l option.
For example, to view additional information about each software package installed on the local systems hard drive, perform the command:
# pkginfo -l | more
(output omitted)
Displaying Information for a Specific Package
To display the information for a specific software package, specify its name on the command line.
For example, to view the information for the SUNWman software package, perform the command:
# pkginfo -l SUNWman
PKGINST:SUNWman
NAME:On-Line Manual Pages
CATEGORY:system
ARCH:i386
VERSION:43.0,REV=74.0
BASEDIR:/usr
VENDOR:Sun Microsystems, Inc.
DESC:System Reference Manual Pages
PSTAMP:2004.12.09.16.45
INSTDATE:Dec 29 2004 18:46
HOTLINE:Please contact your local service provider
STATUS:completely installed
FILES: 11634 installed pathnames
15 shared pathnames
189 directories
66673 blocks used (approx) The last line identifies the size of the package. The number of blocks used defines how much space is needed on the disk to install the package.Note: A block is a 512-byte disk block.To determine how many packages are currently installed on disk, perform the command:# pkginfo | wc -l
657Displaying Information for Software PackagesTo view information about packages that are located on the Solaris 10 Software 1 CD-ROM x86 Platform Edition, perform the command:pkginfo -d /cdrom/cdrom0/s2/Solaris_10/Product |more
The software groups located on Solaris 10 Software 1 CD-ROM are Reduced Networking Core System Support and Core System Support.
To view information about packages that are located on any of the remaining Solaris 10 Software CD-ROMs or on the Solaris 10 OS Software DVD
, perform the command:pkginfo -d /cdrom/cdrom0/Solaris_10/Product |more
The software groups located on the Solaris 10 OS Software 2, 3, and 4 CD-ROMs are the End User System Support, Developer System Support,
Entire Distribution, and Entire Distribution Plus OEM Support software groups.
When you add a
software package
, the pkgadd command copies the files from the installation media to the local system’s disk and executes scripts
to uncompress files. By default, the pkgadd command requires confirmation during the package add process.
For example, to transfer the SUNWvts software package from a CD-ROM and install it on the system, perform the commands:# cd /cdrom/cdrom0/
Solaris
_10/ExtraValue/CoBundled/SunVTS_6.0/Packages
# pkgadd -d . SUNWvts
Processing package instancefrom
SunVTS Framework(i386) 6.0,REV=2004.12.02.12.00
Copyright 2004 Sun Microsystems, Inc.All rights reserved.
Use is subject to license terms.
Usingas the package base directory.
## Processing package information.
## Processing system information.
## Verifying package dependencies.
## Verifying
disk space
requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.
This package contains scripts which will be executed with super-user
permission during the process of installing this package.
Do you want to continue with the installation of y
Installing SunVTS Framework as
## Installing part 1 of 1.
9213 blocks
Installation ofwas successful.
To install all the packages in a
data stream
format package, perform the command:# pkgadd -d /tmp/SUNWzsh.pkg all
Processing package instancefrom
Z shell(i386) 11.10.0,REV=2004.12.10.01.10
Copyright 2004 Sun Microsystems, Inc. All rights reserved.
Usingas the package base directory.
## Processing package information.
## Processing
system
information.
5 package pathnames are already properly installed.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.
Installing Z shell as
## Installing part 1 of 1.
1790 blocks
Installation ofwas successful.
#Packages in data stream format can also be added from a
web server
using the following command:
The pkgchk command checks to determine if a package has been completely installed on the system. The pkgchk command also checks the path name,
the
file size
and checksum, and the file attributes of a package. If the pkgchk command does not display a message, it indicates the package was
installed successfully and that no changes have been made to any files or directories in the package.
The following example checks the contents and attributes of the SUNWapchr software package currently installed on the system.# pkgchk SUNWapchr
#
To list the files contained in a software package, use the -v option.
For example, to list the files in the SUNWzsh software package, perform the command:# pkgchk -v SUNWzsh
/usr
/usr/bin
/usr/bin/zsh
/usr/sfw
/usr/sfw/bin
/usr/sfw/bin/zsh
/usr/sfw/bin/zsh-4.2.1
/usr/sfw/lib
/usr/sfw/lib/zsh
/usr/sfw/lib/zsh/4.2.1
/usr/sfw/lib/zsh/4.2.1/zsh
/usr/sfw/lib/zsh/4.2.1/zsh/cap.so
/usr/sfw/lib/zsh/4.2.1/zsh/clone.so
/usr/sfw/lib/zsh/4.2.1/zsh/compctl.so
/usr/sfw/lib/zsh/4.2.1/zsh/complete.so
/usr/sfw/lib/zsh/4.2.1/zsh/complist.so
To determine if the contents and attributes of a file have changed because it was installed with its software package, use the -p option.
For example, to check the /etc/shadow file, perform the command:# pkgchk -p /etc/shadow
ERROR: /etc/shadow
modtimeexpectedactual
file sizeexpectedactual
file cksumexpectedactual
The differences in modtime, file size, and checksum indicate that the original /etc/shadow file has changed in size because the initial
Solaris
OS software
installation.
The -l option with the pkgchk command lists information about selected files that make up a package.
For example, to list information about the /usr/bin/showrev file, perform the command:# pkgchk -l -p /usr/bin/showrev
Pathname: /usr/bin/showrev
Type: regular file
Expected mode: 0755
Expected owner: root
Expected group: sys
Expected file size (bytes): 29656
Expected sum(1) of contents: 31261
Expected last modification: Sep 02 09:21:11 2004
Referenced by the following packages:
SUNWadmc
Current status: installed
If the -p option is used, the full path must be typed for the pkgchk command to return information about the file. if the -P option is used, a
partial pathname can be supplied.
For example, the pkgchk command does not return any information if the /usr/bin/ path is removed from the previous example.# pkgchk -l -p showrev
## pkgadd -d http://instructor/packages/SUNWzsh.pkg all
## Downloading…
…………..25%…………..50%…………..75%…………..100%
## Download Complete
Processing package instancefrom
Z shell(i386) 11.10.0,REV=2004.12.10.01.10
Copyright 2004 Sun Microsystems, Inc. All rights reserved.
Usingas the package base directory.
## Processing package information.
## Processing system information.
5 package pathnames are already properly installed.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.
Installing Z shell as
## Installing part 1 of 1.
1790 blocks
Installation ofwas successful.
#
The pkgrm command removes a software package from the system and deletes all of the files associated with that package,
unless other packages share those files.
By default, the pkgrm command requires confirmation to continue removing a package and issues a message to warn about possible
package dependencies. If package dependencies do exist, the command again requires confirmation to continue with the package removal process.
The following command removes the SUNWapchr software package from the system.
Caution: Be cautious of the dependency warnings you receive when removing a package. The system allows you to remove these
packages even though they may be required by a different package.
# pkgrm SUNWapchr The following package is currently installed: SUNWapchr
Apache Web Server
(root) (i386) 11.10.0,REV=2004.12.10.01.10 Do you want to remove
this package? y ## Removing installed package instance## Verifying package dependencies.
WARNING: Thepackage depends on the package currently being removed. WARNING: Thepackage depends on the package currently being removed. WARNING: Thepackage depends on the package currently being removed. WARNING: Thepackage depends on the package currently being removed. Dependency checking failed. Do you want to continue with the removal of this package y ## Processing package information. ## Removing pathnames in class/etc/rcS.d/K16apache /etc/rc3.d/S50apache /etc/rc2.d/K16apache (output ommited for brevity) /etc/apache/httpd.conf-example /etc/apache/README.Solaris /etc/apache/etc## Updating system information. Removal ofwas successful.
Note: A file shared by two or more packages displays the message filename . The message is removed
only when the file is no longer shared.
For convenience, copy frequently installed software packages from the Solaris 10 Software CD-ROMs or Solaris 10 Software DVD to a
spool directory on the system.
The default installation directory for packages that have been spooled, but not installed, is /var/spool/pkg.
The pkgadd command, by default, looks
in the /var/spool/pkg directory for any packages specified on the command line.
Copying packages from the CD-ROM or DVD into a spool directory is not the same as installing the packages on disk.
To copy a package from the Solaris 10 OS Software CD-ROM into the /var/spool/pkg directory, perform the command:
# pkgadd -d /cdrom/cdrom0/s2/Solaris_10/Product -s spool SUNWauda Transferringpackage instance
The -s option with the keyword spool copies the package into the /var/spool/pkg directory by default.
To verify that the package exists in the spool directory, perform the command:
# ls -al /var/spool/pkg
total 6
drwxrwxrwt 3 root bin 512 Oct 1 14:26 .
drwxr-xr-x 12 root bin 512 Sep 30 20:03 ..
drwxrwxr-x 5 root root 512 Oct 1 14:26
SUNWaudaTo add the package from the spool area, perform the following
# pkgadd SUNWauda (output omitted for brevity)To remove software packages from a spool directory, use the pkgrm command with the -s option.
# pkgrm -s spool SUNWauda The following package is currently spooled: SUNWauda Audio Applications (i386) 11.10.0,REV=2004.12.11.02.53 Do you want to remove
this package? y Removing spooled package instance If alternative spooling directories exist, specify which directory to use
by adding a directory path to the -s option.
For example, to select the /export/pkg directory, perform the commands:
# pkgadd -d /cdrom/cdrom0/s2/Solaris_10/Product -s /export/pkg SUNWauda # pkgrm -s /export/pkg SUNWaudaPackages can be individually
or collectively packaged into a datastream file format. The datastream file can then be made available as a shared network file or from a web page.
To create a data streamed package, perform the following commands:
# cd /cdrom/cdrom0/s2/Solaris*
# pkgtrans Product /var/tmp/stream.pkg SUNWzlib SUNWftpr SUNWftpu
Transferringpackage instance
Transferringpackage instance
Transferringpackage instance
# file /var/tmp/stream.pkg
/var/tmp/stream.pkg: package datastream
# head -5 /var/tmp/stream.pkg
# PaCkAgE DaTaStReAm
SUNWzlib 1 160
SUNWftpr 1 52
SUNWftpu 1 268
# end of header
# pkgadd -d /var/tmp/stream.pkg
The following packages are available:
1 SUNWftpr FTP Server, (Root)
(i386) 11.10.0,REV=2004.12.11.02.53
2 SUNWftpu FTP Server, (Usr)
(i386) 11.10.0,REV=2004.12.11.02.53
3 SUNWzlib The Zip compression library
(i386) 11.10.0,REV=2004.12.10.01.10
Select package(s) you wish to process (or ‘all’ to process
all packages). (default: all) [?,??,q]: q
This section details the package administration tasks.
The table summarizes the commands used for package administration.
Package Administration Commands
Command Name
Description
pkgtrans
Translates packages from one format to another
pkgadd
Installs software packages to the system
pkgrm
Removes a package from the system
pkginfo
Displays software package information
pkgchk
Checks package installation state
The table summarizes the files and directories used in package administration.
Package Administration Files and Directories
File or Directory
Description
/var/sadm/install/contents
A software package map of the entire system
/opt/pkgname
The preferred location for the installation of unbundled packages
/opt/pkgname/bin
or /opt/bin
The preferred location for the executable files of unbundled packages
/var/opt/pkgname or /etc/opt/pkgname
The preferred location for log files of unbundled packages
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/36549/showart_467854.html
页:
[1]