## Using the Binary Packages System ***DragonFly customizations contributed by Chern Lee and Adrian Nida. *** ### Installing a Binary Package You can use the [pkg_add(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=pkg_add§ion=1) utility to install a pkgsrcĀ® software package from a local file or from a server on the network. **Example Downloading a Package Manually and Installing It Locally** # ftp -a chlamydia.fs.ei.tum.de Trying 129.187.54.14:21 ... Connected to chlamydia.fs.ei.tum.de. 220 chlamydia.fs.ei.tum.de FTP server (tnftpd 20040810) ready. 331 Guest login ok, type your name as password. 230 Guest login ok, access restrictions apply. Remote system type is UNIX. Using binary mode to transfer files. ftp> cd pub/DragonFly/packages/DragonFly-2.2/pkgsrc-2008Q4/All/ 250 CWD command successful. ftp> get screen-4.0.3nb2.tgz local: screen-4.0.3nb2.tgz remote: screen-4.0.3nb2.tgz 229 Entering Extended Passive Mode (|||50048|) 150 Opening BINARY mode data connection for 'screen-4.0.3nb2.tgz' (527880 bytes). 100% |************************************************| 515 KiB 3.01 MiB/s 00:00 ETA 226 Transfer complete. 527880 bytes received in 00:00 (3.01 MiB/s) ftp> quit 221 Thank you for using the FTP service on chlamydia.fs.ei.tum.de. # pkg_add screen-4.0.3nb2.tgz **Note:** It should be noted that simply issuing: # pkg_add ftp://chlamydia.fs.ei.tum.de/pub/DragonFly/packages/DragonFly-2.2/pkgsrc-2008Q4/All/screen-4.0.3nb2.tgz will yield the same result as the above example. Unlike the FreeBSD version, the pkgsrc [pkg_add(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=pkg_add§ion=1) does not need to be passed the `-r` option. As can be seen from the second example, you just need to pass in the URL of the package. The utility will also always automatically fetch and install all dependencies. The example above would download the correct package and add it without any further user intervention. If you want to specify an alternative DragonFly Packages Mirror, instead of the main distribution site, you have to set `PACKAGESITE` accordingly, to override the default settings. [pkg_add(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=pkg_add§ion=1) uses [fetch(3)](http://leaf.dragonflybsd.org/cgi/web-man?command=fetch§ion=3) to download the files, which honors various environment variables, including `FTP_PASSIVE_MODE`, `FTP_PROXY`, and `FTP_PASSWORD`. You may need to set one or more of these if you are behind a firewall, or need to use an FTP/HTTP proxy. See [fetch(3)](http://leaf.dragonflybsd.org/cgi/web-man?command=fetch§ion=3) for the complete list. Binary package files are distributed in `.tgz` formats. You can find them at the default location ftp://ftp.pkgsrc-box.org/packages/, among other sites. The layout of the packages is similar to that of the `/usr/pkgsrc` tree. Each category has its own directory, and every package can be found within the `All` directory. The directory structure of the binary package system matches the source tree layout; they work with each other to form the entire package system. #### Using pkg_radd Since DragonFly 1.11 you can use [pkg_radd(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=pkg_radd§ion=1) to install binary packages without having to set `PACKAGESITE` or providing the complete URL. [pkg_radd(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=pkg_radd§ion=1) will handle that for you: # pkg_radd host # ### Dealing with different package versions Due to the fact that the official packages are only build for the RELEASE-Version of DragonFly, it is possible that you see a warning when installing binary packages on a DEVELOPMENT-version of DragonFly. The warning could look like this: pkg_add: Warning: package `vim-gtk2-7.1.116.tgz' was built for a different version of the OS: pkg_add: DragonFly/i386 1.10.1 (pkg) vs. DragonFly/i386 1.11.0 (this host) You can safely ignore this warning. Normally all packages build for RELEASE run fine on DEVELOPMENT unless a major API-breakage was introduced. In this case you would see a message from the developers on the appropriate mailing list. ### Managing Packages [pkg_info(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=pkg_info§ion=1) is a utility that lists and describes the various packages installed. # pkg_info digest-20050731 Message digest wrapper utility screen-4.0.2nb4 Multi-screen window manager ... [pkg_version(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=pkg_version§ion=1) is a utility that summarizes the versions of all installed packages. It compares the package version to the current version found in the ports tree. ### Deleting a Package To remove a previously installed software package, use the [pkg_delete(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=pkg_delete§ion=1) utility. # pkg_delete screen-4.0.3.tgz ### Miscellaneous All package information is stored within the `/var/db/pkg` directory. The installed file list and descriptions of each package can be found within subdirectories of this directory.