Using pkgsrc Package Management

From GhostBSD Wiki
Revision as of 20:26, 8 October 2016 by EricBSD (Talk | contribs) (1 revision imported)

Jump to: navigation, search
Previous: Using the Ports Collection Return to Table of Contents Next: How to resolve the "fatal server error: no screen found"
Using pkgsrc Package Management


Installing a Package

N.B. This section is being left for users of pre GhostBSD 4.0 This will be different from GhostBSD4.0/FreeBSD 10.0 onwards, as it now uses pkgng. More info here The pkg command.


Use pkg_add(1) to install binary package from a local file or from a server on the network.

If you do not have a source of local packages, such as a FreeBSD CD-ROM set, include -r with pkg_add(1). This automatically determines the correct object format and release, and then fetches and installs the package from an FTP site without any further user intervention.

pkg_add -r lsof

To specify an alternative FreeBSD FTP mirror, specify the mirror in the PACKAGESITE environment variable. pkg_add(1) uses fetch(3) to download files, which uses 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) for the complete list. Note that in the example above lsof is used instead of lsof-4.56.4. When the remote fetching feature is used, the version number of the package must be removed.

Package files are distributed in .tgz and .tbz formats. Packages are available from ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/packages/, or the /packages directory of the FreeBSD DVD distribution. The layout of the packages is similar to that of the /usr/ports tree. Each category has its own directory, and every package can be found within the All directory.

Managing Packages

pkg_info(1) can be used to list and describe installed packages:

pkg_info
colordiff-1.0.13    A tool to colorize diff output
docbook-1.2         Meta-port for the different versions of the DocBook DTD
...

pkg_version(1) summarizes the versions of all installed packages and compares the package version to the current version found in the ports tree:

pkg_version
colordiff                   =
docbook                     =
...

The symbols in the second column indicate the relative age of the installed version and the version available in the local ports tree.

Symbol Meaning
= The version of the installed package matches the one found in the local ports tree.
< The installed version is older than the one available in the local ports tree.
> The installed version is newer than the one found in the local ports tree, meaning that the local ports tree is probably out of date.
 ? The installed package cannot be found in the ports index. This can happen when an installed port is removed from the Ports Collection or is renamed.
* There are multiple versions of the package.
 ! The installed package exists in the index but for some reason, pkg_version was unable to compare the version number of the installed package with the corresponding entry in the index.

Deleting a Package

To remove a previously installed software package, use pkg_delete(1):

pkg_delete xchat-1.7.1

Note that pkg_delete(1) requires the full package name and number; the above command would not work if xchat was given instead of xchat-1.7.1. Use pkg_version(1) to find the version of the installed package, or use a wildcard:

pkg_delete xchat\*

In this case, all packages whose names start with xchat will be deleted.

Miscellaneous

All package information, including the file list and descriptions of each installed package is stored within the /var/db/pkg directory.