Wise people learn when they can; fools learn when they must - Arthur Wellesley

Thursday, 18 September 2014

Package -- Solaris

                                                
                                                PACKAGE

Well, we went thru patch… now what’s this Package?

It is collection of programs or files that provide certain functionality,
Along with method of managing the installation & removal of it.

ADD PACKAGES
REMOVE PACKAGES
INFO ABOUT PACKAGES

OK… First have some commands…
Remember the word “pkg”
Got it… Good… now u can add
Info                    -l / -x
Add                     -d
Rm                      -f (be alert when u have to use –f with pkgrm…)
Chk                     -v  / -lp



After the word pkg with some flags

Let’s start with ADD Packages

#pkgadd –d <pkg name>
Well… again –d …

But don’t worry this –d has nothing to do with patchadd –d

This –d mean that install the package from here, like I am at /cdrom then I do not need to copy that pkg to some dir … just instruct 
–d … that install this pkg from here

Well… There are 3 methods to install…

n  DIRECT INSTALL               install it from here
                               #pkgadd –d <pkg name>

n  SPOOLING                    spool the pkgs in /var/spool/pkg dir                                 Yes I will but how? Patience …

n  TRANSFORM                  well I come to know that I have 20 pkgs                          to Install in my servers, now what I suppose                          to do? Just transform it like OPTIMUS PRIME                           … again How ? Patience …

OK… Let’s start with SPOOLING…

Actually what is it ? I have pkg cdrom and I want to copy all pkgs to system
So that every time I do not have to dependent on cdrom…

Well… Just Spool all that to

/var/spool/pkg

I have Solaris s/w companion cd, and I want to spool them into /var/spool/pkg

Well… actually I don’t do this b’coz useless time wastage… 
I just copied some pkgs in /mypkgs  dir

root@sol-test-2:>/# pkgadd -d /mypkgs -s /var/spool/pkg
The following packages are available:
  1  SFWsudo       Sudo - superuser do
                   (i386) 1.6.9.16,REV=2008.08.26.00.08
  ============o/p removed ===============
 10  SFWunwin      UnWindows - Tools for low vision users
                   (i386) 1.1.3,REV=2008.08.23.02.00

... 9 more menu choices to follow;
<RETURN> for more choices, <CTRL-D> to stop display:^D

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: all

Transferring <SFWsudo> package instance
============o/p removed=================
Transferring <SFWxmms> package instance
Transferring <SFWyasr> package instance

Well… all 19 pkgs are spooled here…

NOTE -- [ Here pkgadd is telling that /mypkgs is source dir of packages and –s  told that well… hey pkgadd u got pkgs now spool all these to following dir.]

[instead of /mypkgs we can use any source… wherever our packages are]
We can do this via simply

root@sol-test-2:> cp -r <pkg names > /var/spool/pkg/

Now … what to do after spooling?
Simple… just type pkgadd and enter

root@sol-test-2:>/# pkgadd
see just only cmd … it is spooling all pkgs from /var/spool/pkg
The following packages are available:
  1  SFWsudo       Sudo - superuser do
                   (i386) 1.6.9.16,REV=2008.08.26.00.08

                  ======   o/p  removed  =====

 10  SFWunwin      UnWindows - Tools for low vision users
                   (i386) 1.1.3,REV=2008.08.23.02.00

... 9 more menu choices to follow;
<RETURN> for more choices, <CTRL-D> to stop display:  here I enter

 11  SFWuudv       uudeview - Encoder/decoder for encoded files
                   (i386) 0.5.20,REV=2008.08.23.02.00
    =======   o/p removed ========
 19  SFWyasr       Yasr - light-weight portable screen reader
                   (i386) 0.6.9,REV=2008.08.23.02.00

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: SFWtop

[Here instead of installing all packages I selected only one, though if I just write all or enter then it will install all pkgs present in its spool dir.]

Processing package instance <SFWtop> from </var/spool/pkg>
 top - display information about processes(i386) 3.5.1,REV=2008.08.26.00.08
        Top users/processes display for Unix

        ==== o/p removed ======
          

        ==== o/p removed ======

Do you want to continue with the installation of <SFWtop> [y,n,?] y

Installing top - display information about processes as <SFWtop>

Installation of <SFWtop> was successful.


well… if we know the pkg name then we can directly hit the pkgadd with pkg name ( but it should be present in /var/spool/pkg)


root@sol-test-2:>/# pkgadd SFWxcpus

Processing package instance <SFWxcpus> from </var/spool/pkg>
========o/p removed=======
Do you want to continue with the installation of <SFWxcpus> [y,n,?] y

========o/p removed=======

Installation of <SFWxcpus> was successful.

Well…

Let’s see TRANSFORM

root@sol-test-2:>/# pkgtrans -s /mypkgs /tmp/imp-packages.pkg
          ===  o/p  removed  ====
... 9 more menu choices to follow;
<RETURN> for more choices, <CTRL-D> to stop display:^D

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: all
Transferring <SFWsudo> package instance
===  o/p  removed  ====

===  o/p  removed  ====

Transferring <SFWxdelta> package instance


root@sol-test-2:>/# ls -l /tmp/imp-packages.pkg
-rw-r--r--   1 root     root     67862528 Sep 16 16:58 /tmp/imp-packages.pkg

Well we had transformed 19 pkgs into one … now it can be used at once…
Or it will be very helpful in sharing

root@sol-test-2:>/# pkgadd -d /tmp/imp-packages.pkg

well it will install as usual… but u know the most imp thing ?
u have to do 19 times y + enter
every time it will ask
Do you want to continue with the installation of <PKG Name> [y,n,?]

( I tried to find a yes for all at a time… but my search continues…)

Anyways…

What if I don’t want to install pkgs in default dir ?

-R is the solution…

root@sol-test-2:>/mypkgs# pkgadd -R /opt SFWsudo
Processing package instance <SFWsudo> from </var/spool/pkg>
                   =====o/p removed=====
The selected base directory </opt/opt> must exist before installation
is attempted.

Do you want this directory created now [y,n,?,q] y
                =====o/p removed=====
Do you want to continue with the installation of <SFWsudo> [y,n,?] y
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 <SFWsudo> [y,n,?] y
Installing Sudo - superuser do as <SFWsudo>
                =====o/p removed=====
Installation of <SFWsudo> was successful.


Let’s See what happened to /opt

cd /opt/var/sadm

root@sol-test-2:>/opt/var/sadm/pkg# ls -l
total 2
drwxr-xr-x   4 root     root         512 Sep 16 17:10 SFWsudo

/opt/var/sadm/pkg

NOW I WANT TO REMOVE THE PKG’s
Just
Pkgrm
-f

Some INFO about pkgs…

Pkginfo
-I / -p                   completely or partially installed
-l                           detailed listing
-x                          name / version
Pkgchk –v

Now… 10 recommended patches…

#chmod –R 777 10_x86_Recommended/

#cd  10_x86_Recommended/

#./installpatchset –S10Patchset

OK… Now I want to know about the location of my all installed pkgs…
Here u go …

root@sol-test-1:>/# ls -l /var/sadm/install/contents

Good… Now where the logs are made for pkgs ?

root@sol-test-1:>/# ls -l /var/sadm/install_data/
total 2
lrwxrwxrwx   1 root     root          26 Apr 25 03:27 install_log -> ../system/logs/install_log

The Tutorial is over here….

Well…  Now some examples of pkgadd


root@sol-test-1:>/# pkgadd -d /hgfs/vM_SHARE/x86/nmap-3.93-sol10-x86-local

The following packages are available:
  1  SMCnmap     nmap
                 (x86) 3.93

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: all

Processing package instance <SMCnmap> from </hgfs/vM_SHARE/x86/nmap-3.93-sol10-x86-local>

nmap(x86) 3.93
Fyodor

The selected base directory </usr/local> must exist before
installation is attempted.

Do you want this directory created now [y,n,?,q] y

==== o/p removed ======

===========  o/p removed ================

Installation of <SMCnmap> was successful.


root@sol-test-1:>/# pkginfo -x nmap
ERROR: information for "nmap" was not found

root@sol-test-1:>/# pkginfo -l nmap
ERROR: information for "nmap" was not found

See… it is not recognizing simple “nmap” it wants the full pkg name… so we need to find the exact name

root@sol-test-1:>/# pkginfo |grep -i nmap
application SMCnmap                          nmap


root@sol-test-1:>/# pkginfo -l SMCnmap   [via –l we get all info about pkg]
   PKGINST:  SMCnmap
      NAME:  nmap
  CATEGORY:  application
      ARCH:  x86
   VERSION:  3.93
   BASEDIR:  /usr/local
    VENDOR:  Fyodor
    PSTAMP:  Steve Christensen
  INSTDATE:  Sep 17 2014 10:50
     EMAIL:  steve@smc.vnet.net
    STATUS:  completely installed
     FILES:       57 installed pathnames
                   9 directories
                   3 executables
                7261 blocks used (approx)

root@sol-test-1:>/# pkginfo -x SMCnmap [via –x just name/arch/revision]
SMCnmap  nmap
         (x86) 3.93
Let’s check that the status of this pkg

root@sol-test-1:>/# pkgchk -p SMCnmap
WARNING: no information associated with pathname <SMCnmap>

Well it means that there is no info about partial install of this pkg

root@sol-test-1:>/# pkgchk -l SMCnmap
Pathname: /usr/local/bin
Type: directory
Expected mode: 0755
Expected owner: bin
Expected group: bin
Referenced by the following packages:
        SMCnmap
Current status: installed

Pathname: /usr/local/bin/nmap
Type: regular file
Expected mode: 0755
Expected owner: bin
Expected group: bin
Expected file size (bytes): 763136
Expected sum(1) of contents: 58739
Expected last modification: Sep 20 15:51:56 2005
Referenced by the following packages:
        SMCnmap
Current status: installed
========o/p  removed ===========

We can see the install status via –l

root@sol-test-1:>/# pkgchk -v SMCnmap
/usr/local/bin
/usr/local/bin/nmap
/usr/local/bin/nmapfe
/usr/local/bin/xnmap
/usr/local/doc
/usr/local/doc/nmap
==============o/p  removed ==========
/usr/local/share/nmap/nmap-services
/usr/local/share/nmap/nmap.dtd
/usr/local/share/nmap/nmap.xsl

So what –v is doing ?
Well… if I want to know about the installation path of our pkg then we can easily find that from here…
Like when I have to run nmap… then we need to find out the dir where it is installed… and

#/usr/local/bin/nmap

Fine… reached tooooo faaar…..
Now the most interesting part is coming ahead….


Have u ever heard
DEPENDENCY HELL !!!
If yes then u know what is about to go… and If not then

WELCOME TO THE

DEPENDENCY HELL

U know when u fire nmap  what will happen ?

(this is not only the case of nmap…. U can feel the heat after installing any 3rd party software)

root@sol-test-1:>/# /usr/local/bin/nmap
ld.so.1: nmap: fatal: libssl.so.0.9.7: open failed: No such file or directory
Killed

Now it wants libssl.so.0.9.7

And I am sure that after this libssl it will want some more and then some else then some else …….

That is called dependency hell….

Solaris 10 got distinction in this field….
Solaris 11 comes with the solution IPS…
Linux has understand that too early and came with YUM REPOSITORY…(its awesome)

****well… if u really want to feel the heat and want to sweat from each and every side … just try to install “cacti” on your Solaris system…****




No comments:

Post a Comment