Annotation of wikisrc/pkgsrc/how_to_use_pkgsrc.mdwn, revision 1.2
1.1 mspo 1: **Contents**
3: [[!toc levels=2]]
5: #What is pkgsrc
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:
11: The pkgsrc source tree, which contains all the files, will need a minimum of 200 MB disk space.
13: #Preparing pkgsrc
15: ##Creating the pkgsrc directory
17: This is a matter of taste, but most people create the directory in /usr/pkgsrc/
19: # mkdir /usr/pkgsrc
21: Change owner of pkgsrc to a user, so you can update later it with user rights.
23: # chown john pkgsrc
25: ##Obtaining the current pkgsrc source tree
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.
29: # ftp ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/i386/5.0/All/csup-20070216.tgz
31: and then installing it with
33: # pkg_add csup-20070216.tgz
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:
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
47: **base** points to your home directory and **prefix** to the directory, where the repo goes.
49: To get and to keep your pkgsrc tree in sync, just run:
51: $ csup pkgsrc-supfile
53: To update regularly, say once a day, use [[cron]].
55: ##Creating WRKOBJDIR
57: To keep the tree clean and your work directories out of it, define WRKOBJDIR in /etc/mk.conf and add:
61: and then create that directory.
63: # mkdir /usr/work
65: ##Creating DISTDIR
67: We also want our distfiles to be stored, outside of the pkgsrc directory. Therefore we add the DISTDIR variable to /etc/mk.conf
71: and create it with:
73: # mkdir /usr/distfiles
75: #Installing packages
77: To install packages, we need to become root.
79: $ su
81: then we change to the directory (category) and then to the package we want to install.
83: # cd /usr/pkgsrc/misc/figlet
85: to install we enter
87: # make install
89: afterwards we clean up and enter
91: # make clean
93: if this was a package with dependencies, we also enter
95: # make clean-depends
97: You can put them all in one line too.
99: # make install clean clean-depends
101: If you wish to clean the distfiles, the files that have been downloaded, you enter
103: # make distclean
105: #List Packages
107: $ pkg_info
109: #Removing Packages
111: # pkg_delete packagename
113: #Updating Packages
115: You can update a single package using make update.
117: # make update
119: #Rolling Replace
121: pkgtools/pkg_rolling-replace is a very nice programm to update all outdated packages on your system.
123: That's it. Have fun.
125: Since the framework is complex, there are millions of other options.
127: #On-line help
129: Besides [The pkgsrc Guide](http://www.netbsd.org/docs/pkgsrc/) there is also a built-in on-line help system.
131: # make help
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).
135: Most targets and variable names are documented, but not all are.
136: See also
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