working on doc

This commit is contained in:
Jason S. Evans 2016-02-17 13:52:37 +01:00
parent 55ea859441
commit 920b439436
1 changed files with 94 additions and 184 deletions

View File

@ -4,10 +4,39 @@
This guide is intended as a quick reference for the fundamentals of finding, installing, and upgrading packages on a variety of distributions, and should help you translate that knowledge between systems. This guide is intended as a quick reference for the fundamentals of finding, installing, and upgrading packages on a variety of distributions, and should help you translate that knowledge between systems.
==== Audience
For those new to Linux who need a basic understanding of package management.
==== Original version of this doc
The original version of this guide can be found at https://www.digitalocean.com/community/tutorials/package-management-basics-apt-yum-dnf-pkg[Digital Ocean].
==== Revision History
[cols="^,^,^",]
|=============================================================================
|15.1.2016 |v1.0 Converted and edited for TLDP |Jason Evans
|15.2.2016 |v1.1 Changed format to asciidoc and made corrections |Jason Evans
|=============================================================================
==== Contributions
* https://www.digitalocean.com/community/users/bpb[Brennen Bearnes]
(original author).
* http://wiki.tldp.org/Jason%20Evans[Jason Evans] (editor and maintainer for TLDP)
==== Feedback
Missing information, missing links, missing characters? Mail it to the maintainer of this document: jsevans _at_ youvegotthe.info
==== Copyright information
This work is licensed under a https://creativecommons.org/licenses/by-nc-sa/4.0/[Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License].
== Introduction == Introduction
Why was this document written? === Why was this document written?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Most modern Unix-like operating systems offer a centralized mechanism for finding and installing software. Software is usually distributed in the form of packages, kept in repositories. Working with packages is known as package management. Packages provide the basic components of an operating system, along with shared libraries, applications, services, and documentation. Most modern Unix-like operating systems offer a centralized mechanism for finding and installing software. Software is usually distributed in the form of packages, kept in repositories. Working with packages is known as package management. Packages provide the basic components of an operating system, along with shared libraries, applications, services, and documentation.
@ -18,46 +47,7 @@ When configuring servers or development environments, it's often necessary look
rapidly-changing software is concerned. Nevertheless, package management is a vital skill for system administrators and developers, and the wealth of packaged software for major distributions is a tremendous rapidly-changing software is concerned. Nevertheless, package management is a vital skill for system administrators and developers, and the wealth of packaged software for major distributions is a tremendous
resource. resource.
Audience === What do you need?
~~~~~~~~
For those new to Linux who need a basic understanding of package management.
Original version of this doc
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The original version of this guide can be found at
https://www.digitalocean.com/community/tutorials/package-management-basics-apt-yum-dnf-pkg[Digital
Ocean].
Revision History
~~~~~~~~~~~~~~~~
[cols="^,^,^",]
|=============================================================================
|15.1.2016 |v1.0 Converted and edited for TLDP |Jason Evans
|15.2.2016 |v1.1 Changed format to asciidoc and made corrections |Jason Evans
|=============================================================================
Contributions
~~~~~~~~~~~~~
* https://www.digitalocean.com/community/users/bpb[Brennen Bearnes]
(original author).
* http://wiki.tldp.org/Jason%20Evans[Jason Evans] (editor and maintainer for TLDP)
Feedback
~~~~~~~~
Missing information, missing links, missing characters? Mail it to the maintainer of this document: jsevans _at_ youvegotthe.info
Copyright information
~~~~~~~~~~~~~~~~~~~~~
This work is licensed under a https://creativecommons.org/licenses/by-nc-sa/4.0/[Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License].
What do you need?
~~~~~~~~~~~~~~~~~
This guide covers Debian, Ubuntu, CentOS, Fedora, and FreeBSD and will require one of those distributions to be installed This guide covers Debian, Ubuntu, CentOS, Fedora, and FreeBSD and will require one of those distributions to be installed
@ -75,6 +65,7 @@ While their functionality and benefits are broadly similar, packaging formats an
|Ubuntu |.deb |apt, apt-cache, apt-get, dpkg |Ubuntu |.deb |apt, apt-cache, apt-get, dpkg
|CentOS |.rpm |yum |CentOS |.rpm |yum
|Fedora |.rpm |dnf |Fedora |.rpm |dnf
|SuSE |.rpm |zypper
|FreeBSD |Ports, .txz |make, pkg |FreeBSD |Ports, .txz |make, pkg
|=========================================== |===========================================
@ -97,11 +88,12 @@ available.
[cols="^,^",options="header",] [cols="^,^",options="header",]
|========================================= |=========================================
|System |Command |System |Command
|Debian / Ubuntu |`sudo apt-get update` |Debian / Ubuntu |`apt-get update`
|CentOS |`yum check-update` |CentOS |`yum check-update`
|Fedora |`dnf check-update` |Fedora |`dnf check-update`
|FreeBSD Packages |`sudo pkg update` |SuSE |`zypper refresh`
|FreeBSD Ports |`sudo portsnap fetch update` |FreeBSD Packages |`pkg update`
|FreeBSD Ports |`portsnap fetch update`
|========================================= |=========================================
Upgrade Installed Packages Upgrade Installed Packages
@ -121,24 +113,14 @@ read /usr/ports/UPDATING before upgrading with portmaster.
[cols="^,<,^",options="header",] [cols="^,<,^",options="header",]
|======================================================================= |=======================================================================
|System |Command |Notes |System |Command |Notes
|Debian / Ubuntu |`sudo apt-get upgrade` |Only upgrades installed |Debian / Ubuntu |`apt-get upgrade` |Only upgrades installed packages, where possible.
packages, where possible. | |`apt-get dist-upgrade` |May add or remove packages to satisfy new dependencies.
|CentOS |`yum update` |
| |`sudo apt-get dist-upgrade` |May add or remove packages to satisfy new |Fedora |`dnf upgrade` |
dependencies. |SuSE |`zypper update`|
|FreeBSD Packages |`pkg upgrade` |
|CentOS |`sudo yum update` | |FreeBSD Ports |`less /usr/ports/UPDATING` |Uses less to view update notes for ports (use arrow keys to scroll, pressq to quit).
| |`cd /usr/ports/ports-mgmt/portmaster && make install && portmaster -a` |Installs portmaster and uses it to update installed ports.
|Fedora |`sudo dnf upgrade` |
|FreeBSD Packages |`sudo pkg upgrade` |
|FreeBSD Ports |`less /usr/ports/UPDATING` |Uses less to view update notes
for ports (use arrow keys to scroll, pressq to quit).
| |`cd /usr/ports/ports-mgmt/portmaster && sudo make install && sudo
portmaster -a` |Installs portmaster and uses it to update installed
ports.
|======================================================================= |=======================================================================
Find a Package Find a Package
@ -153,194 +135,122 @@ locate a package is to search with command-line tools.
|======================================================================= |=======================================================================
|System |Command |Notes |System |Command |Notes
|Debian / Ubuntu |`apt-cache search search_string` | |Debian / Ubuntu |`apt-cache search search_string` |
|CentOS |`yum search search_string` | |CentOS |`yum search search_string` |
| |`yum search all search_string` |Searches all fields, including description.
| |`yum search all search_string` |Searches all fields, including
description.
|Fedora |`dnf search search_string` | |Fedora |`dnf search search_string` |
| |`dnf search all search_string` |Searches all fields, including description.
| |`dnf search all search_string` |Searches all fields, including |SuSE |`zypper se search_string` |
description.
|FreeBSD Packages |`pkg search search_string` |Searches by name. |FreeBSD Packages |`pkg search search_string` |Searches by name.
| |`pkg search -f search_string` |Searches by name, returning full descriptions.
| |`pkg search -f search_string` |Searches by name, returning full
descriptions.
| |`pkg search -D search_string` |Searches description. | |`pkg search -D search_string` |Searches description.
|FreeBSD Ports |`cd /usr/ports && make search name=package` |Searches by name.
|FreeBSD Ports |`cd /usr/ports && make search name=package` |Searches by | |`cd /usr/ports && make search key=search_string` |Searches comments, descriptions, and dependencies.
name.
| |`cd /usr/ports && make search key=search_string` |Searches comments,
descriptions, and dependencies.
|======================================================================= |=======================================================================
View Info About a Specific Package View Info About a Specific Package
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When deciding what to install, it's often helpful to read detailed When deciding what to install, it's often helpful to read detailed descriptions of packages. Along with human-readable text, these often include metadata like version numbers and a list of the package's dependencies.
descriptions of packages. Along with human-readable text, these often
include metadata like version numbers and a list of the package's
dependencies.
[cols="^,<,^",options="header",] [cols="^,<,^",options="header",]
|======================================================================= |=======================================================================
|System |Command |Notes |System |Command |Notes
|Debian / Ubuntu |`apt-cache show package` |Shows locally-cached info |Debian / Ubuntu |`apt-cache show package` |Shows locally-cached info about a package.
about a package.
| |`dpkg -s package` |Shows the current installed status of a package. | |`dpkg -s package` |Shows the current installed status of a package.
|CentOS |`yum info package` | |CentOS |`yum info package` |
| |`yum deplist package` |Lists dependencies for a package. | |`yum deplist package` |Lists dependencies for a package.
|Fedora |`dnf info package` | |Fedora |`dnf info package` |
| |`dnf repoquery -\/-requires package` |Lists dependencies for a package. | |`dnf repoquery -\/-requires package` |Lists dependencies for a package.
|SuSE|`zypper info search_string` |Lists dependencies for a package.
|FreeBSD Packages |`pkg info package` |Shows info for an installed |FreeBSD Packages |`pkg info package` |Shows info for an installed package.
package.
|FreeBSD Ports |`cd /usr/ports/category/port && cat pkg-descr` | |FreeBSD Ports |`cd /usr/ports/category/port && cat pkg-descr` |
|======================================================================= |=======================================================================
Install a Package from Repositories Install a Package from Repositories
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Once you know the name of a package, you can usually install it and its Once you know the name of a package, you can usually install it and its dependencies with a single command. In general, you can supply multiple packages to install simply by listing them all.
dependencies with a single command. In general, you can supply multiple
packages to install simply by listing them all.
[cols="^,<,^",options="header",] [cols="^,<,^",options="header",]
|======================================================================= |=======================================================================
|System |Command |Notes |System |Command |Notes
|Debian / Ubuntu |`sudo apt-get install package` | |Debian / Ubuntu |`apt-get install package` |
| |`apt-get install package1 package2 ...` |Installs all listed packages.
| |`sudo apt-get install package1 package2 ...` |Installs all listed | |`apt-get install -y package` |Assumes "yes" where apt would usually prompt to continue.
packages. |CentOS |`yum install package` |
| |`yum install package1 package2 ...` |Installs all listed packages.
| |`sudo apt-get install -y package` |Assumes "yes" where apt would | |`yum install -y package` |Assumes "yes" where yum would usually prompt to continue.
usually prompt to continue. |Fedora |`dnf install package` |
| |`dnf install package1 package2 ...` |Installs all listed packages.
|CentOS |`sudo yum install package` | | |dnf install -y package |Assumes "yes" where dnf would usually prompt to continue.
|SuSE|`zypper install`|
| |`sudo yum install package1 package2 ...` |Installs all listed packages. |FreeBSD Packages |`pkg install package` |
| |`pkg install package1 package2 ...` |Installs all listed packages.
| |`sudo yum install -y package` |Assumes "yes" where yum would usually |FreeBSD Ports |`cd /usr/ports/category/port && make install` |Builds and installs a port from source.
prompt to continue.
|Fedora |`sudo dnf install package` |
| |`sudo dnf install package1 package2 ...` |Installs all listed packages.
| |sudo dnf install -y package |Assumes "yes" where dnf would usually
prompt to continue.
|FreeBSD Packages |`sudo pkg install package` |
| |`sudo pkg install package1 package2 ...` |Installs all listed packages.
|FreeBSD Ports |`cd /usr/ports/category/port && sudo make install` |Builds
and installs a port from source.
|======================================================================= |=======================================================================
Install a Package from the Local Filesystem Install a Package from the Local Filesystem
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sometimes, even though software isn't officially packaged for a given Sometimes, even though software isn't officially packaged for a given operating system, a developer or vendor will offer package files for download. You can usually retrieve these with your web browser, or viacurl on the command line. Once a package is on the target system, it can often be installed with a single command.
operating system, a developer or vendor will offer package files for
download. You can usually retrieve these with your web browser, or
viacurl on the command line. Once a package is on the target system, it
can often be installed with a single command.
On Debian-derived systems, dpkg handles individual package files. If a On Debian-derived systems, dpkg handles individual package files. If a package has unmet dependencies, gdebi can often be used to retrieve them from official repositories.
package has unmet dependencies, gdebi can often be used to retrieve them
from official repositories.
On CentOS and Fedora systems, yum and dnf are used to install individual On CentOS and Fedora systems, yum and dnf are used to install individual files, and will also handle needed dependencies.
files, and will also handle needed dependencies.
[cols="^,<,^",options="header",] [cols="^,<,^",options="header",]
|======================================================================= |=======================================================================
|System |Command |Notes |System |Command |Notes
|Debian / Ubuntu |`sudo dpkg -i package.deb` | |Debian / Ubuntu |`dpkg -i package.deb` |
| |`apt-get install -yg debi && gdebi package.deb` |Installs and uses gdebi to install package.deb and retrieve any missing dependencies.
| |`sudo apt-get install -yg debi && sudo gdebi package.deb` |Installs and |CentOS |`yum install package.rpm` |
uses gdebi to install package.deb and retrieve any missing dependencies. |Fedora |`dnf install package.rpm` |
|SuSE|`zypper install package.rpm`|
|CentOS |`sudo yum install package.rpm` | |FreeBSD Packages |`pkg add package.txz` |
| |`pkg add -f package.txz` |Installs package even if already installed.
|Fedora |`sudo dnf install package.rpm` |
|FreeBSD Packages |`sudo pkg add package.txz` |
| |`sudo pkg add -f package.txz` |Installs package even if already
installed.
|======================================================================= |=======================================================================
Remove One or More Installed Packages Remove One or More Installed Packages
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Since a package manager knows what files are provided by a given Since a package manager knows what files are provided by a given package, it can usually remove them cleanly from a system if the software is no longer needed.
package, it can usually remove them cleanly from a system if the
software is no longer needed.
[cols="^,<,^",options="header",] [cols="^,<,^",options="header",]
|======================================================================= |=======================================================================
|System |Command |Notes |System |Command |Notes
|Debian / Ubuntu |`sudo apt-get remove package` | |Debian / Ubuntu |`apt-get remove package` |
| |`apt-get autoremove` |Removes unneeded packages.|
| |`sudo apt-get autoremove` |Removes unneeded packages.| |CentOS |`yum remove package` |
|Fedora |`dnf erase package` |
|CentOS |`sudo yum remove package` | |FreeBSD Packages |`pkg delete package` |
| |`pkg autoremove` |Removes unneeded packages.
|Fedora |`sudo dnf erase package` | |SuSE|`zypper rm package`|
|FreeBSD Ports |`pkg delete package` |
|FreeBSD Packages |`sudo pkg delete package` | | |`cd /usr/ports/path_to_port && make deinstall` |De-installs an installed port.
| |`sudo pkg autoremove` |Removes unneeded packages.
|FreeBSD Ports |`sudo pkg delete package` |
| |`cd /usr/ports/path_to_port && make deinstall` |De-installs an
installed port.
|======================================================================= |=======================================================================
Get Help Get Help
~~~~~~~~ ~~~~~~~~
In addition to web-based documentation, keep in mind that Unix manual In addition to web-based documentation, keep in mind that Unix manual pages (usually referred to as man pages) are available for most commands from the shell. To read a page, use man:
pages (usually referred to as man pages) are available for most commands
from the shell. To read a page, use man:
---------- ----------
$ man page $ man page
---------- ----------
In man, you can navigate with the arrow keys. Press / to search for text In man, you can navigate with the arrow keys. Press / to search for text within the page, and q to quit.
within the page, and q to quit.
[cols="^,<,^",options="header",] [cols="^,<,^",options="header",]
|======================================================================= |=======================================================================
|System |Command |Notes |System |Command |Notes
|Debian / Ubuntu |`man apt-get` |Updating the local package database and |Debian / Ubuntu |`man apt-get` |Updating the local package database and working with packages.
working with packages.
| |`man apt-cache` |Querying the local package database. | |`man apt-cache` |Querying the local package database.
| |`man dpkg` |Working with individual package files and querying | |`man dpkg` |Working with individual package files and querying
installed packages. installed packages.
|CentOS |`man yum` | |CentOS |`man yum` |
|Fedora |`man dnf` | |Fedora |`man dnf` |
|SuSE|`man zypper`|
|FreeBSD Packages |`man pkg` |Working with pre-compiled binary packages. |FreeBSD Packages |`man pkg` |Working with pre-compiled binary packages.
|FreeBSD Ports |`man ports` |Working with the Ports Collection. |FreeBSD Ports |`man ports` |Working with the Ports Collection.
|======================================================================= |=======================================================================
@ -366,4 +276,4 @@ guide] covers FreeBSD package management using pkg.
5. The https://www.freebsd.org/doc/handbook/[FreeBSD Handbook] contains 5. The https://www.freebsd.org/doc/handbook/[FreeBSD Handbook] contains
a https://www.freebsd.org/doc/handbook/ports-using.html[section on using a https://www.freebsd.org/doc/handbook/ports-using.html[section on using
the Ports Collection]. the Ports Collection].
6. http://doc.opensuse.org/documentation/html/openSUSE_114/opensuse-reference/cha.sw_cl.html[OpenSuSE documentation for Zypper]