Editing Pkg

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
 
{{:Navbar Application Management}}
 
{{:Navbar Application Management}}
 +
  
 
== Introduction ==
 
== Introduction ==
  
'''pkg''' is the FreeBSD package management tools, offering many features that make dealing with binary packages faster and easier.
+
'''pkg''' is the next generation replacement for the traditional FreeBSD package management tools, offering many features that make dealing with binary packages faster and easier. [[File:Icon FreeBSD.png|50px|link=https://www.freebsd.org/doc/handbook/pkgng-intro.html]]
See [https://www.freebsd.org/cgi/man.cgi?query=pkg&sektion=8&manpath=freebsd-release-ports '''pkg(8)''']
+
 
 +
The package manager '''pkg''' is a powerful tool to manipulate pre-compiled copies of all the commands for an application, as well as any configuration files and documentation.
  
 +
While the two technologies ports and packages are similar, each have their own strengths. Select the technology that meets your requirements for installing a particular application.
 
Package Benefits
 
Package Benefits
  
Line 14: Line 17:
 
* Packages do not require any understanding of the process involved in compiling software on FreeBSD.
 
* Packages do not require any understanding of the process involved in compiling software on FreeBSD.
  
==Overview About PKG Commands==
+
Sorce: [[File:Icon FreeBSD.png|50px|link=https://www.freebsd.org/doc/handbook/ports-overview.html]]'''Handbook: 4.2. Overview of Software Installation'''
 
+
{|class="wikitable" style="width:95%;background:#FFFFFF; border:2px solid #008000;text-align:left;padding: 10px"
+
|-
+
! scope="col" style="width: 50px;"|'''Command'''
+
! scope="col" style="width: 550px;"|'''Explanation'''
+
|-
+
|help ''command''
+
|Display usage information of the specified command.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-add&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports add]   
+
|Install a package from either a local source or a remote one.<br/>When installing from remote source you need to specify the proto-<br/> col to use when fetching the package.<br/>
+
Currently supported protocols are FTP, HTTP and HTTPS.<br/>
+
annotate:  Add, modify or delete tag-value style annotations on packages.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-alias&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports alias]
+
|display configured aliases
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-annotate&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports annotate]
+
|Add, modify or delete arbitrary annotations from packages
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-audit&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports audit] 
+
|Audit installed packages against known vulnerabilities.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-autoremove&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports autoremove]
+
|Delete packages which were automatically installed as dependen-<br/>cies and are not required any more.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-backup&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports 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.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-check&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports check] 
+
|Sanity checks installed packages.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-clean&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports clean] 
+
|Clean the local cache of fetched remote packages.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-config&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports config]
+
|retrieve the value of a given configuration option
+
|-
+
|convert    
+
|Convert to and from the old pkg_add(1) format.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-create&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports create] 
+
|Create a package, a utility for creating software package distributions.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-delete&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports delete] 
+
|Delete a package from the database and the system.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-fetch&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports fetch] 
+
|Fetch packages from a remote repository.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-info&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports info]   
+
|Display information about installed packages.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-install&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports 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.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-lock&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports lock]   
+
|Prevent modification or deletion of a package, lock or unlock packages.
+
|-
+
|plugins    
+
|List the available plugins.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-query&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports query] 
+
|Query information about installed packages.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-register&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports register]   
+
|Register a package in the database.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-repo&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports repo]   
+
|Create a local package repository for remote usage.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-rquery&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports rquery] 
+
|Query information for remote repositories.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-search&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports search] 
+
|Search for the given pattern in the remote package repositories.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-set&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports set]   
+
|Modify information in the installed database.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-shell&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports shell] 
+
|Open a SQLite shell to the local or remote database.  Extreme
+
    care should be taken when using this command.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-shlib&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports shlib] 
+
|Displays which packages link to a specific shared library.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-stats&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports stats] 
+
|Display package database statistics.
+
|-
+
|unlock 
+
|Unlocks packages, allowing them to be modified or deleted.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-update&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports update] 
+
|Update the available remote repositories as listed <br/>in /usr/local/etc/pkg/repos/GhostBSD.conf
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-updating&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports updating]    
+
|Display UPDATING entries of installed packages.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-upgrade&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports upgrade]    
+
|Upgrade a package to a newer version.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-version&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports version]   
+
|Summarize installed versions of packages.
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-which&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports which] 
+
|Query the database for package(s) that installed a specific file.
+
|-
+
!colspan="2"|'''See also'''
+
|-
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg_printf&sektion=3&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports pkg_printf]
+
|family of functions produces output of package data according to a format
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg_repos&sektion=3&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports pkg_repos()]
+
|Takes the address of a pointer to the repository
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg-repository&sektion=5&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports package repository]
+
|format and operation of package repositories used by pkg(8)
+
|-
+
|[https://www.freebsd.org/cgi/man.cgi?query=pkg.conf&sektion=5&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports pkg.conf]
+
|system-wide configuration file for pkg, default location of this file is /usr/local/etc/pkg.conf
+
|}
+
  
 
== Function and Examples ==
 
== Function and Examples ==
  
A package can be manipulated with the [https://www.freebsd.org/cgi/man.cgi?query=pkg&sektion=8&manpath=freebsd-release-ports pkg(8)] commands, such as ''pkg install''.
+
A package can be manipulated with the [https://www.freebsd.org/cgi/man.cgi?query=pkg&sektion=8&manpath=freebsd-release-ports pkg(8)] commands, such as pkg install.
  
pkg only works with binary packages. By default, pkg uses the binary packages from the GhostBSD package mirrors.
+
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: [https://ghostbsd.org/19.09_release_announcement 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:
 
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:
  
<code>[https://www.freebsd.org/cgi/man.cgi?query=pkg&sektion=8&manpath=freebsd-release-ports#COMMANDS # pkg help] install</code>
+
<code># pkg help install</code>
  
 
or
 
or
  
<code>[https://www.freebsd.org/cgi/man.cgi?query=pkg-install&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports # man pkg-install]</code>
+
<code># man pkg-install</code>
  
 
===Installing Packages===
 
===Installing Packages===
Line 160: Line 38:
 
To install a binary package use the following command, where packagename is the name of the package to install:
 
To install a binary package use the following command, where packagename is the name of the package to install:
  
<code>[https://www.freebsd.org/cgi/man.cgi?query=pkg-install&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports # pkg install] packagename</code>
+
<code># pkg install packagename</code>
  
 
This command uses repository data to determine which version of the software to install and if it has any uninstalled dependencies.
 
This command uses repository data to determine which version of the software to install and if it has any uninstalled dependencies.
Line 169: Line 47:
  
  
<code>[https://www.freebsd.org/cgi/man.cgi?query=pkg-delete&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports # pkg delete] packagename</code>
+
<code># pkg delete packagename</code>
  
 
===Upgrading Installed Packages===
 
===Upgrading Installed Packages===
 
Update the local package repository index
 
 
<code>[https://www.freebsd.org/cgi/man.cgi?query=pkg-update&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports # pkg update]</code>
 
  
 
Installed packages can be upgraded to their latest versions by running:
 
Installed packages can be upgraded to their latest versions by running:
  
<code>[https://www.freebsd.org/cgi/man.cgi?query=pkg-upgrade&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports # pkg upgrade]</code>
+
<code># pkg upgrade</code>
  
 
This command will compare the installed versions with those available in the repository catalogue and upgrade them from the repository.
 
This command will compare the installed versions with those available in the repository catalogue and upgrade them from the repository.
 
If  a kernel has to be upgraded, you have to do a forced upgrade. It is needed that all packages have to be reinstalled, so that all the package are compiled with the right kernel.
 
 
<code>[https://www.freebsd.org/cgi/man.cgi?query=pkg-update&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports # pkg update -f]</code>
 
 
<code>[https://www.freebsd.org/cgi/man.cgi?query=pkg-upgrade&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports # pkg upgrade -fy]</code>
 
 
===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
 
 
<code>[https://www.freebsd.org/cgi/man.cgi?query=pkg-lock&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports #pkg lock] packagename</code>
 
 
===To Get Info About An Installed Package===
 
 
If you like to know if a package is installed and which version, you have to write:
 
 
<code>[https://www.freebsd.org/cgi/man.cgi?query=pkg-info&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports pkg info] packagename</code>
 
  
 
===Auditing Installed Packages===
 
===Auditing Installed Packages===
Line 205: Line 61:
 
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:
 
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:
  
<code>[https://www.freebsd.org/cgi/man.cgi?query=pkg-audit&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports # pkg audit -F]</code>
+
<code># pkg audit -F</code>
 
+
{|class="wikitable" style="width:95%;background:#FFFFFF; border:2px solid #008000;text-align:left;padding: 10px"
+
|-
+
! scope="col" style="width: 100px;"|
+
! scope="col" style="width: 100px;"|
+
! scope="col" style="width: 500px;"|
+
|-
+
|<nowiki>-</nowiki>F,
+
|<nowiki>--</nowiki>fetch    
+
|Fetch the database before checking.
+
|-
+
|}
+
  
 
===Automatically Removing Unused Packages===
 
===Automatically Removing Unused Packages===
Line 223: Line 67:
 
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:
 
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:
  
<code>[https://www.freebsd.org/cgi/man.cgi?query=pkg-autoremove&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports # pkg autoremove]</code>
+
<code># pkg autoremove</code>
 
+
===Repositories===
+
 
+
The pkg mirrors are located in: 
+
* in the US: http://pkg.us.ghostbsd.org/stable/FreeBSD:12:amd64/
+
* in France: http://pkg.fr.ghostbsd.org/stable/FreeBSD:12:amd64/
+
* in Cynyda: http://pkg.ghostbsd.org/stable/FreeBSD:12:amd64/
+
 
+
To change the mirror go to the file <code>/etc/pkg/GhostBSD.conf</code> and change the URL. <br/>
+
There in it is described as:
+
 
+
* in France: <code> url: "http://pkg.fr.ghostbsd.org/stable/${ABI}/latest",</code>
+
* in Canada: <code> url: "http://pkg.ca.ghostbsd.org/stable/${ABI}/latest",</code>
+
* in US:  <code> url: "http://pkg.us.ghostbsd.org/stable/${ABI}/latest",</code>
+
 
+
For upgrading your system chose the nearest mirror to your location.
+
  
 
== For more Information ==
 
== For more Information ==
Line 247: Line 75:
 
* [https://www.freebsd.org/doc/handbook/pkgng-intro.html FreeBSD Handbook/chapter 4.4. Using pkg for Binary Package Management]
 
* [https://www.freebsd.org/doc/handbook/pkgng-intro.html FreeBSD Handbook/chapter 4.4. Using pkg for Binary Package Management]
 
* [https://www.vultr.com/docs/how-to-use-the-pkg-package-manager-on-freebsd-12 VULTR]
 
* [https://www.vultr.com/docs/how-to-use-the-pkg-package-manager-on-freebsd-12 VULTR]
 
 
  
  
  
 
[[Category:Application Management]]
 
[[Category:Application Management]]

Please note that all contributions to GhostBSD Wiki are considered to be released under the Creative Commons Attribution (see GhostBSD Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel | Editing help (opens in new window)

Template used on this page: