Pkg
Application Management | ||||||
---|---|---|---|---|---|---|
pkg | Software Station | Update Station | Ports | Applications | ||
Back to the Wiki |
Contents
Introduction
pkg is the FreeBSD package management tools, offering many features that make dealing with binary packages faster and easier. See pkg(8)
Package Benefits
- A compressed package tarball is typically smaller than the compressed tarball containing the source code for the application.
- Packages do not require compilation time. For large applications, such as Mozilla, KDE, or GNOME, this can be important on a slow system.
- Packages do not require any understanding of the process involved in compiling software on FreeBSD.
Overview About PKG Commands
Command | Explanation |
---|---|
help command | Display usage information of the specified command. |
add | Install a package from either a local source or a remote one. When installing from remote source you need to specify the proto- col to use when fetching the package. Currently supported protocols are FTP, HTTP and HTTPS. |
alias | display configured aliases |
annotate | Add, modify or delete arbitrary annotations from packages |
audit | Audit installed packages against known vulnerabilities. |
autoremove | Delete packages which were automatically installed as dependen- cies and are not required any more. |
backup | Dump the local package database to a file specified on the command-line. |
bootstrap | This is for compatibility with the pkg(7) bootstrapper. If pkg is already installed, nothing is done. If invoked with the -f flag an attempt will be made to reinstall pkg from remote repository. |
check | Sanity checks installed packages. |
clean | Clean the local cache of fetched remote packages. |
config | retrieve the value of a given configuration option |
convert | Convert to and from the old pkg_add(1) format. |
create | Create a package, a utility for creating software package distributions. |
delete | Delete a package from the database and the system. |
fetch | Fetch packages from a remote repository. |
info | Display information about installed packages. |
install | Install a package from a remote package repository. If a package is found in more than one remote repository, then installation happens from the first one. Downloading a package is tried from each package repository in turn, until the package is successfully fetched. |
lock | Prevent modification or deletion of a package, lock or unlock packages. |
plugins | List the available plugins. |
query | Query information about installed packages. |
register | Register a package in the database. |
repo | Create a local package repository for remote usage. |
rquery | Query information for remote repositories. |
search | Search for the given pattern in the remote package repositories. |
set | Modify information in the installed database. |
shell | Open a SQLite shell to the local or remote database. Extreme
care should be taken when using this command. |
shlib | Displays which packages link to a specific shared library. |
stats | Display package database statistics. |
unlock | Unlocks packages, allowing them to be modified or deleted. |
update | Update the available remote repositories as listed in /usr/local/etc/pkg/repos/GhostBSD.conf |
updating | Display UPDATING entries of installed packages. |
upgrade | Upgrade a package to a newer version. |
version | Summarize installed versions of packages. |
which | Query the database for package(s) that installed a specific file. |
See also | |
pkg_printf | family of functions produces output of package data according to a format |
pkg_repos() | Takes the address of a pointer to the repository |
package repository | format and operation of package repositories used by pkg(8) |
pkg.conf | system-wide configuration file for pkg, default location of this file is /usr/local/etc/pkg.conf |
Function and Examples
A package can be manipulated with the pkg(8) commands, such as pkg install.
pkg only works with binary packages. By default, pkg uses the binary packages from the GhostBSD/TrueOS package mirrors.
"GhostBSD now use TrueOS packages base from ports." See: What changed since 19.04.
Each pkg command argument is documented in a command-specific manual page. To read the manual page for pkg install, for example, run either of these commands:
# pkg help install
or
Installing Packages
To install a binary package use the following command, where packagename is the name of the package to install:
# pkg install packagename
This command uses repository data to determine which version of the software to install and if it has any uninstalled dependencies.
Removing Packages
Packages that are no longer needed can be removed with pkg delete. For example:
# pkg delete packagename
Upgrading Installed Packages
Update the local catalogues of the enabled package repositories
Installed packages can be upgraded to their latest versions by running:
This command will compare the installed versions with those available in the repository catalogue and upgrade them from the repository.
Not Updating A Package
If you have got an application via the ports system and don't like to change it during pkg upgrade process, do
#pkg lock packagename
To Get Info About An Installed Package
If you like to know if a package is installed and which version, you have to write:
pkg info packagename
Auditing Installed Packages
Software vulnerabilities are regularly discovered in third-party applications. To address this, pkg includes a built-in auditing mechanism. To determine if there are any known vulnerabilities for the software installed on the system, run:
-F, | --fetch | Fetch the database before checking. |
Automatically Removing Unused Packages
Removing a package may leave behind dependencies which are no longer required. Unneeded packages that were installed as dependencies (leaf packages) can be automatically detected and removed using:
Repositories
The pkg mirrors are located in:
- in France:
http://pkg.fr.ghostbsd.org/stable/FreeBSD:12:amd64/
- in Canada:
http://pkg.ghostbsd.org/stable/FreeBSD:12:amd64/
- in US:
http://pkg.us.ghostbsd.org/stable/FreeBSD:12:amd64/
For upgrading your system chose the nearest mirror to your location.
To change the mirror go to the file /usr/local/etc/pkg/repos/GhostBSD.conf
and change the URL.
For more Information
Source: *FreeBSD Handbook/chapter 4.4. Using pkg for Binary Package Management