Sysadmin > PkgSrc > SoftwarePackagesforSolaris

Software Packages for Solaris

There are several famous free software archives for Solaris:

pkgsrc

pkgsrc is my favorite package manager for Solaris 10, because it is very flexible, well maintained and highly customable. And you can use the same package manager on most other operating systems.

Download

Download the lastest tar from ftp://ftp.netbsd.org/pub/pkgsrc/. For Solaris 10 it is a good idea to choose the lastest stable quartal version over the current — i.e. 2007Q3, 2007Q4 ...

cd /usr
wget ftp://ftp.netbsd.org/pub/pkgsrc/pkgsrc-2008Q2/pkgsrc-2008Q2.tar.gz
gtar xfz pkgsrc-2008Q2.tar.gz
cd pkgsrc/bootstrap

Read the README.Solaris and choose between gcc and SunStudio and between 32 Bit and 64 Bit. gcc 32 Bit is suitable in most cases. I had trouble with OpenSSL and OpenLDAP and switched to SunStudio cc 32 Bit.

Choose gcc or SunStudioPro

  • Default is gcc 32 Bit.

  • For SunStudioPro 32/64 Bit you have to set some variables:
    • csh
setenv CC /opt/SUNWspro/bin/cc
setenv SUNWSPROBASE /opt/SUNWspro
    • bash:*
CC=/opt/SUNWspro/bin/cc
SUNWSPROBASE=/opt/SUNWspro
export CC SUNWSPROBASE

bootstrap

for both gcc and cc:

./bootstrap
[... lot of output ...]

a more sophisticat version
./bootstrap --compiler gcc --pkgdbdir /opt/pkg/db/pkg --prefix /opt/pkg --sysconfdir /opt/pkg/etc --workdir=/tmp/work --varbase /var/pkg
[... lot of output ...]

Path to library

If you get an error about a library not being found, remember to use crle -u -l libpath to add it to the link path. With crle you get the current PATH.

Links:

install a package

Now you can choose a package by changing into that directory:

rehash
cd /usr/pkgsrc/editor/vim
bmake install

hints

include ccs in your PATH.

set your PATH to /usr/sfw/bin:/usr/ccs/bin:/usr/bin:/usr/sbin befor you bootstrap pkgsrc, so that the libtool find /usr/ccs/bin/ar

if you miss that you get problem with libiconv

gcc -shared -Wl,-h -Wl,libcharset.so.1 -o .libs/libcharset.so.1.0.0
.libs/localcharset.o .libs/relocatable.o
-L/opt/pkgsrc/converters/libiconv/work/.buildlink/lib -lc
-Wl,-R/usr/pkg/lib
(cd .libs && rm -f libcharset.so.1 && ln -s libcharset.so.1.0.0 libcharset.so.1)
(cd .libs && rm -f libcharset.so && ln -s libcharset.so.1.0.0 libcharset.so)
false cru .libs/libcharset.a  localcharset.o relocatable.o

put pkgsrc in a extra filesystem

If you use zones it is a good idea to put /opt/pkg in a extra ZFS-filesystem. So you can decide later on if like to import the /opt/pkg from the global zone or to manage the packages in the zone itself. Or you can make ZFS-snapshots before you make an upgrade.

tar cvfp pkg.tar pkg
mv pkg pkg.old
zfs create -o mountpoint=/opt/pkg rpool/ROOT/s10x_u6wos_07b/pkg
zfs list
tar cvfp pkg.tar pkg

example Solaris mk.conf

update your packages

  • pkg_chk
  • pkg_rolling-replace -suvX bmake,bootstrap-mk-files,pax,pkg_install
  • pkg_rolling-replace -rsuvX bmake,bootstrap-mk-files,pax,pkg_install

Links:

ProblemWithGgrep

update bmake and bootstrap-mk-files

... that are not upgrade-able with the methods above

Whenever the bmake and bootstrap-mk-files packages need updating, the automated process fails because both of those packages are needed to do the update ==> chicken-and-egg problem.

cd pkgtools/bootstrap-mk-files
bmake USE_DESTDIR=yes package
pkg_add -uu /usr/pkgsrc/packages/All/bootstrap-mk-files...tgz
cd ../../devel/bmake
bmake USE_DESTDIR=yes package
pkg_add -uu /usr/pkgsrc/packages/All/bmake...tgz
... 

same for install-sh, pdksh, pkg_install

Maybe you have to force the installation for pkg_install with pkg_add -f -uu

Check the database afterwards with pkg_admin check

Badly formated man pages

Man pages in pkgsrc are sometimes badly formated under Solaris. Have a look at FormattedManPages

get rid of old sfw libraries

If you have used the GCC from /usr/sfw so far, the packages built in advance of GCC contain references to /usr/sfw/lib/libgcc_s.so. Among these packages are libiconv and gettext. As a consequence, every subsequent package you compile with the pkgsrc GCC that uses these libraries may contain references to this libgcc and the one from the pgksrc GCC. This is ugly at best, but may cause real trouble at worst. To remove all traces of the wrong libgcc, reinstall (i.e. bmake replace) the packages converter/libiconv, devel/gettext-lib and devel/gettext-tools.

ldd /opt/pkg/bin/* | grep sfw

You can also check your packages with
pkg_admin check
pkg_admin rebuild

packages