We are still actively working on the spam issue.

Package manager

From InstallGentoo Wiki
Revision as of 07:49, 30 March 2019 by Se7en1 (talk | contribs) (Fulfill cleanup request four years later...)
Jump to: navigation, search

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 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.

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

{{ class="wikitable" ! 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

{{ class="wikitable" ! 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.

To update the ports tree:

# emerge --sync

To upgrade installed packages:

# emerge --update --deep --with-bdeps=y --newuse @world

To search for a package with a query:

# emerge --search query

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> 

slackpkg

slackpkg is Slackware's package manager.

To install a package:

# slackpkg install package

To remove a package:

# slackpkg remove package

To search for a package with a query:

# slackpkg search package

To upgrade all installed packages:

# slackpkg upgrade-all

To update the package list:

# slackpkg update

To get information on a package:

# slackpkg info 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

To both update the package list and upgrade all installed packages:

# xbps-install -Su

To both update the package list and install a package:

# xbps-install -Su package

To remove a package:

# xbps-remove -R package

*BSD

FreeBSD

Speaks for itself (replace packagename with your actual package name obviously):

To install a package: pkg install packagename

To remove a package: pkg delete packagename

To show a description of the package: pkg info packagename

To search for a package with a query: pkg search packagename

To upgrade all installed packages: pkg upgrade

To remove all orphaned packages: pkg autoremove

OpenBSD

To install a package:

# pkg_add package

To remove a package:

# pkg_delete package

To show a description of a package:

$ pkg_info 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

To install a package:

# brew install package

To remove a package:

# brew uninstall package
# brew tap repo
# brew update
# brew upgrade
# brew help