3 Dports is DragonFly's own third-party software build system. It is based on FreeBSD's Ports Collection. Differences between ports and DPorts are intentionally kept to a minimum, both to maintain familiarity for mutual users of both operating systems and also to leverage the tremendous amount of work the FreeBSD contributors put into ports. DPorts can and does feature ports unique to DragonFly, so it's truly a native system.
5 The __pkgng__ tool called "pkg" is a modern and fast binary package manager. It was developed for FreeBSD, but PC-BSD used it in production first, followed soon after by DragonFly. In the future, it will be the only binary package manager on FreeBSD, just as DPorts is currently the only port manager.
7 __pkgng__ is not a replacement for port management tools like `ports-mgmt/portmaster` or `ports-mgmt/portupgrade`. While `ports-mgmt/portmaster` and `ports-mgmt/portupgrade` can install third-party software from both binary packages and DPorts, __pkgng__ installs only binary packages.
9 ## Getting started with pkgng
11 DragonFly daily snapshots and Releases (starting with 3.4) come with __pkgng__ already installed. Upgrades from earlier releases, however, will not have it. If the "pkg" program is missing on the system for any reason, it can be quickly bootstrapped without having to build it from source.
13 To ensure __pkgng__ on a DragonFly BSD 3.4 or higher system is ready for use, run the following BEFORE you try to use `pkg` the first time:
21 Since you may need to manually edit the configuration file `/usr/local/etc/pkg.conf`, here is the
22 usual command to edit it using the vi editor:
24 # vi /usr/local/etc/pkg.conf
26 Before using consult the man page (`man pkg`) and then try these examples:
32 To bootstrap __pkgng__ with a download on a very old version of DragonFly that is still using `pkgsrc` run:
36 # pkg-static install -y pkg
39 Note that this step is unnecessary for any newly installed release from DragonFly 3.4 onwards.
43 Older versions of pkgng saved their configuration at /usr/local/etc/pkg.conf; this file made reference to a PACKAGESITE. pkgng will still work based on this file, but will output errors:
46 pkg: PACKAGESITE in pkg.conf is deprecated. Please create a repository configuration file
47 Updating repository catalogue
48 pkg: Warning: use of http:// URL scheme with SRV records is deprecated: switch to pkg+http://
50 Listen to the errors: hash out the packagesite line, save the file, and move on. This can be done with vi:
52 # vi /usr/local/etc/pkg.conf
54 There will be two lines in the file like this:
56 # Default Dports package server (California)
57 PACKAGESITE: http://mirror-master.dragonflybsd.org/dports/${ABI}/LATEST
59 Hash out the offending line:
61 # Default Dports package server (California)
62 # PACKAGESITE: http://mirror-master.dragonflybsd.org/dports/${ABI}/LATEST
64 Note that, as of time of writing, there are two working package repositories:
66 # Default Dports package server (California)
67 # PACKAGESITE: http://mirror-master.dragonflybsd.org/dports/${ABI}/LATEST
71 #PACKAGESITE: http://dfly.schlundtech.de/dports/${ABI}/LATEST
73 Test their performance---we will be using the fastest one. This may, or may not, be the one closest to you (the California site for the New World, the German site for the Old World).
76 PING schlundtech.de (85.236.36.90): 56 data bytes
77 64 bytes from 85.236.36.90: icmp_seq=0 ttl=49 time=101.433 ms
78 64 bytes from 85.236.36.90: icmp_seq=1 ttl=49 time=59.177 ms
79 64 bytes from 85.236.36.90: icmp_seq=2 ttl=49 time=79.550 ms
80 64 bytes from 85.236.36.90: icmp_seq=3 ttl=49 time=88.268 ms
81 64 bytes from 85.236.36.90: icmp_seq=4 ttl=49 time=120.060 ms
83 --- schlundtech.de ping statistics ---
84 20 packets transmitted, 19 packets received, 5.0% packet loss
85 round-trip min/avg/max/stddev = 49.555/96.064/186.662/33.559 ms
86 # ping mirror-master.dragonflybsd.org
87 PING avalon.dragonflybsd.org (199.233.90.72): 56 data bytes
88 64 bytes from 199.233.90.72: icmp_seq=0 ttl=47 time=208.013 ms
89 64 bytes from 199.233.90.72: icmp_seq=1 ttl=47 time=256.441 ms
90 64 bytes from 199.233.90.72: icmp_seq=2 ttl=47 time=281.436 ms
91 64 bytes from 199.233.90.72: icmp_seq=3 ttl=47 time=281.103 ms
92 64 bytes from 199.233.90.72: icmp_seq=4 ttl=47 time=285.440 ms
94 --- avalon.dragonflybsd.org ping statistics ---
95 19 packets transmitted, 19 packets received, 0.0% packet loss
96 round-trip min/avg/max/stddev = 208.013/264.017/334.180/31.549 ms
98 Now, navigate to `/usr/local/etc/pkg/repos/` and rename one of the configuration file samples you find there. Edit the one you renamed:
100 # cd /usr/local/etc/pkg/repos/
102 df-latest.conf.sample df-releases.conf.sample
103 # cp -v df-latest.conf.sample df-latest.conf
104 df-latest.conf.sample -> df-latest.conf
105 # chmod -v 644 df-latest.conf
109 Enable whichever server was faster (Avalon is American, SchlundTech is German):
112 url : http://mirror-master.dragonflybsd.org/dports/${ABI}/LATEST,
117 url : http://dfly.schlundtech.de/dports/${ABI}/LATEST,
121 ## Basic pkgng Operations
123 Usage information for __pkgng__ is available in the pkg(8) manual page, or by running `pkg` without additional arguments.
125 Each __pkgng__ command argument is documented in a command-specific manual page. To read the manual page for `pkg install`, for example, run either:
130 ## Obtaining Information About Installed Packages with pkgng
132 Information about the packages installed on a system can be viewed by running `pkg info`. Similar to pkg_info(1), the package version and description for all packages will be listed. Information about a specific package is available by running:
134 # pkg info packagename
136 For example, to see which version of __pkgng__ is installed on the system, run:
139 pkg-1.0.12 New generation package manager
141 ## Installing and Removing Packages with pkgng
143 In general, most DragonFly users will install binary packages by typing:
145 # pkg install <packagename>
147 For example, to install curl:
151 Updating repository catalogue
152 Repository catalogue is up-to-date, no need to fetch fresh copy
153 The following packages will be installed:
155 Installing ca_root_nss: 3.13.5
156 Installing curl: 7.24.0
158 The installation will require 4 MB more space
160 1 MB to be downloaded
162 Proceed with installing packages [y/N]: y
163 ca_root_nss-3.13.5.txz 100% 255KB 255.1KB/s 255.1KB/s 00:00
164 curl-7.24.0.txz 100% 1108KB 1.1MB/s 1.1MB/s 00:00
165 Checking integrity... done
166 Installing ca_root_nss-3.13.5... done
167 Installing curl-7.24.0... done
169 The new package and any additional packages that were installed as dependencies can be seen in the installed packages list:
172 ca_root_nss-3.13.5 The root certificate bundle from the Mozilla Project
173 curl-7.24.0 Non-interactive tool to get files from FTP, GOPHER, HTTP(S) servers
174 pkg-1.0.12 New generation package manager
176 Packages that are no longer needed can be removed with `pkg delete`. For example, if it turns out that curl is not needed after all:
179 The following packages will be deleted:
183 The deletion will free 3 MB
185 Proceed with deleting packages [y/N]: y
186 Deleting curl-7.24.0_1... done
188 ## Upgrading Installed Packages with pkgng
190 Packages that are outdated can be found with `pkg version`. If a local ports tree does not exist, pkg-version(8) will use the remote repository catalogue, otherwise the local ports tree will be used to identify package versions.
192 Packages can be upgraded to newer versions with __pkgng__. Suppose a new version of curl has been released. The local package can be upgraded to the new version:
195 Updating repository catalogue
196 repo.txz 100% 297KB 296.5KB/s 296.5KB/s 00:00
197 The following packages will be upgraded:
199 Upgrading curl: 7.24.0 -> 7.24.0_1
201 1 MB to be downloaded
203 Proceed with upgrading packages [y/N]: y
204 curl-7.24.0_1.txz 100% 1108KB 1.1MB/s 1.1MB/s 00:00
205 Checking integrity... done
206 Upgrading curl from 7.24.0 to 7.24.0_1... done
208 ## Auditing Installed Packages with pkgng
210 Occasionally, software vulnerabilities may be discovered in software within DPorts. __pkgng__ includes built-in auditing. To audit the software installed on the system, type:
214 # Advanced pkgng Operations
216 ## Automatically Removing Leaf Dependencies with pkgng
218 Removing a package may leave behind unnecessary dependencies, like `security/ca_root_nss` in the example above. Such packages are still installed, but nothing depends on them any more. Unneeded packages that were installed as dependencies can be automatically detected and removed:
221 Packages to be autoremoved:
224 The autoremoval will free 723 kB
226 Proceed with autoremoval of packages [y/N]: y
227 Deinstalling ca_root_nss-3.13.5... done
229 ## Backing Up the pkgng Package Database
231 __pkgng__ includes its own package database backup mechanism. To manually back up the package database contents, type:
233 # pkg backup -d <pkgng.db>
235 Additionally, __pkgng__ includes a periodic(8) script to automatically back up the package database daily if `daily_backup_pkgng_enable` is set to `YES` in periodic.conf(5). To prevent the `pkg_install` periodic script from also backing up the package database, set `daily_backup_pkgdb_enable` to `NO` in periodic.conf(5).
237 To restore the contents of a previous package database backup, run:
239 # pkg backup -r </path/to/pkgng.db>
241 ## Removing Stale pkgng Packages
243 By default, __pkgng__ stores binary packages in a cache directory as defined by `PKG_CACHEDIR` in pkg.conf(5). When upgrading packages with pkg upgrade, old versions of the upgraded packages are not automatically removed.
245 To remove the outdated binary packages, type:
249 ##Modifying pkgng Package Metadata
251 __pkgng__ has a built-in command to update package origins. For example, if `lang/php5` was originally at version 5.3, but has been renamed to lang/php53 for the inclusion of version 5.4, the package database can be updated to deal with this. For __pkgng__, the syntax is:
253 # pkg set -o <category/oldport>:<category/newport>
255 For example, to change the package origin for the above example, type:
257 # pkg set -o lang/php5:lang/php53
259 As another example, to update lang/ruby18 to lang/ruby19, type:
261 # pkg set -o lang/ruby18:lang/ruby19
263 As a final example, to change the origin of the libglut shared libraries from graphics/libglut to graphics/freeglut, type:
265 # pkg set -o graphics/libglut:graphics/freeglut
267 _Note_: When changing package origins, in most cases it is important to reinstall packages that are dependent on the package that has had the origin changed. To force a reinstallation of dependent packages, type:
269 # pkg install -Rf graphics/freeglut
271 # Building DPorts from source
273 The average user will probably not build packages from source. However, it's easy to do and it can be done even when packages have already been pre-installed on the system. Common reasons to build from source are:
275 * The port is new and there's no pre-binary available yet
276 * The pre-built binaries use the default options and the user needs a package built with a different set of options
277 * Testing FreeBSD port in order to patch them and submit to DPorts
278 * The user just prefers building from source
280 ## Installing DPorts tree
282 DragonFly 3.4 or later is the minimum version that can build DPorts from source.
284 It's probably that pkgsrc binaries are already installed because it comes bootstrapped with new systems. It is necessary to rename `/usr/pkg` directory so that the existing pkgsrc binary tools and libraries don’t get accidentally used while building DPorts, causing breakage. For the installation of the DPorts tree, type:
287 # make dports-create-shallow
289 If the `/usr/pkg directory` has already been renamed, `git` won’t be in the search path any more. One option is to download a tarball of DPorts and unpack it. To do this, type:
292 # make dports-download
294 For future updates, pull delta changes via `git` is fastest, so it is suggested to convert the static tree to a git repository by typing:
296 # cd /usr/dports/devel/git
300 # make dports-create-shallow
302 The git repository is hosted on the [github account of John Marino](https://github.com/jrmarino/DPorts/#readme).
306 Building from source works similar to ports and pkgsrc: cd into the appropriate program's directory, and type 'make'. 'make install' to install the software, 'make clean' to clean up work files, and so on. Use 'make config-recursive' if you want to set all the port's options, and the options of its dependencies, immediately instead of during the build.
308 To take all the default build options and avoid getting the pop-up dialog box, set `NO_DIALOG=yes` on either the command line or the make.conf file.
310 If you just want to set the options for one package, and accept the default for all of its dependencies, do 'make config' in the package in you want non-default options, and then 'make NO_DIALOG=yes'. Note that this is only necessary if you want to build from source with a non-default set of options, or if no pre-built binary package is available yet.
313 * How fix/add broken ports: [[docs/howtos/fixdports]]
314 * [Trick: How to get i386-only software via dports](http://leaf.dragonflybsd.org/mailarchive/users/2013-06/msg00023.html)