Annotation of wikisrc/pkgsrc/how_to_use_pkgsrc.mdwn, revision 1.2

1.1       mspo        1: **Contents**
                      2: 
                      3: [[!toc levels=2]]
                      4: 
                      5: #What is pkgsrc
                      6: 
1.2     ! wiki        7: Pkgsrc [spoken: package source] is the main package management framework for NetBSD. With pkgsrc you can easily add, remove and manage software on your system. Pkgsrc is basically a set of files, grouped by categories which contain information to install the software you have selected. All these files together are mostly referred to as the pkgsrc tree. This tree is maintained by the pkgsrc developers, who make changes to it every day. Therefore it is necessary to update the pkgsrc tree regularly.
1.1       mspo        8: 
                      9: #Requirements
                     10: 
                     11: The pkgsrc source tree, which contains all the files, will need a minimum of 200 MB disk space.
                     12: 
                     13: #Preparing pkgsrc
                     14: 
                     15: ##Creating the pkgsrc directory
                     16: 
                     17: This is a matter of taste, but most people create the directory in /usr/pkgsrc/
                     18: 
                     19:     # mkdir /usr/pkgsrc
                     20: 
                     21: Change owner of pkgsrc to a user, so you can update later it with user rights.
                     22: 
                     23:     # chown john pkgsrc
                     24: 
                     25: ##Obtaining the current pkgsrc source tree
                     26: 
                     27: There are many ways to get the pkgsrc tree. For example via ftp, cvs, sup or cvsup. My recommended way is to use csup, a leightweight cvsup protocol client written in C. But, before we can use csup we have to install it first, which in turn needs pkgsrc aswell. Therefore we will use for csup a precompiled binary package, instead of doing the work twice.
                     28: 
                     29:     # ftp ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/i386/5.0/All/csup-20070216.tgz
                     30: 
                     31: and then installing it with
                     32: 
                     33:     # pkg_add csup-20070216.tgz
                     34: 
                     35: csup needs one configuration file, the supfile, which contains the information to sync what from which server to where. Please create a file called pkgsrc-supfile in your home directory which contains:
                     36: 
                     37:     *default tag=.
                     38:     *default release=cvs
                     39:     *default delete use-rel-suffix
                     40:     *default umask=002
                     41:     *default host=cvsup.se.netbsd.org
                     42:     *default base=/home/john
                     43:     *default prefix=/usr
                     44: 
                     45:     netbsd-pkgsrc
                     46: 
                     47: **base** points to your home directory and **prefix** to the directory, where the repo goes.
                     48: 
                     49: To get and to keep your pkgsrc tree in sync, just run:
                     50: 
                     51:     $ csup pkgsrc-supfile
                     52: 
                     53: To update regularly, say once a day, use [[cron]].
                     54: 
                     55: ##Creating WRKOBJDIR
                     56: 
                     57: To keep the tree clean and your work directories out of it, define WRKOBJDIR in /etc/mk.conf and add:
                     58: 
                     59:     WRKOBJDIR=/usr/work
                     60: 
                     61: and then create that directory.
                     62: 
                     63:     # mkdir /usr/work
                     64: 
                     65: ##Creating DISTDIR
                     66: 
                     67: We also want our distfiles to be stored, outside of the pkgsrc directory. Therefore we add the DISTDIR variable to /etc/mk.conf
                     68: 
                     69:     DISTDIR=/usr/distfiles
                     70: 
                     71: and create it with:
                     72: 
                     73:     # mkdir /usr/distfiles
                     74: 
                     75: #Installing packages
                     76: 
                     77: To install packages, we need to become root.
                     78: 
                     79:     $ su 
                     80: 
                     81: then we change to the directory (category) and then to the package we want to install.
                     82: 
                     83:     # cd /usr/pkgsrc/misc/figlet
                     84: 
                     85: to install we enter
                     86: 
                     87:     # make install
                     88: 
                     89: afterwards we clean up and enter
                     90: 
                     91:     # make clean
                     92: 
                     93: if this was a package with dependencies, we also enter
                     94: 
                     95:     # make clean-depends
                     96: 
                     97: You can put them all in one line too.
                     98: 
                     99:     # make install clean clean-depends
                    100: 
                    101: If you wish to clean the distfiles, the files that have been downloaded, you enter
                    102: 
                    103:     # make distclean
                    104: 
                    105: #List Packages
                    106: 
                    107:     $ pkg_info
                    108: 
                    109: #Removing Packages
                    110: 
                    111:     # pkg_delete packagename
                    112: 
                    113: #Updating Packages
                    114: 
                    115: You can update a single package using make update.
                    116: 
                    117:     # make update
                    118: 
                    119: #Rolling Replace
                    120: 
                    121: pkgtools/pkg_rolling-replace is a very nice programm to update all outdated packages on your system.
                    122: 
                    123: That's it. Have fun.
                    124: 
                    125: Since the framework is complex, there are millions of other options.
                    126: 
                    127: #On-line help
                    128: 
                    129: Besides [The pkgsrc Guide](http://www.netbsd.org/docs/pkgsrc/) there is also a built-in on-line help system.
                    130: 
                    131:     # make help
                    132: 
                    133: gives you the usage information. This requires you to already know the name of the target or variable you want more info on (just like man does).
                    134: 
                    135: Most targets and variable names are documented, but not all are.
                    136: See also
                    137: 
                    138: * [[How to use pkgsrc mounted over NFS]]
                    139: * [[How to use pkgsrc on AIX]]
                    140: * [[How to use pkgsrc on A/UX]]
                    141: * [[How to use pkgsrc on IRIX]]
                    142: * [[How to use pkgsrc on Linux]]
                    143: * [[How] to use pkgsrc on Mac OS X]
                    144: * [[How to use pkgsrc on OSF1]]
                    145: * [[How to use pkgsrc on Solaris]]

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb