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

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.

主站蜘蛛池模板: 毕节市| 南召县| 安图县| 海宁市| 和平县| 蒲江县| 许昌县| 吉安县| 浑源县| 临汾市| 寿光市| 太仆寺旗| 永和县| 会宁县| 忻城县| 三明市| 英超| 卢氏县| 岑溪市| 前郭尔| 西昌市| 古交市| 诏安县| 万盛区| 玛沁县| 永胜县| 忻州市| 汤原县| 丹巴县| 元氏县| 康平县| 房产| 涞源县| 儋州市| 崇义县| 杨浦区| 仙游县| 太和县| 交城县| 乌什县| 冀州市|