分类: SOLARIS
2017-09-28 10:10:19
Oracle Solaris 11 映像包管理系统(IPS)
IPS pkg程序
子命令 |
说明 |
pkg publisher |
列出系统当前活跃的以及被禁用的存储库发布者 |
pkg set-publisher |
在系统发布者列表上添加一个发布者 |
pkg unset-publisher |
在系统发布者列表删除一个发布者 |
pkg list |
列出已安装的软件包 |
pkg search |
在系统活跃发布者列表中搜索软件包,直到找到第一个匹配项 |
pkg install |
安装和更新软件包 |
pkg uninstall |
从系统中御载一个软件包 |
pkg refresh |
更新系统可用软件包的缓存列表(来自活跃发布者) |
pkg update |
不使用参数,将所有已安装的软件包更新到最新可用的安装版本,或指定一个将更新的软件包 |
pkg info |
显示软件包信息 |
pkg contents |
显示软件包中的文件和目录内容 |
pkg verify |
验证已安装和经过数字签名的软件包 |
pkg history |
显示映像的历史命令记录 |
pkg help |
显示pkg子命令的一些使用信息 |
markgeng@ZERO:~$ pkg publisher
PUBLISHER TYPE STATUS P LOCATION
solaris origin online F
markgeng@ZERO:~$sudo pkg set-publisher -g sfe
markgeng@ZERO:~$ pkg publisher
PUBLISHER TYPE STATUS P LOCATION
solaris origin online F
sfe origin online F
markgeng@ZERO:~$ pkg publisher solaris
Publisher: solaris
Alias:
Origin URI:
SSL Key: NZERO
SSL Cert: NZERO
Client UUID: 55dc8a86-fbe5-11e3-bc11-811d2d030777
Catalog Updated: October 14, 2014 11:16:58 PM
Enabled: Yes
markgeng@ZERO:~$ pkg publisher sfe
Publisher: sfe
Alias:
Origin URI: /
SSL Key: NZERO
SSL Cert: NZERO
Client UUID: a438a184-57a6-11e4-b499-a7459eeedec9
Catalog Updated: May 4, 2014 09:50:15 PM
Enabled: Yes
markgeng@ZERO:~$ pkg list *mysql*
NAME (PUBLISHER) VERSION IFO
database/mysql-55/library 5.5.31-0.175.2.0.0.42.1 i--
library/apr-util-13/dbd-mysql 1.3.9-0.175.2.0.0.42.1 i--markgeng@ZERO:~$ pkg list -v *mysql*
FMRI IFO
pkg://solaris/database/mysql-55/library@5.5.31,5.11-0.175.2.0.0.42.1:20140623T011152Z i--
pkg://solaris/library/apr-util-13/dbd-mysql@1.3.9,5.11-0.175.2.0.0.42.1:20140623T013807Z i--
建立本地源:
1.下载并合成软件库
markgeng@ZERO:~/iso$ sh install-repo.ksh -d /export/home/markgeng/iso/ -I -v -c
Comparing checksums of downloaded files...dZERO. Checksums match.
Uncompressing sol-11_2-repo-1of4.zip...dZERO.
Uncompressing sol-11_2-repo-2of4.zip...dZERO.
Uncompressing sol-11_2-repo-3of4.zip...dZERO.
Uncompressing sol-11_2-repo-4of4.zip...dZERO.
Repository can be found in /export/home/markgeng/iso/.
Initiating repository verification.
Building ISO image...dZERO.
ISO image and instructions for using the ISO image are at:
/export/home/markgeng/iso/sol-11_2-repo.iso
/export/home/markgeng/iso/README-repo-iso.txt
2.新增档案系统
markgeng@ZERO:~$ sudo zfs create rpool/export/repo11.2
markgeng@ZERO:~$ sudo zfs atime=off rpool/export/repo11.2
markgeng@ZERO:~$ sudo zfs list rpool/export/repo11.2
NAME USED AVAIL REFER MOUNTPOINT
rpool/export/repo11.2 31K 67.9G 31K /export/repo11.2
3.新增软件库
markgeng@ZERO:~$ sudo pkgrepo create /export/repo11.2/
4.挂载软件库
markgeng@ZERO:~$ sudo lofiadm -a /home/markgeng/Downloads/sol-11_2-repo.iso /dev/lofi/1
markgeng@ZERO:~$ sudo mount -rF hsfs /dev/lofi/1 /mnt
……
/dev/lofi/1 8.2G 8.2G 0K 100% /mnt
5.复制软件库
markgeng@ZERO:~$ cd /mnt/repo/
markgeng@ZERO:/mnt/repo$ sudo tar cf - . |(cd /export/repo11.2;sudo tar xfBp -)
6.卸载软件库
markgeng@ZERO:/mnt/repo$ cd
markgeng@ZERO:~$ sudo umount /mnt
markgeng@ZERO:~$ sudo lofiadm -d /dev/lofi/1
7.更新搜寻索引
markgeng@ZERO:~$ sudo pkgrepo -s /export/repo11.2/ refresh
Initiating repository refresh.
8.重新配置服务
markgeng@ZERO:~$ sudo svccfg -s application/pkg/server setprop pkg/inst_root=/export/repo11.2/
Password:
markgeng@ZERO:~$ sudo svccfg -s application/pkg/server setprop pkg/readonly=true
markgeng@ZERO:~$ sudo svcprop -p pkg/inst_root application/pkg/server
/export/repo11.2/
markgeng@ZERO:~$ sudo pkgrepo rebuild -s /export/repo11.2/
Initiating repository rebuild
9.重新启动服务
markgeng@ZERO:~$ sudo svcadm refresh application/pkg/server
Password:
markgeng@ZERO:~$ sudo svcadm enable application/pkg/server
10.重设发布者指向
markgeng@ZERO:~$ sudo pkg set-publisher -G '*' -g solaris
11.检查软件库
markgeng@ZERO:~$ sudo pkgrepo info -s /export/repo11.2/
PUBLISHER PACKAGES STATUS UPDATED
solaris 4870 online 2014-10-25T22:22:43.561259Z
markgeng@ZERO:~$ sudo pkgrepo get -s /export/repo11.2/
SECTION PROPERTY VALUE
publisher prefix solaris
repository check-certificate-revocation False
repository description This\ repository\ serves\ a\ copy\ of\ the\ Oracle\ Solaris\ 11.2\ Build\ 42\Package\ Repository.
repository name Oracle\ Solaris\ 11.2\ Build\ 42\ Package\ Repository
repository signature-required-names ()
repository trust-anchor-directory /etc/certs/CA/
repository version 4
markgeng@ZERO:~$ sudo pkgrepo get -p solaris -s /export/repo11.2/
PUBLISHER SECTION PROPERTY VALUE
solaris publisher alias
solaris publisher prefix solaris
solaris repository collection-type core
solaris repository description ""
solaris repository legal-uris ()
solaris repository mirrors ()
solaris repository name ""
solaris repository origins ()
solaris repository refresh-seconds ""
solaris repository registration-uri ""
solaris repository related-uris ()
markgeng@ZERO:~$ pkg publisher
PUBLISHER TYPE STATUS P LOCATION
solaris origin online F
markgeng@ZERO:~$ sudo pkg install assembler
Password:
Packages to install: 1
Create boot environment: No
Create backup boot environment: No
DOWNLOAD PKGS FILES XFER (MB) SPEED
Completed 1/1 6/6 0.2/0.2 947k/s
PHASE ITEMS
Installing new actions 13/13
Updating package state database DZERO
Updating package cache 0/0
Updating image state DZERO
Creating fast lookup database DZERO
Updating package cache 1/1
12.Web页面查询
在内网的使用:
markgeng@ONE:~$ pkg publisher
PUBLISHER TYPE STATUS P LOCATION
markgeng@ONE:~$ sudo pkg set-publisher -g solaris
markgeng@ONE:~$ pkg publisher
PUBLISHER TYPE STATUS P LOCATION
solaris origin online F
markgeng@ONE:~$ sudo pkg install *bind*
Packages to install: 1
Services to change: 1
Create boot environment: No
Create backup boot environment: No
DOWNLOAD PKGS FILES XFER (MB) SPEED
Completed 1/1 38/38 1.4/1.4 1012k/s
PHASE ITEMS
Installing new actions 71/71
Updating package state database ONE
Updating package cache 0/0
Updating image state ONE
Creating fast lookup database ONE
Updating package cache 1/1