官术网_书友最值得收藏!

Publishing packages into a repository

Certainly, inserting packages into a local repository won't be a very frequent task, but surprisingly, this action saves time. Besides, this topic isn't hard; the process is very interesting because we will learn to handle complex programs such as Veritas Storage Foundations HA.

Getting ready

To follow this recipe, it's necessary that we have a machine (physical or virtual) running Oracle Solaris 11; we log in to the system as the root user and open a terminal. Additionally, it's preferable that our Solaris 11 system has access to the Internet.

How to do it…

We can set the prefix that was previously marked alexandreborges.org to training to make our administration easier and more consistent with the name of the instance service that we chose when an SMF service entry was made for this repository:

root@solaris11:~# pkgrepo set -s /repo_pool/training_repo publisher/prefix=training

An interesting fact is that the repository is usually created as read-only, and to change it to read/write is straightforward:

root@solaris11:~# svccfg -s application/pkg/server:training setprop pkg/readonly=false

The result of the previous command can be seen by running the following command:

root@solaris11:~# svcprop -p pkg/readonly application/pkg/server:training
false

We now reload the configurations and start the repository services again:

root@solaris11:~# svcadm refresh pkg/server:training
root@solaris11:~# svcadm restart pkg/server:training
root@solaris11:~# svcs pkg/server:training
STATE          STIME    FMRI
online         18:37:43 svc:/application/pkg/server:training

The new repository (training) doesn't appear in the publisher list yet:

root@solaris11:~# pkg publisher
PUBLISHER      TYPE    STATUS  P  LOCATION
solaris        origin  online  F  http://pkg.oracle.com/solaris/release/
solarisstudio  origin  online  F  https://pkg.oracle.com/solarisstudio/release/

What's this solarisstudio publisher? Where did this publisher line come from? Relax! I've installed the Oracle Solaris Studio 12.3 to execute some tests (not shown here), but you can disregard it. There's nothing related to the current explanation, but if you're a developer, you can try it from http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/index.html.

Returning to the main subject, we need to add the publisher (training) that points to the secondary repository (http://localhost:8888) by running the following command:

root@solaris11:~# pkg set-publisher -O http://localhost:8888 training
root@solaris11:~# pkg publisher
PUBLISHER                   TYPE     STATUS P LOCATION
solaris                     origin   online F http://pkg.oracle.com/solaris/release/
solarisstudio               origin   online F https://pkg.oracle.com/solarisstudio/release/
training                    origin   online F http://localhost:8888/

Finally, let's pick two packages (wireshark and wireshark-common) from the solaris repository and include them in the secondary repository:

root@solaris11:~# pkgrecv -s http://pkg.oracle.com/solaris/release -d /repo_pool/training_repo/publisher/training wireshark
Processing packages for publisher solaris ...
Retrieving and evaluating 1 package(s)...
PROCESS                                     ITEMS    GET (MB)   SEND (MB)
Completed                                    1/1     2.1/2.1     6.0/6.0

root@solaris11:~# pkgrecv -s http://pkg.oracle.com/solaris/release -d /repo_pool/training_repo/publisher/training wireshark-common
Processing packages for publisher solaris ...
Retrieving and evaluating 1 package(s)...
PROCESS                                 ITEMS  GET (MB)   SEND (MB)
Completed                               1/1    33.5/33.5  125.5/125.5

We can confirm our finished task by executing the following command:

root@solaris11:~# pkgrepo info -s /repo_pool/training_repo
PUBLISHER  PACKAGES  STATUS           UPDATED
training   2         online           2013-10-20T22:28:27.023984Z

Using another approach, we are able to obtain the same results in a detailed report from the Apache web server by executing the following commands:

root@solaris11:~# svcadm refresh pkg/server:training
root@solaris11:~# svcadm restart pkg/server:training

We can now open a web browser and go to the URL, http://localhost:8888:

Fantastic! Wireshark packages are now available from the Apache web server and can be downloaded and installed anytime.

An overview of the recipe

Insertion of a package into a local repository is a result of the previous recipe. This kind of operation is performed when a technical team needs to share a new package among its members. The key command is pkgrecv, which does most of the task for us.

主站蜘蛛池模板: 石家庄市| 张家港市| 大田县| 安乡县| 阿拉善盟| 潞西市| 西乌珠穆沁旗| 泰顺县| 开远市| 平湖市| 东源县| 米脂县| 五家渠市| 德安县| 邹城市| 馆陶县| 宁波市| 永川市| 博客| 涟水县| 凤凰县| 遂宁市| 峨山| 萝北县| 乐业县| 天门市| 鱼台县| 霍城县| 大港区| 丰宁| 西乡县| 伽师县| 锦屏县| 长垣县| 建昌县| 广宗县| 独山县| 漳浦县| 桦甸市| 大邑县| 余江县|