Home
|
Documentation
|
Practical notes
How to configure the pkgsrc portable package system
Pierre-Philipp Braun <pbraun@nethence.com>
Introduction
pkgsrc is NetBSD's package system for all plateforms. It may nevertheless be used on other operating systems, as it automates compilations from source.
Usage for binaries
Once NetBSD is installed, find your relevant binary repository depending on your NetBSD version (release and architecture) and country (choose your NetBSD mirror),
pkg_add -v screen
Eventually do,
export PASSIVE_FTP=yes
to get through firewall, but ftp(1) should switch to that by default.
Once this is working add the PKG_PATH export line into root's ~/.profile.
Binaries are more convenient but you may also compile the packages using the pkgsrc tree.
Usage from source
Either get pkgsrc.tar.gz from your NetBSD FTP mirror and extract it,
cd /root
tar xzf pkgsrc.tar.gz -C /usr
Or get the tree from CVS,
export CVSROOT=anoncvs@anoncvs.fr.netbsd.org:/cvsroot
export CVS_RSH=ssh
cd /usr
cvs -q co pkgsrc
To update the tree,
cd /usr/pkgsrc
cvs -q update -dP
To compile & install pacakges using pkgsrc,
cd /usr/pkgsrc/misc/screen
make install
To do the same while keeping a copy of the binary package into /usr/pkgsrc/packages,
make package
Note you may create a small binary addon repository with that, without the use of bulk.sh.
To quickly show dependencies, besides looking at the Makefile,
make clean-depends
Note. use that +" cvs up -dP" on the relevant packages' directories before installing them, if you don't want to update the whole tree.
Eventually create /etc/mk.conf to define a few specifics,
vi /etc/mk.conf
USA_RESIDENT=NO
PASSIVE_FETCH=YES
Note. a more recent way to deal with master sites is the use of those,
#MASTER_SORT=
#MASTER_SORT_RANDOM=NO
Some additionnal examples,
#ACCEPTABLE_LICENSES+=pine-license
#ACCEPTABLE_LICENSES+=lame-license
#ACCEPTABLE_LICENSES+=majordomo-license
#MOZILLA_USE_LINUX=YES
#IRSSI_USE_PERL=YES
#PINE_USE_LDAP=YES
#X11_TYPE=xorg
#USE_X11BASE=YES
#X11BASE=/usr/X11R6
#PKGSRCDIR=/usr/pkgsrc
#PACKAGES=/alternatepath/packages
#DISTDIR=/alternatepath/distfiles
#WITH_DVDCSS=YES
#USE_OPENLDAP=NO
#USE_SASL=NO
#USE_SASL2=NO
#ALLOW_VULNERABLE_PACKAGES=YES
Note. IRSSI_USE_PERL is the new syntax. Before it was,
#PKG_OPTIONS.irssi=irssi-perl
For NetBSD only, this copies newly created /usr/pkg/share/examples/rc.d/* script to /etc/rc.d,
#PKG_RCD_SCRIPTS=YES
#RCD_SCRIPTS_DIR=/etc/rc.d
Note. you may play with CPU optimizations too. Although one could edit /etc/mk.conf and do one of those,
#
# Those are just examples, it might break things
#
#CFLAGS+=-O2 -march=i686 -mcpu=i386
#CXXFLAGS=-O2 -march=i686 -mcpu=i386
#COPTS+=-O2 -mcpu=i686 -fexpensive-optimizations -ffast-math -msoft-float \
# -fmemoize-lookups -fthread-jumps -m486 -fomit-frame-pointer \
# -finline-functions
it's preferable to use the relevant cpuflags package but I'm hearing it doesn't work for the latest CPUs,
devel/cpuflags
sysutils/cpuid might be helpful too
Note. gentoo's optimization pages may be worth visiting anyways,
pkgsrc security
Install the audit-packages package to check for vulnerabilites,
cd /usr/pkgsrc/security/audit-packages
make install
vi /usr/pkg/etc/audit-packages.conf
If there's definitely some vulnerable package you need to install, add this to /etc/mk.conf,
ALLOW_VULNERABLE_PACKAGES=YES
Making bulks
Edit bulk.conf and execute bulk.sh. Alternatively, use this little wrapper,
#!/bin/sh
PATH=/usr/pkg/bin:/usr/pkg/sbin:$PATH
export PATH=/usr/pkg/bin:/usr/pkg/sbin:$PATH
cd /usr/pkgsrc/mk/bulk
sh build --config /usr/pkgsrc/mk/bulk/build.conf -r
References
Pkgsrc's Home Page,
Pkgsrc's CVS frontend,
Pkgsrc guide
Some great web pkgsrc browser,