Preparing the system for pkgsrc
involves several steps. A compiler has to be installed to bootstrap pkgsrc
, and a directory structure has to be prepared in which the files downloaded and generated will be stored. Moreover, it is a good idea to create a special user which will be used to build software.
h3. Compiler environment
The Solaris core installation does not come with a compiler, but a version of GCC 3 can be found on the DVD (3.4.3 in snv_109). pkgsrc
will also work with the proprietary Sun compiler suite, but that is beyond the scope here.
In addition to the compiler itself several other programs are needed to get pkgsrc
off the ground.
- Binutils (SUNWbinutils)
- GNU Make (SUNWgmake)
- System header files (SUNWhea)
- System libraries (SUNWlibmr, SUNWlibm)
- XPG4 compatible system utilities (SUNWxcu4)
The complete command line for installing all this is
# gkp.pl -d /mnt/Solaris_11/Product SUNWarc SUNWgccruntime SUNWbinutils SUNWgcc \
SUNWgmake SUNWhea SUNWlibmr SUNWlibm SUNWxcu4 SUNWsprot
The compiler is installed into /usr/sfw/bin
by default, which is not in the system search path.
h3. Directories and users
By default pkgsrc
uses three directories on the system, in which all files are installed.
/usr/pkg
for installed packages
/usr/pkgsrc
for the source tree
/var/db/pkg
for the package database
There is no good reason to change these defaults here. /usr/pkg
and /usr/pkgsrc
will get their own ZFS filesystems, while /var/db/pkg
will just be a directory.
# zfs create -o mountpoint=/usr/pkg rpool/pkg
# zfs create -o mountpoint=/usr/pkgsrc rpool/pkgsrc
These two commands create two new filesystems on the root pool and set the mount points to the correct directories. The filesystems are automatically mounted and are immediately ready to be used.
Having a special user for building packages instead of using root is a good idea in general. It protects the system from eventual errors in the build system, which might cause files to be written outside the build root (even if those files are completely harmless and not malicious they are a nuisance nonetheless). The build user should also have no special privileges on the system.
# useradd -d /export/home/builder -m -s /usr/bin/bash -c "pkgsrc build user" builder