Friday, March 12, 2010

How to install a package on a different/alternate location than default?

I got this requirement wherein my /usr/local directory was coming from a read-only NFS mount (which infact is shared among many other similar types of servers) and hence I wanted to install this specific package on an alternate location. Here is the file which basically can be altered to change the location:

# cat /var/sadm/install/admin/default
#
# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "@(#)default 1.7 04/12/21 SMI"
#
mail=
instance=unique
partial=ask
runlevel=ask
idepend=ask
rdepend=ask
space=ask
setuid=ask
conflict=ask
action=ask
networktimeout=60
networkretries=3
authentication=quit
keystore=/var/sadm/security
proxy=
basedir=/usr/local2
# basedir=default


After above change, If I try to install any package, it will be installed in /usr/local2 directory as shown below:


# pkgadd -d ./top-3.6.1-sol10-sparc-local

The following packages are available:
1 SMCtop top
(sparc) 3.6.1

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

Processing package instance from

top(sparc) 3.6.1
LeFebvre et al

The selected base directory must exist before
installation is attempted.

Do you want this directory created now [y,n,?,q] y
Using as the package base directory.
## Processing package information.
## Processing system information.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.

Installing top as

## Installing part 1 of 1.
/usr/local2/bin/sparcv7/top
/usr/local2/bin/sparcv9/top
/usr/local2/bin/top
/usr/local2/doc/top/Changes
/usr/local2/doc/top/FAQ
/usr/local2/doc/top/INSTALL
/usr/local2/doc/top/LICENSE
/usr/local2/doc/top/README
/usr/local2/doc/top/Y2K
/usr/local2/man/man1/top.1
[ verifying class ]

Installation of was successful.


Note: Please know what you are doing! If not sure, please do NOT try this at least on any production server!!!

No comments: