Installing without direct Internet access

If I have a Solaris host without a direct Internet access, how can I install OpenCSW packages on it. Do I have to manually copy all the .pkg.gz files, gunzip them by hand and run pkgadd on them one by one in the right order? Or is there a better way?

asked: 2012-03-27 by: automaciej


automaciej answers:

There are two better, general ways. One is to [create a mirror of the OpenCSW catalog](http://www.opencsw.org/community/questions/94/setting-up-opencsw-catalog-mirror) (e.g. using rsync), transfer it to the internal network, and serve it over HTTP (e.g. with Apache or lighttpd). You can then configure pkgutil on the restricted machines to use your internal package mirror. The second option is to build a single package stream file containing the package(s) you want to install, with all the dependencies. You do need one machine with Internet access, and a way to transfer files from it to the machines with restricted access. Let's assume you have a working Solaris host that has Internet access ? this is not your target machine, it's an intermediate host. You bootstrap OpenCSW on it, for completeness shown below: pkgadd -d http://get.opencsw.org/now PATH=/opt/csw/bin:$PATH export PATH pkgutil -U -u pkgutil Now that you have a functional pkgutil, you can use it to build your package stream with dependencies. You can then use the following command (split into multiple lines for readability): pkgutil \ --stream \ --target=sparc:5.10 \ --output imagemagick-with-dependencies.pkg \ --yes \ --download \ coreutils vim ggrep gsed You'll see how pkgutil downloads many different packages and repacks them into a single package stream. You can then transfer it to your target machines and install packages from it. You need to install the packages in the right order; pkgutil will print that order out when it finishes creating the package stream.

automaciej answers:

There are two better, general ways. One is to create a mirror of the OpenCSW catalog (e.g. using rsync), transfer it to the internal network, and serve it over HTTP (e.g. with Apache or lighttpd). You can then configure pkgutil on the restricted machines to use your internal package mirror.

The second option is to build a single package stream file containing the package(s) you want to install, with all the dependencies. You do need one machine with Internet access, and a way to transfer files from it to the machines with restricted access.

Let's assume you have a working Solaris host that has Internet access - this is not your target machine, it's an intermediate host. You bootstrap OpenCSW on it, for completeness shown below:

pkgadd -d http://get.opencsw.org/now
PATH=/opt/csw/bin:$PATH
export PATH
pkgutil -U -u pkgutil

Now that you have a functional pkgutil, you can use it to build your package stream with dependencies. You can then use the following command (split into multiple lines for readability), as a regular user:

pkgutil \
  --stream \
  --target=sparc:5.10 \
  --output imagemagick-and-others.pkg \
  --yes \
  --download \
  imagemagick coreutils vim ggrep gsed

You'll see how pkgutil downloads many different packages and repacks them into a single package stream. You can then transfer it to your target machines and install packages from it. You need to install the packages in the right order; pkgutil will print that order out when it finishes creating the package stream.

The resulting package stream will be placed in the ~/.pkgutil/packages directory.