We are still actively working on the spam issue.

Difference between revisions of "Package manager"

From InstallGentoo Wiki
Jump to: navigation, search
(apt and dpkg)
(Fixed grammatical error.)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Cleanup}}
 
 
 
''If you spot that the commands for the package manager of your favourite distribution are incorrect, feel free to add them or fix them in this page.''
 
''If you spot that the commands for the package manager of your favourite distribution are incorrect, feel free to add them or fix them in this page.''
  
Package managers are used by some operating systems, namely the [[BSD|BSDs]] and also [[GNU/Linux]] to rationalise installation of programs in the operating system, automating installation, removal and in most cases acquiring and searching for packages from a remote repository. There are many package management systems in use by many different families of Linux distributions and operating systems.
+
Package managers are used by some operating systems, namely the [[BSD|BSDs]] and also [[GNU Linux]] to simplify the download, installation and removal of programs in the system. Each GNU Linux distribution family, more or less has a different package manager that they think is the best that they pre-install.  
 
 
 
== GNU/Linux ==
 
== GNU/Linux ==
 
=== apt and dpkg ===
 
=== apt and dpkg ===
Line 11: Line 8:
 
{{note|All apt-get commands are interchangeable with apt. The two are technically separate packages, but apt is more feature-filled. It has progress-bars, for example}}
 
{{note|All apt-get commands are interchangeable with apt. The two are technically separate packages, but apt is more feature-filled. It has progress-bars, for example}}
  
To install a package:
+
{| class="wikitable"
# apt-get install package
+
! command !! description
 
+
|-
To remove a package:
+
|apt-get install <package> || Installs a package
# apt-get purge package
+
|-
 
+
|apt-get purge <package> || removes package (with data)
To remove orphaned packages:
+
|-
# apt-get --purge autoremove
+
| apt-get remove <package> || removes package
 
+
|-
To update the package list:
+
|apt-get --purge autoremove || removes orphaned packages
# apt-get update
+
|-
 
+
| apt-get update || updates package list
To upgrade existing packages:
+
|-
# apt-get upgrade
+
| apt-get upgrade || upgrades packages
 
+
|-
To clean the package cache:
+
| apt-get full-upgrade || Upgrades the entire system, and the distro
# apt-get clean
+
|-
 
+
|apt-get clean || cleans the package-cache
To search for a package with a query:
+
|-
$ apt-cache search query
+
|apt-cache search <query> || search the package-cache with a query
 
+
|-
To get build dependencies:
+
|apt-get build-dep <package> || downloads dependencies for building a package per apt instructions
# apt-get build-dep package
+
|}
 
 
 
=== dnf ===
 
=== dnf ===
  
Line 50: Line 46:
 
* se - search
 
* se - search
  
To install a package:
+
{| class="wikitable"
# zypper in package
+
! command !! description
 
+
|-
To remove a package:
+
| zypper in <package> || installs a package
# zypper rm package
+
|-
 
+
|zypper rm <package> || removes a package
To update the package list and upgrade existing packages:
+
|-
# zypper up
+
|zypper up || updates package-cache
 
+
|-
To search for a package with a query:
+
| zypper se <query> || searches package-cache
$ zypper se query
+
|-
 
+
| zypper ar <repo> || add a third-party repository to the package-cache
To add a repository to the repository list:
+
|-
# zypper ar repo
+
| zypper rr <repo> || remove a third-party repository to the package-cache
 
+
|}
To remove a repository:
 
# zypper rr repo
 
  
 
=== portage ===
 
=== portage ===
 
Portage is primarily used in the source-based Gentoo and Funtoo distributions, which means that Portage manipulates a ports tree and automates compilation of packages.
 
Portage is primarily used in the source-based Gentoo and Funtoo distributions, which means that Portage manipulates a ports tree and automates compilation of packages.
  
To update the ports tree:
+
{| class="wikitable"
# emerge --sync
+
! command !! description
 
+
|-
To upgrade installed packages:
+
| emerge --sync || To update the ports tree
# emerge --update --deep --with-bdeps=y --newuse @world
+
|-
 
+
| emerge --update --deep --with-bdeps=y --newuse @world || To upgrade installed packages
To search for a package with a query:
+
|-
# emerge --search query
+
| emerge --search <query> || To search for a package with a query
 +
|-
 +
| emerge <package> || To install (download and compile) a package
 +
|-
 +
| emerge --unmerge <package> || To remove a package
 +
|-
 +
| emerge --pretend <package> || To simulate the installation of a package
 +
|-
 +
| emerge --fetchonly <package> || To only download the source code of a package
 +
|-
 +
| emerge --vp <cariable> || To check USE flags for a package
 +
|}
  
To install (download and compile) a package:
 
# emerge package
 
 
To remove a package:
 
# emerge --unmerge package
 
 
To simulate the installation of a package:
 
# emerge --pretend package
 
 
To only download the source code of a package:
 
# emerge --fetchonly package
 
 
To check USE flags for a package:
 
# emerge -vp <variable> </code>
 
  
 
=== slackpkg ===
 
=== slackpkg ===
Line 99: Line 90:
 
<tt>slackpkg</tt> is Slackware's package manager.  
 
<tt>slackpkg</tt> is Slackware's package manager.  
  
To install a package:
+
{| class="wikitable"
# slackpkg install package
+
! command !! description
 
+
|-
To remove a package:
+
| slackpkg install <package> || To install a package
# slackpkg remove package
+
|-
 
+
| slackpkg remove <package> || To remove a package
To search for a package with a query:
+
|-
# slackpkg search package
+
| slackpkg search <package> || To search for a package with a query
 
+
|-
To upgrade all installed packages:
+
| slackpkg upgrade-all || To upgrade all installed packages
# slackpkg upgrade-all
+
|-
 
+
| slackpkg update || To update the package list
To update the package list:
+
|-
# slackpkg update
+
| slackpkg info package || To get information on a package
 
+
|}
To get information on a package:
 
# slackpkg info package
 
  
 
==== Unofficial packages ====
 
==== Unofficial packages ====
Line 121: Line 110:
 
The <tt>slackpkg</tt> repositories are limited to Slackware core packages.  Unofficial packages can be downloaded and added with  
 
The <tt>slackpkg</tt> repositories are limited to Slackware core packages.  Unofficial packages can be downloaded and added with  
  
<code>upgradepkg --install-new local_package.tgz</code>
+
<code>upgradepkg --install-new <local_package.tgz></code>
  
 
Slackware also supports building packages from source code or from RPM packages with Slackbuild scripts.  This gives the security and flexibility of building from source with the ease of package-based management.
 
Slackware also supports building packages from source code or from RPM packages with Slackbuild scripts.  This gives the security and flexibility of building from source with the ease of package-based management.
Line 129: Line 118:
 
After the script finishes, the last line should read "Package /tmp/PACKAGE_NAME.tgz successfuly created" if the compilation succeeded.
 
After the script finishes, the last line should read "Package /tmp/PACKAGE_NAME.tgz successfuly created" if the compilation succeeded.
 
Install the package like so:
 
Install the package like so:
# upgradepkg --install-new /tmp/package.tgz
+
<code>upgradepkg --install-new /tmp/package.tgz</code>
  
 
=== pacman ===
 
=== pacman ===
Line 136: Line 125:
  
 
=== xbps ===
 
=== xbps ===
 
+
{| class="wikitable"
To both update the package list and upgrade all installed packages:
+
! command !! description
# xbps-install -Su
+
|-
 
+
| xbps-install -Su || To both update the package list and upgrade all installed packages
To both update the package list and install a package:
+
|-
# xbps-install -Su package
+
| xbps-install -Su <package> || To both update the package list and install a package
 
+
|-
To remove a package:
+
| xbps-remove -R <package> || To remove a package
# xbps-remove -R package
+
|}
  
 
== *BSD ==
 
== *BSD ==
Line 150: Line 139:
 
=== FreeBSD ===
 
=== FreeBSD ===
  
Speaks for itself (replace ''packagename'' with your actual package name obviously):
+
Speaks for itself:
 
 
To install a package:
 
<code>pkg install ''packagename''</code>
 
 
 
To remove a package:
 
<code>pkg delete ''packagename''</code>
 
 
 
To show a description of the package:
 
<code>pkg info ''packagename''</code>
 
  
To search for a package with a query:
+
{| class="wikitable"
<code>pkg search ''packagename''</code>
+
! command !! description
 
+
|-
To upgrade all installed packages:
+
| pkg install <package> || To install a package
<code>pkg upgrade</code>
+
|-
 
+
| pkg delete <package> || To remove a package
To remove all orphaned packages:
+
|-
<code>pkg autoremove</code>
+
| pkg info <package> ||  To show a description of the package
 +
|-
 +
| pkg search <package> || To search for a package with a query
 +
|-
 +
| pkg upgrade || To upgrade all installed packages
 +
|-
 +
| pkg autoremove || To remove all orphaned packages
 +
|}
  
 
=== OpenBSD ===
 
=== OpenBSD ===
  
To install a package:
+
{| class="wikitable"
# pkg_add package
+
! command !! description
 
+
|-
To remove a package:
+
| pkg_add <package> || To install a package
# pkg_delete package
+
|-
 
+
| pkg_delete <package> || To remove a package
To show a description of a package:
+
|-
$ pkg_info package
+
| pkg_info <package> || To show a description of a package
 +
|}
  
 
== OS X ==
 
== OS X ==
  
On top of the App Store and the [http://www.hack-store.com/ Hack Store], third-party package managers resembling those used by GNU/Linux are available.
+
On top of the App Store and the Hack Store, third-party package managers resembling those used by GNU/Linux are available.
  
 
=== fink ===
 
=== fink ===
Line 193: Line 181:
  
 
=== brew ===
 
=== brew ===
To install a package:
+
{| class="wikitable"
# brew install package
+
! command !! description
 
+
|-
To remove a package:
+
| brew install <package> || To install a package
# brew uninstall package
+
|-
 
+
| brew uninstall <package> || To remove a package
# brew tap repo
+
|-
 
+
| brew tap <repo> || To add a third-party repo
# brew update
+
|-
 
+
| brew update || Update package cache
# brew upgrade
+
|-
 
+
| brew upgrade || upgrade the system
# brew help
+
|-
 +
| brew help || Give help information for using the Brew package manager
 +
|}
  
 
[[Category:Package manager]]
 
[[Category:Package manager]]

Latest revision as of 08:42, 2 September 2023

If you spot that the commands for the package manager of your favourite distribution are incorrect, feel free to add them or fix them in this page.

Package managers are used by some operating systems, namely the BSDs and also GNU Linux to simplify the download, installation and removal of programs in the system. Each GNU Linux distribution family, more or less has a different package manager that they think is the best that they pre-install.

GNU/Linux

apt and dpkg

The combination of dpkg and the Advanced Packaging Tool is used in Debian and most distributions that have spun off from Debian, namely Ubuntu.

Note: All apt-get commands are interchangeable with apt. The two are technically separate packages, but apt is more feature-filled. It has progress-bars, for example
command description
apt-get install <package> Installs a package
apt-get purge <package> removes package (with data)
apt-get remove <package> removes package
apt-get --purge autoremove removes orphaned packages
apt-get update updates package list
apt-get upgrade upgrades packages
apt-get full-upgrade Upgrades the entire system, and the distro
apt-get clean cleans the package-cache
apt-cache search <query> search the package-cache with a query
apt-get build-dep <package> downloads dependencies for building a package per apt instructions

dnf

See page: DNF

Zypper

Zypper is a CLI front end for openSUSE's package manager, libzypp. The RPM package format is used, but the package manager itself is independent from Fedora and Red Hat.

In contrast to many other package managers, zypper does not require the user to update the repository listings manually. The 'update' function actually updates the system (in other words, it does what other package managers refer to as "upgrading".)

Commands may be given in short form as shown below, which can be expanded to their full English form, for example:

  • in - install
  • rm - remove
  • up - update
  • se - search
command description
zypper in <package> installs a package
zypper rm <package> removes a package
zypper up updates package-cache
zypper se <query> searches package-cache
zypper ar <repo> add a third-party repository to the package-cache
zypper rr <repo> remove a third-party repository to the package-cache

portage

Portage is primarily used in the source-based Gentoo and Funtoo distributions, which means that Portage manipulates a ports tree and automates compilation of packages.

command description
emerge --sync To update the ports tree
emerge --update --deep --with-bdeps=y --newuse @world To upgrade installed packages
emerge --search <query> To search for a package with a query
emerge <package> To install (download and compile) a package
emerge --unmerge <package> To remove a package
emerge --pretend <package> To simulate the installation of a package
emerge --fetchonly <package> To only download the source code of a package
emerge --vp <cariable> To check USE flags for a package


slackpkg

slackpkg is Slackware's package manager.

command description
slackpkg install <package> To install a package
slackpkg remove <package> To remove a package
slackpkg search <package> To search for a package with a query
slackpkg upgrade-all To upgrade all installed packages
slackpkg update To update the package list
slackpkg info package To get information on a package

Unofficial packages

The slackpkg repositories are limited to Slackware core packages. Unofficial packages can be downloaded and added with

upgradepkg --install-new <local_package.tgz>

Slackware also supports building packages from source code or from RPM packages with Slackbuild scripts. This gives the security and flexibility of building from source with the ease of package-based management.

To build a Slackbuild, download and extract the Slackbuild tarball, download the source tarball or .rpm file and place it in the Slackbuild directory, cd into the Slackbuild directory, optionally edit the configuration file if one exists, run the PROGRAM_NAME.Slackbuild script like so:

# bash ./package.Slackbuild

After the script finishes, the last line should read "Package /tmp/PACKAGE_NAME.tgz successfuly created" if the compilation succeeded. Install the package like so: upgradepkg --install-new /tmp/package.tgz

pacman

See the pacman page and also yaourt for the pacman wrapper.

xbps

command description
xbps-install -Su To both update the package list and upgrade all installed packages
xbps-install -Su <package> To both update the package list and install a package
xbps-remove -R <package> To remove a package

*BSD

FreeBSD

Speaks for itself:

command description
pkg install <package> To install a package
pkg delete <package> To remove a package
pkg info <package> To show a description of the package
pkg search <package> To search for a package with a query
pkg upgrade To upgrade all installed packages
pkg autoremove To remove all orphaned packages

OpenBSD

command description
pkg_add <package> To install a package
pkg_delete <package> To remove a package
pkg_info <package> To show a description of a package

OS X

On top of the App Store and the Hack Store, third-party package managers resembling those used by GNU/Linux are available.

fink

See the main page.

macports

See the main page.

brew

command description
brew install <package> To install a package
brew uninstall <package> To remove a package
brew tap <repo> To add a third-party repo
brew update Update package cache
brew upgrade upgrade the system
brew help Give help information for using the Brew package manager