Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Oracle Solaris 11 Advanced Administration Cookbook.docx
Скачиваний:
3
Добавлен:
01.07.2025
Размер:
3 Мб
Скачать
☆

Questions

You can contact us at questions@packtpub.com if you are having a problem with any aspect of the book, and we will do our best to address it.

1

Ips and Boot

Environments

In this chapter, we will cover the following topics:

f Determining the current package publisher

f Listing and collecting the information and dependencies of a package

f Installing a package, verifying its content, and fixing the package corruption

f Managing the IPS history and freezing and uninstalling packages

f Discovering the IPS Package Manager interface

f Creating, activating, and destroying a boot environment

f Listing and renaming a boot environment

f Configuring an IPS local repository

f Configuring a secondary IPS local repository

f Publishing packages into a repository

f Adding big applications into a repository

f Creating your own package and publishing it

f Managing an IPS publisher on Solaris 11

f Pinning publishers

f Changing the URI and enabling and disabling a publisher

f Creating a mirror repository

f Removing a repository and changing the search order

f Listing and creating a boot environment

f Mounting, unmounting, installing, and uninstalling a package in an inactive boot environment

f Activating a boot environment

f Creating a boot environment from an existing one

IPS and Boot Environments

Introduction

As you already know, Oracle Solaris 11 has undergone many changes and now provides a framework to manage packages named Image Packaging System (IPS). This new framework makes an administrator's life easier when he or she needs to add, remove, collect, and administer any software packages. By default, Oracle offers a repository (a large group of packages) on the Web at http://pkg.oracle.com/solaris/release/, and this is

the default Oracle Solaris 11 repository. Using this repository, we will be able to install any

package from the Internet, and as we are going to learn soon, it's feasible to create a local repository (like the default one) on our own Oracle Solaris 11 installation to improve the security and performance of our environment. Moreover, we can configure Oracle Solaris 11 to hold more than one repository as the source of the packages.

Going beyond IPS, Oracle Solaris 11 uses boot environments (BEs) to assist us in making an Oracle Solaris 11 upgrade without any risk to current data, because the update process creates a new BE before proceeding to the package update process. This new BE will be

shown in the next reboot on the GRUB menu, and from there, we will be able to choose either the new BE (updated Solaris) or the old one. BEs will come in handy in other areas when handling the Oracle Solaris 11 administration.

Determining the current package publisher

When administering IPS on a Solaris 11 system, the first thing we need to do is find out the current package publisher because initially, it will be the source that our system will install or update a package from.

Getting ready

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

How to do it…

To list the existing publishers, we execute the following:

root@solaris11:/# pkg publisher

PUBLISHER TYPE STATUS P LOCATION

solaris origin online F http://pkg.oracle.com/solaris/release/

According to the output, the Oracle package URI and repository (http://pkg.oracle.com/ solaris/release/) is the source of the packages and updates (named as origin), and it isn't proxied (when P equals F, the proxy is set to false).

Chapter 1

To collect additional information about the publisher of the packages, we type the following:

root@solaris11:~# pkg publisher solaris

Publisher: solaris Alias:

Origin URI: http://pkg.oracle.com/solaris/release/ SSL Key: None

SSL Cert: None

Client UUID: f7cdfbf2-0292-11e2-831b-80144f013e20 Catalog Updated: September 12, 2013 04:22:26 PM Enabled: Yes

An overview of the recipe

Using the main command, pkg, with the publisher keyword, we've found a list of publishers and that the solaris publisher is online, and a URI is enabled that points to the repository location, which is http://pkg.oracle.com/solaris/release/. Furthermore, there is no SSL digital certificate associated with the solaris publisher.

Listing and collecting the information and dependencies of a package

To demonstrate how simple it is to administer packages, let's explore a useful example where we install a package on Oracle Solaris 11.

How to do it…

First, we need to know which package we want to install. However, before installing any package, we need to confirm whether this package is already installed on the system by running the following command:

root@solaris11:~# pkg list nmap

pkg list: no packages matching 'nmap' installed

As we can see, the nmap package (scanning tool) isn't installed on Oracle Solaris 11; we can verify that this tool is available from the official source repository (solaris, according to the previous publisher list). Furthermore, before accomplishing this step, it's suggested that we rebuild repository indexes (mainly if you don't remember when a package was inserted or removed the last time) to speed up the lookup process later:

root@solaris11:~# pkg rebuild-index

PHASE ITEMS

Building new search index 847/847

IPS and Boot Environments

It's time to search for the nmap package. We do this with the following command:

root@solaris11:~# pkg search nmap

INDEX ACTION VALUE

PACKAGE

pkg.description set Nmap is useful for inventorying the network, managing service upgrade schedules, and monitoring host or service uptime. pkg:/diagnostic/nmap@5.51-0.175.1.0.0.24.0

basename file usr/bin/nmap

map@5.51-0.175.1.0.0.24.0

pkg.fmri set solaris/diagnostic/nmap

map@5.51-0.175.1.0.0.24.0

basename dir usr/share/nmap

pkg:/diagnostic/n

pkg:/diagnostic/n

pkg:/diagnostic/n

map@5.51-0.175.1.0.0.24.0

We can confirm that nmap is available and isn't installed on the system, but a bit more information about the package won't hurt us. An easy way to know whether the nmap package is installed or not is by executing the following command:

root@solaris11-1:~# pkg list -af nmap

NAME (PUBLISHER) VERSION IFO

diagnostic/nmap 5.51-0.175.1.0.0.24.0 ---

If the last column (IFO) doesn't have an i flag, then we can verify that the package isn't installed. We can also obtain complementary information about nmap by typing the following command:

root@solaris11:~# pkg info -r nmap

Name: diagnostic/nmap

Summary: Network exploration tool and security / port scanner.

Description: Nmap is useful for inventorying the network, managing service upgrade schedules, and monitoring host or service uptime.

Category: System/Administration and Configuration State: Not installed

Publisher: solaris Version: 5.51

Build Release: 5.11

Branch: 0.175.1.0.0.24.0

Chapter 1

Packaging Date: September 4, 2012 05:17:49 PM

Size: 12.28 MB

FMRI: pkg://solaris/diagnostic/nmap@5.51,5.11-0.175.1.0.0.24.0:20120904T1 71749Z

This last command is important because we've collected valuable attributes about the nmap package, such as its state (Not installed) and size (12.28 MB). The -r option is necessary because it references a package in the repository from registered publishers. We can show Nmap's license agreement in the same way:

root@solaris11:~# pkg info -r --license nmap

Oracle elects to use only the GNU Lesser General Public License version

2.1 (LGPL)/GNU General Public License version 2 (GPL) for any software where a choice of LGPL/GPL license versions are made available with the language indicating that LGPLv2.1/GPLv2 or any later version may be used, or where a choice of which version of the LGPL/GPL is applied is unspecified.

…..........

Sometimes, it's advisable to know which packages are required to install a specific package (such as nmap) before you are able to try it. We can verify this by executing the following command:

root@solaris11:~# pkg contents -r -o fmri,type -t depend nmap

FMRI TYPE

pkg:/library/pcre@8.21-0.175.1.0.0.23.0 require

pkg:/library/python-2/pygobject-26@2.21.1-0.175.1.0.0.11.0 require pkg:/library/python-2/pygtk2-26@2.17.0-0.175.1.0.0.19.0 require pkg:/library/security/openssl@1.0.0.10-0.175.1.0.0.23.0 require

pkg:/runtime/lua@5.1.4-0.175.1.0.0.23.0 require

pkg:/runtime/python-26@2.6.8-0.175.1.0.0.23.0 require pkg:/system/library/gcc-3-runtime@3.4.3-0.175.1.0.0.23.0 require

pkg:/system/library/libpcap@1.1.1-0.175.1.0.0.23.0 require

pkg:/system/library/math@0.5.11-0.175.1.0.0.19.0 require

pkg:/system/library@0.5.11-0.175.1.0.0.23.0 require

IPS and Boot Environments

We can also reach the same result by executing the following command:

root@solaris11:~# pkg contents -r -o action.raw -t depend nmap

ACTION.RAW

depend fmri=pkg:/library/python-2/pygobject-26@2.21.1-0.175.1.0.0.11.0 type=require

depend fmri=pkg:/system/library/gcc-3-runtime@3.4.3-0.175.1.0.0.23.0 type=require

depend fmri=pkg:/library/security/openssl@1.0.0.10-0.175.1.0.0.23.0 type=require

depend fmri=pkg:/runtime/lua@5.1.4-0.175.1.0.0.23.0 type=require

depend fmri=pkg:/system/library/math@0.5.11-0.175.1.0.0.19.0 type=require depend fmri=pkg:/system/library@0.5.11-0.175.1.0.0.23.0 type=require depend fmri=pkg:/runtime/python-26@2.6.8-0.175.1.0.0.23.0 type=require depend fmri=pkg:/library/pcre@8.21-0.175.1.0.0.23.0 type=require

depend fmri=pkg:/system/library/libpcap@1.1.1-0.175.1.0.0.23.0 type=require

depend fmri=pkg:/library/python-2/pygtk2-26@2.17.0-0.175.1.0.0.19.0 type=require

The –t option specifies action.raw, which is used to limit the search to a specific attribute, such as depend. The –r option matches packages based on the newest available version and gets information about noninstalled packages, and the -o option limits the columns to be shown in the output.

We have a list of required packages to install a new package such as nmap, and all the packages are shown as require; however, this command would have shown as optional if we were managing another package.

An overview of the recipe

The previous commands have verified that if a specific package is already installed (nmap), it reindexes the package catalog (to speed up the search) and collects details about the package. Furthermore, we've listed the decencies of the nmap package. We will notice that the number of packages that were indexed (847) is very high, and that's the main reason this operation takes some time.

Chapter 1

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]