Note: Since this installation was done, pkgsrc bootstrap code has been moved from othersrc/bootstrap-pkgsrc to pkgsrc/bootstrap in the NetBSD CVS tree. Thus it is no longer necessary to check out othersrc/bootstrap-pkgsrc as a separate step.
Even in its present rapidly-evolving state, NetBSD's pkgsrc system is an important toolset for dealing with configuration management on a large network of servers. Its portability provides a consistent way to manage software deployment and dependencies over a mixture of operating systems.
Here is a detailed record of how an x86 Solaris 9 server was bootstrapped with pkgsrc checked out 2004-03-10. The goal was to create a server on which all software other than the OS is tracked with pkgsrc, including free software, software from outside vendors, and programs developed in house. During bootstrapping, we used SunFreeware's gcc3 compiler along with an additional BSD host to do initial cvs and sup checkouts.
The operating system installed was Solaris 9 Operating Environment 12/03 x86 Platform Edition loaded from software CDs 1 and 2 (language CD skipped). Our usual policy, is to install cluster SUNWCprog then strip the following packages:
NSCPcom SUNW1251f SUNW5xmft SUNWarrf SUNWciu8 SUNWcxmft SUNWdthe SUNWdthev SUNWdtbas SUNWdtdmn SUNWdtdst SUNWdticn SUNWdtim SUNWdtscm SUNWdtwm SUNWsasnm SUNWsadmi SUNWsacom SUNWmibii
After installing the OS, we have:
# uname -X System = SunOS Node = testhost.domain.com Release = 5.9 KernelID = Generic_112234-10 Machine = i86pc BusType =Serial = Users = OEM# = 0 Origin# = 1 NumCPU = 2 # psrinfo -v Status of virtual processor 0 as of: 03/20/2004 13:32:04 on-line since 03/15/2004 16:01:29. The i386 processor operates at 2392 MHz, and has an i387 compatible floating point processor. Status of virtual processor 1 as of: 03/20/2004 13:32:04 on-line since 03/15/2004 16:01:31. The i386 processor operates at 2392 MHz, and has an i387 compatible floating point processor.
As non-root, set login shell to /bin/ksh and have .profile
ENV=$HOME/.kshrc stty erase ^h PATH=/usr/pkg/bin:/usr/pkg/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/ccs/bin:/usr/ccs/liband .kshrc
set -o vi PS1="\$PWD>"When running as root, will invoke ksh and dot these files.
We need passive ftp to get through NAT. And it's (finally) in Solaris 9. Solaris 9 also has gunzip and ssh. We enabled sshd.
$ ftp -p ftp.sunfreeware.com
Connected to sunfreeware.com.
220 ftp.sunfreeware.com FTP server ready.
Name (ftp.sunfreeware.com:me): ftp
...
ftp> cd pub/freeware/intel/9
250 CWD command successful.
ftp> get gcc_small-3.3.2-sol9-intel-local.gz
local: gcc_small-3.3.2-sol9-intel-local.gz remote: gcc_small-3.3.2-sol9-intel-local.gz
227 Entering Passive Mode (66,193,208,66,134,129)
150 Opening BINARY mode data connection for gcc_small-3.3.2-sol9-intel-local.gz (17336639 by
tes).
100% |*************************************************| 16930 KB 172.90 KB/s 00:00 ETA
226 Transfer complete.
$ gunzip gcc_small-3.3.2-sol9-intel-local.gz
# su
Password:
# pkgadd -d gcc_small-3.3.2-sol9-intel-local
The following packages are available:
1 SMCgcc gcc
(intel) 3.3.2
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]:
First, fetch pkgsrc bootstrap kit. On another host with working cvs:
$ unset CVS_RSH $ cvs -d :pserver:anoncvs@anoncvs.netbsd.org:/cvsroot loginBack on the target host, build the boot kit. There is a problem with nbcompat which the following patch fixes:$ cvs -d :pserver:anoncvs@anoncvs.netbsd.org:/cvsroot co othersrc/bootstrap-pkgsrc $ scp -r othersrc testhost:
$ cd ~/othersrc/bootstrap-pkgsrcInsert toward the top of othersrc/bootstrap-pkgsrc/libnbcompat/nbcompat/statfs.h:
#define HAVE_FSID_T 1And build.
$ su # CC=/usr/local/bin/gcc ./bootstrapNow /usr/pkg/bin is populated. And one package has been added:
$ ls /usr/pkg/bin bmake cpio digest ftp nbsed pax tar $ pkg_info digest-20021220 Message digest wrapper utility
Grab a snapshot of pkgsrc (I used sup on FreeBSD).
$ mkdir ~/sup $ cd ~/sup $ cat > sup.pkgsrc current release=pkgsrc host=sup.NetBSD.org hostbase=/ftp/pub base=/usr/home/me/sup/pkgsrc prefix=/usr/home/me/sup/pkgsrc backup use-rel-suffix ^D # sup -v sup.pkgsrc current... about an hour of downloading; note initial pause of a few minutes ... Then copy pkgsrc tree to the target host.
$ tar -czf pkgsrc-1.tgz pkgsrc $ scp pkgsrc-1.tgz testhost:Back on target host, install pkgsrc directories.
# cd /usr # gunzip < .../pkgsrc-1.tgz | tar -xf-First Package Builds
Create initial /etc/mk.conf. The entry for PATCH will be taken care of with the first package built.
/etc>cat mk.conf.boot PACKAGES=${_PKGSRCDIR}/packages/${OS_VERSION}/${MACHINE_ARCH} PKGSRC_MESSAGE_RECIPIENTS=me@domain.com PKG_DBDIR= /var/db/pkg LOCALBASE= /usr/pkg # automatically build and save binary packages on dependencies DEPENDS_TARGET=package # accept all licenses _ACCEPTABLE= yes # passive ftp PASSIVE_FETCH=1 PKG_DEVELOPER?= yes STRIP=/usr/ccs/bin/strip TAR=/usr/pkg/bin/tar PATCH=/usr/pkg/bin/gpatch # bootstrap setting CC= /usr/local/bin/gccNext we want to switch to pkgsrc gcc as quickly as possible. The patch command will be used early in the process, and Sun's patch is not pkgsrc-friendly, so build another one.
# cd /usr/pkgsrc/devel/patch # bmake package ... # pkg_info digest-20021220 Message digest wrapper utility patch-2.5.4nb2 Patch files using diff output # type gpatch /usr/pkg/bin/gpatchIn order to make gcc (2 and 3 - we need both versions at this site) we will need not only the explicit dependency, but tools that are also pulled in (why don't these show up with pkg_info -n?), specifically gmake and libtool-base. Checking dependencies:
$ pkg_info -n gcc3-c-3.3.3 Information for gcc3-c-3.3.3: Requires: pkg_install-info-[0-9]* $ pkg_info -n gmake Information for gmake-3.80nb2: Requires: gettext-lib>=0.11.5nb1 libiconv>=1.9.1 pkg_install-info-[0-9]* $ pkg_info -n libtool-base Information for libtool-base-1.5.2nb4: Requires: gcc3-c++>=3.3.3 gcc3-c>=3.3.3 gcc3-f77>=3.3.3 pkg_install-info-[0-9]*Don't worry about the circular dependency on gcc3 at the bottom. Build libtool-base - the install ends with error messages, but the package is installed and is usable for bootstrapping.# cd /usr/pkgsrc/devel/libtool-base # bmake install ... /usr/pkg/lib/libltdl.so: libgcc_s.so.1 => (file not found) /usr/pkg/lib/libltdl.so.4: libgcc_s.so.1 => (file not found) /usr/pkg/lib/libltdl.so.4.0: libgcc_s.so.1 => (file not found) *** The above programs/libs will not find the listed shared libraries at runtime. Please fix the package (add -Wl,-R.../lib in the right places)!We know gmake will want converters/libiconv, so build it next. Again there is a warning, but the installed package will be usable.===> Registering installation for libiconv-1.9.1nb1 /usr/pkg/bin/iconv: libgcc_s.so.1 => (file not found) /usr/pkg/lib/libcharset.so: libgcc_s.so.1 => (file not found) /usr/pkg/lib/libcharset.so.1: libgcc_s.so.1 => (file not found) /usr/pkg/lib/libcharset.so.1.0: libgcc_s.so.1 => (file not found) /usr/pkg/lib/libiconv.so: libgcc_s.so.1 => (file not found) /usr/pkg/lib/libiconv.so.4: libgcc_s.so.1 => (file not found) /usr/pkg/lib/libiconv.so.4.0: libgcc_s.so.1 => (file not found) /usr/pkg/lib/libiconv_plug.so: libgcc_s.so.1 => (file not found) *** The above programs/libs will not find the listed shared libraries at runtime. Please fix the package (add -Wl,-R.../lib in the right places)!And similarly with gettext-lib.# cd /usr/pkgsrc/devel/gettext-lib # bmake install ... ===> Registering installation for gettext-lib-0.11.5nb2 gettext-lib-0.11.5nb2 requires installed package libiconv-1.9.1nb1 /usr/pkg/lib/libintl.so: libgcc_s.so.1 => (file not found) libgcc_s.so.1 => (file not found) /usr/pkg/lib/libintl.so.4: libgcc_s.so.1 => (file not found) libgcc_s.so.1 => (file not found) /usr/pkg/lib/libintl.so.4.0: libgcc_s.so.1 => (file not found) libgcc_s.so.1 => (file not found) *** The above programs/libs will not find the listed shared libraries at runtime. Please fix the package (add -Wl,-R.../lib in the right places)!Now we can build a gmake with sufficient functionality to make a pkgsrc gcc.# cd /usr/pkgsrc/devel/gmake # bmake install ... ===> Registering installation for gmake-3.80nb2 gmake-3.80nb2 requires installed package gettext-lib-0.11.5nb2 gmake-3.80nb2 requires installed package libiconv-1.9.1nb1 gmake-3.80nb2 requires installed package pkg_install-info-4.5nb2 /usr/pkg/bin/gmake: libgcc_s.so.1 => (file not found) libgcc_s.so.1 => (file not found) *** The above programs/libs will not find the listed shared libraries at runtime. Please fix the package (add -Wl,-R.../lib in the right places)!Here's the current state of things:
$ pkg_info digest-20021220 Message digest wrapper utility patch-2.5.4nb2 Patch files using diff output libtool-base-1.5.2nb4 Generic shared library support script (the script itself) libiconv-1.9.1nb1 Character set conversion library gettext-lib-0.11.5nb2 Internationalized Message Handling Library (libintl) pkg_install-info-4.5nb2 Standalone GNU info file installation utility gmake-3.80nb2 GNU version of 'make' utility $ gmake ld.so.1: gmake: fatal: libgcc_s.so.1: open failed: No such file or directory Killed $ LD_LIBRARY_PATH=/usr/local/lib gmake Makefile:26: *** missing separator. Stop.On to gcc3:# cd /usr/pkgsrc/lang/gcc3-c # LD_LIBRARY_PATH=/usr/local/lib bmake install ... works ...Now that there is a pkgsrc gcc3, we can start to clean up. Note no setting of LD_LIBRARY_PATH on the next command.
# pwd /usr/pkgsrc/lang/gcc3-c # bmake packageDoing ldd -v shows that the libgcc_s fuss is coming from devel/gettext-lib's libintl.so. For devel/gettext-lib and converters/libiconv, pkg_delete and bmake clean and bmake install. Update binary packages for these in /usr/pkgsrc/packages/All.Build g++.
# cd /usr/pkgsrc/lang/gcc3-c++ # bmakeUpdate mk.conf.CC= /usr/pkg/gcc3/bin/gcc CPP= /usr/pkg/gcc3/bin/cpp CXX= /usr/pkg/gcc3/bin/g++Bootstrap is done - you can now go off and build lots of packages. Here's what we have at this time:MesaLib-6.0 Graphics library similar to SGI's OpenGL ORBit-0.5.15nb6 High-performance CORBA ORB with support for the C language Xft2-2.1.2nb1 Library for configuring and customizing font access Xrandr-1.0.1 X RandR extension (Library) Xrender-0.8.3nb1 Client library for the X Rendering Extension protocol atk-1.4.1 Set of interfaces for accessibility autoconf-2.59 Generates automatic source code configuration scripts autoconf213-2.13 Generates automatic source code configuration scripts (old version) automake-1.8.3 GNU Standards-compliant Makefile generator autoswc-1.2 Generates system wide cache files for GNU autoconf bison-1.875nb1 GNU yacc(1) replacement boehm-gc-6.2nb2 Garbage collection and memory leak detection for C and C++ cdpack-1.5 Utility to create multi-cd binary package collections cdrecord-2.00.3 Software for creating ISO9660 images and writing CDs/CD-RWs cfengine-2.0.8p1 Automate configuration and administration of large systems cfengine-doc-2.0.8p1 Documentation for cfengine createbuildlink-3.3 shell script to help creating buildlink[23].mk files curl-7.11.0 Client that groks URLs cvs-1.11.13 Concurrent Versions System db-2.7.7nb1 Sleepycat Software's Berkeley DB version 2 db4-4.2.52 Berkeley DB version 4 from Sleepycat Software dfdisk-1.0 Fetch distfiles from multiple locations diffutils-2.8.1 GNU diff utilities - find the differences between files digest-20021220 Message digest wrapper utility distfetch-20020930 Script to fetch only required distribution files expat-1.95.7 XML parser library written in C flex-2.5.4a Fast clone of lex(1), the lexical scanner generator fontconfig-2.2.1nb3 Library for configuring and customizing font access freetds-0.61.2 LGPL'd implementation of Sybase's db-lib/ct-lib/ODBC libs freetype2-2.1.5 Font rendering engine and library API gawk-3.1.3 GNU awk gcc-2.95.3nb5 GNU Compiler Collection, version 2 gcc3-c++-3.3.3 GNU Compiler Collection, v3 - C++ compiler gcc3-c-3.3.3 GNU Compiler Collection, v3 - C compiler gdk-pixbuf-0.22.0nb2 The GNOME image loading library gensolpkg-1.10nb1 Utility to generate a Solaris package gettext-0.11.5nb3 Tools for providing messages in different languages gettext-lib-0.11.5nb2 Internationalized Message Handling Library (libintl) gettext-m4-0.11.5 Autoconf/automake m4 files for GNU NLS library gindent-2.2.8.1nb1 GNU version of pretty-printer for C source code glib-1.2.10nb6 Some useful routines for C programming glib2-2.2.3nb1 Some useful routines for C programming gmake-3.80nb2 GNU version of 'make' utility grep-2.5.1nb2 GNU grep gsed-4.0.9 GNU implementation of sed, the POSIX stream editor gtar-1.13.25nb1 The "meta-package" for the GNU tape archiver (tar) gtar-base-1.13.25nb1 The GNU tape archiver with remote magnetic tape support gtar-info-1.13.25 Info format documentation for the GNU tape archiver gtexinfo-4.6nb2 GNU info file manipulation utilities gtk+-1.2.10nb7 The GIMP Toolkit - libraries for building X11 user interfaces guile-1.6.4 GNU's Ubiquitous Intelligent Language for Extension hugs98-200112nb1 Nottingham and Yale Haskell interpreter and programming environment jpeg-6bnb1 IJG's jpeg compression utilities kali-0.47 Distributed implementation of Scheme less-381nb1 Pager similar to more and pg libiconv-1.9.1nb1 Character set conversion library libpcap-0.7.2 System-independent interface for user-level packet capture libtool-base-1.5.2nb4 Generic shared library support script (the script itself) libtool-info-1.5.2nb4 Generic shared library support script - info pages m4-1.4nb1 GNU version of Unix m4 macro-processor mozilla-stable-1.4.1nb3 Full featured gecko-based browser (stable branch) nbsed-20031016 NetBSD-current's sed(1) ncurses-5.4 CRT screen handling and optimization package net-snmp-5.0.9nb3 Extensible SNMP implementation openssl-0.9.6lnb1 Secure Socket Layer and cryptographic library pango-1.2.5nb1 Library for layout and rendering of text patch-2.5.4nb2 Patch files using diff output pdksh-5.2.14nb1 Free clone of the AT&T Korn shell perl-5.6.1nb10 Practical Extraction and Report Language pkg_install-info-4.5nb2 Standalone GNU info file installation utility pkg_tarup-1.5.1 Generates binary package(s) from installed pkg(s) pkgchk-1.45 Check installed package versions against pkgsrc pkgconfig-0.15.0 System for managing library compile/link flags pkgdep-1.0 Script for displaying dependence information on software packages pkgdepgraph-2.5 Visual representation of installed NetBSD packages pkgdiff-0.113 Tools to ease creating and maintaining patches for pkgsrc pkglint-3.68 Verifier for NetBSD packages and complete pkgsrc tree pkgmanpages-19991222 Manual page(s) for the packages collection pkgsurvey-0.0 Utility to collate pkg information, and mail to central census site png-1.2.5nb2 Library for manipulating PNG images postgresql-7.3.4 Robust, next generation, object-relational DBMS postgresql-client-7.3.4nb1 PostgreSQL database client programs postgresql-docs-7.3.4 PostgreSQL database system documentation postgresql-lib-7.3.4nb1 PostgreSQL database headers and libraries postgresql-server-7.3.4nb3 PostgreSQL database server programs randrext-1.0 RandR extension (Headers and documentation files) rc.subr-20030706 Portable NetBSD rc.subr implementation for pkgsrc readline-4.3pl5 GNU library that can recall and edit previous input render-0.8 Headers for X11 render extension rpm-2.5.4nb1 The Red Hat Package Manager rsync-2.6.0 Network file distribution/synchronisation utility shlock-20020114 Shell utility to perform dot-locking slib-2.4.6 Portable Scheme library of compatibility and utility functions sudo-1.6.7.5 Allow others to run commands as root swi-prolog-5.0.10nb1 ISO/Edinburgh-style Prolog compiler tcp_wrappers-7.6.1nb1 Monitor and filter incoming requests for network services tcpdump-3.7.2nb1 Network monitoring tool thttpd-2.25b Tiny/turbo/throttling HTTP server tiff-3.6.1 Library and tools for reading and writing TIFF data files top-3.5b9 The ubiquitous system monitoring utility unzip-5.50nb2 List, test and extract compressed files in a ZIP archive url2pkg-1.24 Tool to automate initial steps in building a package w3m-0.4nb2 Multilingualized version of a pager/text-based browser w3m x11-links-0.23 Shadow tree of links to ${X11BASE} headers and libraries xdg-dirs-1.1 Shared XDG directories xdg-x11-dirs-1.1 Shared XDG directories under the X11 tree zip-2.3nb2 Create/update ZIP files compatible with pkzip zlib-1.2.1 General purpose data compression libraryHere are details on packages that needed work to install, and those that failed to install.