diff --git a/LDP/howto/docbook/Package-Management-Basics-HOWTO/Package Management Basics.lyx b/LDP/howto/docbook/Package-Management-Basics-HOWTO/Package Management Basics.lyx deleted file mode 100644 index 77761655..00000000 --- a/LDP/howto/docbook/Package-Management-Basics-HOWTO/Package Management Basics.lyx +++ /dev/null @@ -1,3210 +0,0 @@ -#LyX 2.1 created this file. For more info see http://www.lyx.org/ -\lyxformat 474 -\begin_document -\begin_header -\textclass docbook -\use_default_options false -\maintain_unincluded_children false -\language english -\language_package none -\inputencoding auto -\fontencoding default -\font_roman default -\font_sans default -\font_typewriter default -\font_math auto -\font_default_family default -\use_non_tex_fonts false -\font_sc false -\font_osf false -\font_sf_scale 100 -\font_tt_scale 100 -\graphics default -\default_output_format default -\output_sync 0 -\bibtex_command default -\index_command default -\paperfontsize default -\spacing single -\use_hyperref false -\papersize default -\use_geometry false -\use_package amsmath 1 -\use_package amssymb 0 -\use_package cancel 0 -\use_package esint 1 -\use_package mathdots 0 -\use_package mathtools 0 -\use_package mhchem 0 -\use_package stackrel 0 -\use_package stmaryrd 0 -\use_package undertilde 0 -\cite_engine basic -\cite_engine_type default -\biblio_style plain -\use_bibtopic false -\use_indices false -\paperorientation portrait -\suppress_date false -\justification true -\use_refstyle 0 -\index Index -\shortcut idx -\color #008000 -\end_index -\secnumdepth 3 -\tocdepth 3 -\paragraph_separation indent -\paragraph_indentation default -\quotes_language english -\papercolumns 1 -\papersides 1 -\paperpagestyle default -\tracking_changes false -\output_changes false -\html_math_output 0 -\html_css_as_file 0 -\html_be_strict false -\end_header - -\begin_body - -\begin_layout Title -Package Management Basics: apt, yum, dnf, pkg -\end_layout - -\begin_layout Section -Introduction -\end_layout - -\begin_layout Subsection -Why was this document written? -\end_layout - -\begin_layout Standard -Most modern Unix-like operating systems offer a centralized mechanism for - finding and installing software. - Software is usually distributed in the form of -\begin_inset space ~ -\end_inset - -packages, kept in -\begin_inset space ~ -\end_inset - -repositories. - Working with packages is known as -\begin_inset space ~ -\end_inset - -package management. - Packages provide the basic components of an operating system, along with - shared libraries, applications, services, and documentation. -\end_layout - -\begin_layout Standard -A package management system does much more than one-time installation of - software. - It also provides tools for upgrading already-installed packages. - Package repositories help to ensure that code has been vetted for use on - your system, and that the installed versions of software have been approved - by developers and package maintainers. -\end_layout - -\begin_layout Standard -When configuring servers or development environments, it's often necessary - look beyond official repositories. - Packages in the stable release of a distribution may be out of date, especially - where new or 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. -\end_layout - -\begin_layout Standard -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. -\end_layout - -\begin_layout Subsection -Audience -\end_layout - -\begin_layout Standard -For those new to Linux who need a basic understanding of package management. -\end_layout - -\begin_layout Subsection -Original version of this doc -\end_layout - -\begin_layout Standard -The original version of this guide can be found at -\begin_inset CommandInset href -LatexCommand href -name "Digital Ocean" -target "https://www.digitalocean.com/community/tutorials/package-management-basics-apt-yum-dnf-pkg" - -\end_inset - -. -\end_layout - -\begin_layout Subsection -Revision History -\end_layout - -\begin_layout Standard -\begin_inset Tabular - - - - - - - -\begin_inset Text - -\begin_layout Plain Layout -15.1.2016 -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -v1.0 converted and edited for TLDP -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Jason Evans -\end_layout - -\end_inset - - - - -\end_inset - - -\end_layout - -\begin_layout Subsection -Contributions -\end_layout - -\begin_layout Itemize -\begin_inset CommandInset href -LatexCommand href -name "Brennen Bearnes" -target "https://www.digitalocean.com/community/users/bpb" - -\end_inset - -(original author). -\end_layout - -\begin_layout Itemize -\begin_inset CommandInset href -LatexCommand href -name "Jason Evans" -target "http://wiki.tldp.org/Jason%20Evans" - -\end_inset - -(editor and maintainer for TLDP) -\end_layout - -\begin_layout Subsection -Feedback -\end_layout - -\begin_layout Standard -Missing information, missing links, missing characters? Mail it to the maintaine -r of this document: -\begin_inset CommandInset href -LatexCommand href -name "jsevans at youvegotthe.info" -target "jsevans at youvegotthe.info" -type "mailto:" - -\end_inset - - -\end_layout - -\begin_layout Subsection -Copyright information -\end_layout - -\begin_layout Standard -This work is licensed under a -\begin_inset CommandInset href -LatexCommand href -name "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License" -target "https://creativecommons.org/licenses/by-nc-sa/4.0/" - -\end_inset - -. -\end_layout - -\begin_layout Subsection -What do you need? -\end_layout - -\begin_layout Standard -This guide covers Debian, Ubuntu, CentOS, Fedora, and FreeBSD and will require - one of those distributions to be installed -\end_layout - -\begin_layout Section -Package Management Systems: A Brief Overview -\end_layout - -\begin_layout Standard -Most package systems are built around collections of package files. - A package file is usually an archive which contains compiled binaries and - other resources making up the software, along with installation scripts. - Packages also contain valuable metadata, including their -\begin_inset space ~ -\end_inset - -dependencies, a list of other packages required to install and run them. -\end_layout - -\begin_layout Standard -While their functionality and benefits are broadly similar, packaging formats - and tools vary by platform: -\end_layout - -\begin_layout Standard -\begin_inset Tabular - - - - - - - -\begin_inset Text - -\begin_layout Plain Layout -Operating System -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Format -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Tool(s) -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -Debian -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -.deb -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -apt, apt-cache, apt-get, dpkg -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -Ubuntu -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -.deb -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -apt, apt-cache, apt-get, dpkg -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -CentOS -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -.rpm -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -yum -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -Fedora -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -.rpm -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -dnf -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -FreeBSD -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Ports, -\begin_inset space ~ -\end_inset - -.txz -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -make, pkg -\end_layout - -\end_inset - - - - -\end_inset - - -\end_layout - -\begin_layout Standard -In Debian and systems based on it, like Ubuntu, Linux Mint, and Raspbian, - the package format is the -\begin_inset space ~ -\end_inset - -.debfile. - APT, the Advanced Packaging Tool, provides commands used for most common - operations: Searching repositories, installing collections of packages - and their dependencies, and managing upgrades. - APT commands operate as a front-end to the lower-level -\begin_inset space ~ -\end_inset - -dpkg -\begin_inset space ~ -\end_inset - -utility, which handles the installation of individual -\begin_inset space ~ -\end_inset - -.deb -\begin_inset space ~ -\end_inset - -files on the local system, and is sometimes invoked directly. -\end_layout - -\begin_layout Standard -CentOS, Fedora, and other members of the Red Hat family use RPM files. - In CentOS, -\begin_inset space ~ -\end_inset - -yum -\begin_inset space ~ -\end_inset - -is used to interact with both individual package files and repositories. -\end_layout - -\begin_layout Standard -In recent versions of Fedora, -\begin_inset space ~ -\end_inset - -yum -\begin_inset space ~ -\end_inset - -has been supplanted by -\begin_inset space ~ -\end_inset - -dnf, a modernized fork which retains most ofyum's interface. -\end_layout - -\begin_layout Standard -FreeBSD's binary package system is administered with the -\begin_inset space ~ -\end_inset - -pkg -\begin_inset space ~ -\end_inset - -command. - FreeBSD also offers the Ports Collection, a local directory structure and - tools which allow the user to fetch, compile, and install packages directly - from source using Makefiles. - It's usually much more convenient to use -\begin_inset space ~ -\end_inset - -pkg, but occasionally a pre-compiled package is unavailable, or you may - need to change compile-time options. -\end_layout - -\begin_layout Subsection -Update Package Lists -\end_layout - -\begin_layout Standard -Most systems keep a local database of the packages available from remote - repositories. - It's best to update this database before installing or upgrading packages. - As a partial exception to this pattern, -\begin_inset space ~ -\end_inset - -yumand -\begin_inset space ~ -\end_inset - -dnf -\begin_inset space ~ -\end_inset - -will check for updates before performing some operations, but you can ask - them at any time whether updates are available. -\end_layout - -\begin_layout Standard -\begin_inset Tabular - - - - - - -\begin_inset Text - -\begin_layout Plain Layout -System -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Command -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -Debian / Ubuntu -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo apt-get update -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -CentOS -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -yum check-update -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -Fedora -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -dnf check-update -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -FreeBSD Packages -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo pkg update -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -FreeBSD Ports -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo portsnap fetch update -\end_layout - -\end_inset - - - - -\end_inset - - -\end_layout - -\begin_layout Subsection -Upgrade Installed Packages -\end_layout - -\begin_layout Standard -Making sure that all of the installed software on a machine stays up to - date would be an enormous undertaking without a package system. - You would have to track upstream changes and security alerts for hundreds - of different packages. - While a package manager doesn't solve every problem you'll encounter when - upgrading software, it does enable you to maintain most system components - with a few commands. -\end_layout - -\begin_layout Standard -On FreeBSD, upgrading installed ports can introduce breaking changes or - require manual configuration steps. - It's best to read -\begin_inset space ~ -\end_inset - -/usr/ports/UPDATING -\begin_inset space ~ -\end_inset - -before upgrading with -\begin_inset space ~ -\end_inset - -portmaster. -\end_layout - -\begin_layout Standard -\begin_inset Tabular - - - - - - - -\begin_inset Text - -\begin_layout Plain Layout -System -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Command -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Notes -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -Debian / Ubuntu -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo apt-get upgrade -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Only upgrades installed packages, where possible. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo apt-get dist-upgrade -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -May add or remove packages to satisfy new dependencies. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -CentOS -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo yum update -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -Fedora -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo dnf upgrade -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -FreeBSD Packages -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo pkg upgrade -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -FreeBSD Ports -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -less /usr/ports/UPDATING -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Uses -\begin_inset space ~ -\end_inset - -less -\begin_inset space ~ -\end_inset - -to view update notes for ports (use arrow keys to scroll, pressq -\begin_inset space ~ -\end_inset - -to quit). -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -cd /usr/ports/ports-mgmt/portmaster && sudo make install && sudo portmaster - -a -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Installs -\begin_inset space ~ -\end_inset - -portmaster -\begin_inset space ~ -\end_inset - -and uses it to update installed ports. -\end_layout - -\end_inset - - - - -\end_inset - - -\end_layout - -\begin_layout Subsection -Find a Package -\end_layout - -\begin_layout Standard -Most distributions offer a graphical or menu-driven front end to package - collections. - These can be a good way to browse by category and discover new software. - Often, however, the quickest and most effective way to locate a package - is to search with command-line tools. -\end_layout - -\begin_layout Standard -\begin_inset Tabular - - - - - - - -\begin_inset Text - -\begin_layout Plain Layout -System -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Command -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Notes -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -Debian / Ubuntu -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -apt-cache search -\begin_inset space ~ -\end_inset - -search_string -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -CentOS -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -yum search -\begin_inset space ~ -\end_inset - -search_string -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -yum search all -\begin_inset space ~ -\end_inset - -search_string -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Searches all fields, including description. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -Fedora -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -dnf search -\begin_inset space ~ -\end_inset - -search_string -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -dnf search all -\begin_inset space ~ -\end_inset - -search_string -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Searches all fields, including description. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -FreeBSD Packages -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -pkg search -\begin_inset space ~ -\end_inset - -search_string -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Searches by name. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -pkg search -f -\begin_inset space ~ -\end_inset - -search_string -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Searches by name, returning full descriptions. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -pkg search -D -\begin_inset space ~ -\end_inset - -search_string -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Searches description. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -FreeBSD Ports -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -cd /usr/ports && make search name=package -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Searches by name. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -cd /usr/ports && make search key=search_string -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Searches comments, descriptions, and dependencies. -\end_layout - -\end_inset - - - - -\end_inset - - -\end_layout - -\begin_layout Subsection -View Info About a Specific Package -\end_layout - -\begin_layout Standard -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. -\end_layout - -\begin_layout Standard -\begin_inset Tabular - - - - - - - -\begin_inset Text - -\begin_layout Plain Layout -System -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Command -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Notes -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -Debian / Ubuntu -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -apt-cache show -\begin_inset space ~ -\end_inset - -package -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Shows locally-cached info about a package. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -dpkg -s -\begin_inset space ~ -\end_inset - -package -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Shows the current installed status of a package. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -CentOS -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -yum info -\begin_inset space ~ -\end_inset - -package -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -yum deplist -\begin_inset space ~ -\end_inset - -package -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Lists dependencies for a package. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -Fedora -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -dnf info -\begin_inset space ~ -\end_inset - -package -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -dnf repoquery - -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - - -\backslash -/ -\end_layout - -\end_inset - --requires -\begin_inset space ~ -\end_inset - -package -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Lists dependencies for a package. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -FreeBSD Packages -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -pkg info -\begin_inset space ~ -\end_inset - -package -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Shows info for an installed package. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -FreeBSD Ports -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -cd /usr/ports/category/port -\begin_inset space ~ -\end_inset - -&& cat pkg-descr -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\end_inset - - -\end_layout - -\begin_layout Subsection -Install a Package from Repositories -\end_layout - -\begin_layout Standard -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. -\end_layout - -\begin_layout Standard -\begin_inset Tabular - - - - - - - -\begin_inset Text - -\begin_layout Plain Layout -System -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Command -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Notes -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -Debian / Ubuntu -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo apt-get install -\begin_inset space ~ -\end_inset - -package -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo apt-get install -\begin_inset space ~ -\end_inset - -package1 package2 ... - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Installs all listed packages. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo apt-get install -y -\begin_inset space ~ -\end_inset - -package -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Assumes "yes" where -\begin_inset space ~ -\end_inset - -apt -\begin_inset space ~ -\end_inset - -would usually prompt to continue. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -CentOS -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo yum install -\begin_inset space ~ -\end_inset - -package -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo yum install -\begin_inset space ~ -\end_inset - -package1 package2 ... - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Installs all listed packages. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo yum install -y -\begin_inset space ~ -\end_inset - -package -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Assumes "yes" where -\begin_inset space ~ -\end_inset - -yum -\begin_inset space ~ -\end_inset - -would usually prompt to continue. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -Fedora -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo dnf install -\begin_inset space ~ -\end_inset - -package -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo dnf install -\begin_inset space ~ -\end_inset - -package1 package2 ... - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Installs all listed packages. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo dnf install -y -\begin_inset space ~ -\end_inset - -package -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Assumes "yes" where -\begin_inset space ~ -\end_inset - -dnf -\begin_inset space ~ -\end_inset - -would usually prompt to continue. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -FreeBSD Packages -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo pkg install -\begin_inset space ~ -\end_inset - -package -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo pkg install -\begin_inset space ~ -\end_inset - -package1 package2 ... - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Installs all listed packages. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -FreeBSD Ports -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -cd /usr/ports/category/port -\begin_inset space ~ -\end_inset - -&& sudo make install -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Builds and installs a port from source. -\end_layout - -\end_inset - - - - -\end_inset - - -\end_layout - -\begin_layout Subsection -Install a Package from the Local Filesystem -\end_layout - -\begin_layout Standard -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 -\begin_inset space ~ -\end_inset - -on the command line. - Once a package is on the target system, it can often be installed with - a single command. -\end_layout - -\begin_layout Standard -On Debian-derived systems, -\begin_inset space ~ -\end_inset - -dpkg -\begin_inset space ~ -\end_inset - -handles individual package files. - If a package has unmet dependencies, -\begin_inset space ~ -\end_inset - -gdebi -\begin_inset space ~ -\end_inset - -can often be used to retrieve them from official repositories. -\end_layout - -\begin_layout Standard -On CentOS and Fedora systems, -\begin_inset space ~ -\end_inset - -yum -\begin_inset space ~ -\end_inset - -and -\begin_inset space ~ -\end_inset - -dnf -\begin_inset space ~ -\end_inset - -are used to install individual files, and will also handle needed dependencies. -\end_layout - -\begin_layout Standard -\begin_inset Tabular - - - - - - - -\begin_inset Text - -\begin_layout Plain Layout -System -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Command -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Notes -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -Debian / Ubuntu -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo dpkg -i -\begin_inset space ~ -\end_inset - -package.deb -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo apt-get install -ygdebi && sudo gdebipackage.deb -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Installs and uses gdebi to install package.deb and retrieve any missing dependenc -ies. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -CentOS -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo yum install -\begin_inset space ~ -\end_inset - -package.rpm -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -Fedora -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo dnf install -\begin_inset space ~ -\end_inset - -package.rpm -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -FreeBSD Packages -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo pkg add -\begin_inset space ~ -\end_inset - -package.txz -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo pkg add -f -\begin_inset space ~ -\end_inset - -package.txz -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Installs package even if already installed. -\end_layout - -\end_inset - - - - -\end_inset - - -\end_layout - -\begin_layout Subsection -Remove One or More Installed Packages -\end_layout - -\begin_layout Standard -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. -\end_layout - -\begin_layout Standard -\begin_inset Tabular - - - - - - - -\begin_inset Text - -\begin_layout Plain Layout -System -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Command -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Notes -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -Debian / Ubuntu -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo apt-get remove -\begin_inset space ~ -\end_inset - -package -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo apt-get autoremove -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Removes unneeded packages. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -CentOS -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo yum remove -\begin_inset space ~ -\end_inset - -package -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -Fedora -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo dnf erase -\begin_inset space ~ -\end_inset - -package -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -FreeBSD Packages -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo pkg delete -\begin_inset space ~ -\end_inset - -package -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo pkg autoremove -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Removes unneeded packages. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -FreeBSD Ports -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -sudo pkg delete -\begin_inset space ~ -\end_inset - -package -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -cd /usr/ports/path_to_port -\begin_inset space ~ -\end_inset - -&& make deinstall -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -De-installs an installed port. -\end_layout - -\end_inset - - - - -\end_inset - - -\end_layout - -\begin_layout Subsection -Get Help -\end_layout - -\begin_layout Standard -In addition to web-based documentation, keep in mind that Unix manual pages - (usually referred to as -\begin_inset space ~ -\end_inset - -man pages) are available for most commands from the shell. - To read a page, use man: -\end_layout - -\begin_layout Code -$ man page -\end_layout - -\begin_layout Standard -In -\begin_inset space \space{} -\end_inset - -man, you can navigate with the arrow keys. - Press / to search for text within the page, and q to quit. -\end_layout - -\begin_layout Standard -\begin_inset Tabular - - - - - - - -\begin_inset Text - -\begin_layout Plain Layout -System -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Command -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Notes -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -Debian / Ubuntu -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -man apt-get -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Updating the local package database and working with packages. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -man apt-cache -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Querying the local package database. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -man dpkg -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Working with individual package files and querying installed packages. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -CentOS -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -man yum -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -Fedora -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -man dnf -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -FreeBSD Packages -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -man pkg -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Working with pre-compiled binary packages. -\end_layout - -\end_inset - - - - -\begin_inset Text - -\begin_layout Plain Layout -FreeBSD Ports -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -man ports -\end_layout - -\end_inset - - -\begin_inset Text - -\begin_layout Plain Layout -Working with the Ports Collection. -\end_layout - -\end_inset - - - - -\end_inset - - -\end_layout - -\begin_layout Section -Conclusion and Further Reading -\end_layout - -\begin_layout Standard -This guide provides an overview of basic operations that can be cross-referenced - between systems, but only scratches the surface of a complex topic. - For greater detail on a given system, you can consult the following resources: -\end_layout - -\begin_layout Enumerate -\begin_inset CommandInset href -LatexCommand href -name "This guide" -target "https://www.digitalocean.com/community/tutorials/ubuntu-and-debian-package-management-essentials" - -\end_inset - - covers Ubuntu and Debian package management in detail. - -\end_layout - -\begin_layout Enumerate -There's an -\begin_inset CommandInset href -LatexCommand href -name "official CentOS guide to managing software with~" -target "https://www.centos.org/docs/5/html/yum/" - -\end_inset - - -\begin_inset CommandInset href -LatexCommand href -name "yum" -target "https://www.centos.org/docs/5/html/yum/" - -\end_inset - -. - -\end_layout - -\begin_layout Enumerate -There's a -\begin_inset CommandInset href -LatexCommand href -name "Fedora wiki page about~" -target "https://fedoraproject.org/wiki/Dnf" - -\end_inset - - -\begin_inset CommandInset href -LatexCommand href -name "dnf" -target "https://fedoraproject.org/wiki/Dnf" - -\end_inset - -, and an -\begin_inset CommandInset href -LatexCommand href -name "official manual for~" -target "https://dnf.readthedocs.org/en/latest/index.html" - -\end_inset - - -\begin_inset CommandInset href -LatexCommand href -name "dnf" -target "https://dnf.readthedocs.org/en/latest/index.html" - -\end_inset - - -\begin_inset CommandInset href -LatexCommand href -name "~itself" -target "https://dnf.readthedocs.org/en/latest/index.html" - -\end_inset - -. - -\end_layout - -\begin_layout Enumerate -\begin_inset CommandInset href -LatexCommand href -name "This guide" -target "https://www.digitalocean.com/community/tutorials/how-to-manage-packages-on-freebsd-10-1-with-pkg" - -\end_inset - - covers FreeBSD package management using pkg. - -\end_layout - -\begin_layout Enumerate -The -\begin_inset CommandInset href -LatexCommand href -name "FreeBSD Handbook" -target "https://www.freebsd.org/doc/handbook/" - -\end_inset - - -\begin_inset space ~ -\end_inset - -contains a -\begin_inset space ~ -\end_inset - - -\begin_inset CommandInset href -LatexCommand href -name "section on using the Ports Collection" -target "https://www.freebsd.org/doc/handbook/ports-using.html" - -\end_inset - -. - -\end_layout - -\end_body -\end_document diff --git a/LDP/howto/docbook/Package-Management-Basics-HOWTO/Package Management Basics.xml b/LDP/howto/docbook/Package-Management-Basics-HOWTO/Package Management Basics.xml deleted file mode 100644 index ed8111e5..00000000 --- a/LDP/howto/docbook/Package-Management-Basics-HOWTO/Package Management Basics.xml +++ /dev/null @@ -1,532 +0,0 @@ - - - - -
- -Package Management Basics: apt, yum, dnf, pkg - -Introduction - -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. -A package management system does much more than one-time installation of software. It also provides tools for upgrading already-installed packages. Package repositories help to ensure that code has been vetted for use on your system, and that the installed versions of software have been approved by developers and package maintainers. -When configuring servers or development environments, it's often necessary look beyond official repositories. Packages in the stable release of a distribution may be out of date, especially where new or 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. -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 Digital Ocean. -Revision History - - - - - - -15.1.2016 -v1.0 converted and edited for TLDP -Jason Evans - - - -Contributions - -Brennen Bearnes(original author).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 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 -Package Management Systems: A Brief Overview -Most package systems are built around collections of package files. A package file is usually an archive which contains compiled binaries and other resources making up the software, along with installation scripts. Packages also contain valuable metadata, including their dependencies, a list of other packages required to install and run them. -While their functionality and benefits are broadly similar, packaging formats and tools vary by platform: - - - - - - -Operating System -Format -Tool(s) - - - - -Debian -.deb -apt, apt-cache, apt-get, dpkg - - -Ubuntu -.deb -apt, apt-cache, apt-get, dpkg - - -CentOS -.rpm -yum - - -Fedora -.rpm -dnf - - -FreeBSD -Ports, .txz -make, pkg - - - -In Debian and systems based on it, like Ubuntu, Linux Mint, and Raspbian, the package format is the .debfile. APT, the Advanced Packaging Tool, provides commands used for most common operations: Searching repositories, installing collections of packages and their dependencies, and managing upgrades. APT commands operate as a front-end to the lower-level dpkg utility, which handles the installation of individual .deb files on the local system, and is sometimes invoked directly. -CentOS, Fedora, and other members of the Red Hat family use RPM files. In CentOS, yum is used to interact with both individual package files and repositories. -In recent versions of Fedora, yum has been supplanted by dnf, a modernized fork which retains most ofyum's interface. -FreeBSD's binary package system is administered with the pkg command. FreeBSD also offers the Ports Collection, a local directory structure and tools which allow the user to fetch, compile, and install packages directly from source using Makefiles. It's usually much more convenient to use pkg, but occasionally a pre-compiled package is unavailable, or you may need to change compile-time options. -Update Package Lists -Most systems keep a local database of the packages available from remote repositories. It's best to update this database before installing or upgrading packages. As a partial exception to this pattern, yumand dnf will check for updates before performing some operations, but you can ask them at any time whether updates are available. - - - - - -System -Command - - - - -Debian / Ubuntu -sudo apt-get update - - -CentOS -yum check-update - - -Fedora -dnf check-update - - -FreeBSD Packages -sudo pkg update - - -FreeBSD Ports -sudo portsnap fetch update - - - -Upgrade Installed Packages -Making sure that all of the installed software on a machine stays up to date would be an enormous undertaking without a package system. You would have to track upstream changes and security alerts for hundreds of different packages. While a package manager doesn't solve every problem you'll encounter when upgrading software, it does enable you to maintain most system components with a few commands. -On FreeBSD, upgrading installed ports can introduce breaking changes or require manual configuration steps. It's best to read /usr/ports/UPDATING before upgrading with portmaster. - - - - - - -System -Command -Notes - - - - -Debian / Ubuntu -sudo apt-get upgrade -Only upgrades installed packages, where possible. - - - -sudo apt-get dist-upgrade -May add or remove packages to satisfy new dependencies. - - -CentOS -sudo yum update - - - -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 -Most distributions offer a graphical or menu-driven front end to package collections. These can be a good way to browse by category and discover new software. Often, however, the quickest and most effective way to locate a package is to search with command-line tools. - - - - - - -System -Command -Notes - - - - -Debian / Ubuntu -apt-cache search search_string - - - -CentOS -yum search search_string - - - - -yum search all search_string -Searches all fields, including description. - - -Fedora -dnf search search_string - - - - -dnf search all search_string -Searches all fields, including description. - - -FreeBSD Packages -pkg search search_string -Searches by name. - - - -pkg search -f search_string -Searches by name, returning full descriptions. - - - -pkg search -D search_string -Searches description. - - -FreeBSD Ports -cd /usr/ports && make search name=package -Searches by name. - - - -cd /usr/ports && make search key=search_string -Searches comments, descriptions, and dependencies. - - - -View Info About a Specific Package -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. - - - - - - -System -Command -Notes - - - - -Debian / Ubuntu -apt-cache show package -Shows locally-cached info about a package. - - - -dpkg -s package -Shows the current installed status of a package. - - -CentOS -yum info package - - - - -yum deplist package -Lists dependencies for a package. - - -Fedora -dnf info package - - - - -dnf repoquery -\/-requires package -Lists dependencies for a package. - - -FreeBSD Packages -pkg info package -Shows info for an installed package. - - -FreeBSD Ports -cd /usr/ports/category/port && cat pkg-descr - - - - -Install a Package from Repositories -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. - - - - - - -System -Command -Notes - - - - -Debian / Ubuntu -sudo apt-get install package - - - - -sudo apt-get install package1 package2 ... -Installs all listed packages. - - - -sudo apt-get install -y package -Assumes "yes" where apt would usually prompt to continue. - - -CentOS -sudo yum install package - - - - -sudo yum install package1 package2 ... -Installs all listed packages. - - - -sudo yum install -y package -Assumes "yes" where yum would usually 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 -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. -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. -On CentOS and Fedora systems, yum and dnf are used to install individual files, and will also handle needed dependencies. - - - - - - -System -Command -Notes - - - - -Debian / Ubuntu -sudo dpkg -i package.deb - - - - -sudo apt-get install -ygdebi && sudo gdebipackage.deb -Installs and uses gdebi to install package.deb and retrieve any missing dependencies. - - -CentOS -sudo yum install package.rpm - - - -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 -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. - - - - - - -System -Command -Notes - - - - -Debian / Ubuntu -sudo apt-get remove package - - - - -sudo apt-get autoremove -Removes unneeded packages. - - -CentOS -sudo yum remove package - - - -Fedora -sudo dnf erase package - - - -FreeBSD Packages -sudo pkg delete package - - - - -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 -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: -In man, you can navigate with the arrow keys. Press / to search for text within the page, and q to quit. - - - - - - -System -Command -Notes - - - - -Debian / Ubuntu -man apt-get -Updating the local package database and working with packages. - - - -man apt-cache -Querying the local package database. - - - -man dpkg -Working with individual package files and querying installed packages. - - -CentOS -man yum - - - -Fedora -man dnf - - - -FreeBSD Packages -man pkg -Working with pre-compiled binary packages. - - -FreeBSD Ports -man ports -Working with the Ports Collection. - - - -Conclusion and Further Reading -This guide provides an overview of basic operations that can be cross-referenced between systems, but only scratches the surface of a complex topic. For greater detail on a given system, you can consult the following resources: -This guide covers Ubuntu and Debian package management in detail. There's an official CentOS guide to managing software with~yum. There's a Fedora wiki page about~dnf, and an official manual for~dnf~itself. This guide covers FreeBSD package management using pkg. The FreeBSD Handbook contains a section on using the Ports Collection.
\ No newline at end of file diff --git a/LDP/howto/docbook/Package-Management-Basics-HOWTO/Package-Management-Basics-HOWTO.adoc b/LDP/howto/docbook/Package-Management-Basics-HOWTO/Package-Management-Basics-HOWTO.adoc new file mode 100644 index 00000000..b68e9b2a --- /dev/null +++ b/LDP/howto/docbook/Package-Management-Basics-HOWTO/Package-Management-Basics-HOWTO.adoc @@ -0,0 +1,279 @@ += Package Management Basics: apt, yum, dnf, zypper, and pkg + +==== Abstract + +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 + +=== 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. + +A package management system does much more than one-time installation of software. It also provides tools for upgrading already-installed packages. Package repositories help to ensure that code has been vetted for use on your system, and that the installed versions of software have been approved by developers and package maintainers. + +When configuring servers or development environments, it's often necessary look beyond official repositories. Packages in the stable release of a distribution may be out of date, especially where new or 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. + +=== What do you need? + +This guide covers Debian, Ubuntu, CentOS, Fedora, SuSE, and FreeBSD and will require one of those distributions to be installed. + +NOTE: All of the commands in this guide assume that the user is running the commands as root or with `sudo`. + +=== Package Management Systems: A Brief Overview + +In a Windows environment, programs are packaged in .exe or .msi installers which will then install most of the files needed to run the program. If your computer doesn't have some dependant applications, then the program that you are trying to run will either not install or not run properly. You will then have to scour the internet in order to find the missing required applications or libraries. For example in CentOS 7, in order to install the VIM text editor, I need to add the following packages: + +.... + gpm-libs x86_64 1.20.7-5.el7 base 32 k + groff-base x86_64 1.22.2-8.el7 base 942 k + perl x86_64 4:5.16.3-286.el7 base 8.0 M + perl-Carp noarch 1.26-244.el7 base 19 k + perl-Encode x86_64 2.51-7.el7 base 1.5 M + perl-Exporter noarch 5.68-3.el7 base 28 k + perl-File-Path noarch 2.09-2.el7 base 26 k + perl-File-Temp noarch 0.23.01-3.el7 base 56 k + perl-Filter x86_64 1.49-3.el7 base 76 k + perl-Getopt-Long noarch 2.40-2.el7 base 56 k + perl-HTTP-Tiny noarch 0.033-3.el7 base 38 k + perl-PathTools x86_64 3.40-5.el7 base 82 k + perl-Pod-Escapes noarch 1:1.04-286.el7 base 50 k + perl-Pod-Perldoc noarch 3.20-4.el7 base 87 k + perl-Pod-Simple noarch 1:3.28-4.el7 base 216 k + perl-Pod-Usage noarch 1.63-3.el7 base 27 k + perl-Scalar-List-Utils x86_64 1.27-248.el7 base 36 k + perl-Socket x86_64 2.010-3.el7 base 49 k + perl-Storable x86_64 2.45-3.el7 base 77 k + perl-Text-ParseWords noarch 3.29-4.el7 base 14 k + perl-Time-HiRes x86_64 4:1.9725-3.el7 base 45 k + perl-Time-Local noarch 1.2300-2.el7 base 24 k + perl-constant noarch 1.27-2.el7 base 19 k + perl-libs x86_64 4:5.16.3-286.el7 base 687 k + perl-macros x86_64 4:5.16.3-286.el7 base 43 k + perl-parent noarch 1:0.225-244.el7 base 12 k + perl-podlators noarch 2.5.1-3.el7 base 112 k + perl-threads x86_64 1.87-4.el7 base 49 k + perl-threads-shared x86_64 1.43-6.el7 base 39 k + vim-common x86_64 2:7.4.160-1.el7 base 5.9 M + vim-filesystem x86_64 2:7.4.160-1.el7 base 9.6 k + which x86_64 2.20-7.el7 base 41 k +.... + +Imagine trying to manually install all of these programs one at a time just to be able to install a text editor! In the early days of Linux, we faced these kinds of problems, however this problem is fixed with package management systems such as apt, yum, and others. Package managers simplify everything. They look at the package that you want to install such as VIM, LibreOffice, etc., then look at what other package it depends upon, the dependencies of those packages, and so on; then it downloads them all and installs them. For example, in order to install VIM in CentOS 7 today, I simply have to run `yum install vim`. + +==== Some different package management systems: + +While their functionality and benefits are broadly similar, packaging formats and tools vary by platform: + +[cols="^,<,^",options="header",] +|=========================================== +|Operating System |Format |Tool(s) +|Debian |.deb |apt, apt-cache, apt-get, dpkg +|Ubuntu |.deb |apt, apt-cache, apt-get, dpkg +|CentOS |.rpm |yum +|Fedora |.rpm |dnf +|SuSE |.rpm |zypper +|FreeBSD |Ports, .txz |make, pkg +|=========================================== + +In Debian and systems based on it, like Ubuntu, Linux Mint, and Raspbian, the package format is the .debfile. APT, the Advanced Packaging Tool, provides commands used for most common operations: Searching repositories, installing collections of packages and their dependencies, and managing upgrades. APT commands operate as a front-end to the lower-level dpkg utility, which handles the installation of individual .deb files on the local system, and is sometimes invoked directly. + +Fedora and enterprise level distributions like Red Hat Enterprise Linux (RHEL), CentOS, and Oracle Linux use RPM files. In CentOS, Oracle, and RHEL, yum is used to interact with both individual package files and repositories. In recent versions of Fedora, yum has been supplanted by dnf, a modernized fork which retains most of yum's interface. + +SuSE also uses RPM files. However, the package management software is known as zypper. Zypper's command line interface is very similar to yum and YasT can be access from a graphical mode or from the command line. + +FreeBSD's binary package system is administered with the pkg command. FreeBSD also offers the Ports Collection, a local directory structure and tools which allow the user to fetch, compile, and install packages directly from source using Makefiles. It's usually much more convenient to use pkg, but occasionally a pre-compiled package is unavailable, or syou may need to change compile-time options. + +==== Update Package Lists + +Most systems keep a local database of the packages available from remote repositories. It's best to update this database before installing or upgrading packages. As a partial exception to this pattern, yum and dnf will check for updates before performing some operations, but you can ask them at any time whether updates are available. + +[cols="^,^",options="header",] +|========================================= +|System |Command +|Debian / Ubuntu |`apt-get update` +|CentOS |`yum check-update` +|Fedora |`dnf check-update` +|SuSE |`zypper refresh` +|FreeBSD Packages |`pkg update` +|FreeBSD Ports |`portsnap fetch update` +|========================================= + +==== Upgrade Installed Packages + +Making sure that all of the installed software on a machine stays up to date would be an enormous undertaking without a package system. You would have to track upstream changes and security alerts for hundreds of different packages. While a package manager doesn't solve every problem you'll encounter when upgrading software, it does enable you to maintain most system components with a few commands. + +On FreeBSD, upgrading installed ports can introduce breaking changes or require manual configuration steps. It's best to read /usr/ports/UPDATING before upgrading with portmaster. + +[cols="^,<,^",options="header",] +|======================================================================= +|System |Command |Notes +|Debian / Ubuntu |`apt-get upgrade` |Only upgrades installed packages, where possible. +| |`apt-get dist-upgrade` |May add or remove packages to satisfy new dependencies. +|CentOS |`yum update` | +|Fedora |`dnf upgrade` | +|SuSE |`zypper update` | +|FreeBSD Packages |`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 && make install && portmaster -a` |Installs portmaster and uses it to update installed ports. +|======================================================================= + +Find a Package +~~~~~~~~~~~~~~ + +Most distributions offer a graphical or menu-driven front end to package +collections. These can be a good way to browse by category and discover +new software. Often, however, the quickest and most effective way to +locate a package is to search with command-line tools. + +[cols="^,<,^",options="header",] +|======================================================================= +|System |Command |Notes +|Debian / Ubuntu |`apt-cache search` | +|CentOS |`yum search` | +| |`yum search all` |Searches all fields, including description. +|Fedora |`dnf search` | +| |`dnf search all` |Searches all fields, including description. +|SuSE |`zypper se` | +|FreeBSD Packages |`pkg search` |Searches by name. +| |`pkg search -f` |Searches by name, returning full descriptions. +| |`pkg search -D` |Searches description. +|FreeBSD Ports |`cd /usr/ports && make search name=package` |Searches by name. +| |`cd /usr/ports && make search key=` |Searches comments, descriptions, and dependencies. +|======================================================================= + +View Info About a Specific Package +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +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. + +[cols="^,<,^",options="header",] +|======================================================================= +|System |Command |Notes +|Debian / Ubuntu |`apt-cache show package` |Shows locally-cached info about a package. +| |`dpkg -s package` |Shows the current installed status of a package. +|CentOS |`yum info package` | +| |`yum deplist package` |Lists dependencies for a package. +|Fedora |`dnf info 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 package. +|FreeBSD Ports |`cd /usr/ports/category/port && cat pkg-descr` | +|======================================================================= + +Install a Package from Repositories +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +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. + +[cols="^,<,^",options="header",] +|======================================================================= +|System |Command |Notes +|Debian / Ubuntu |`apt-get install package` | +| |`apt-get install package1 package2` |Installs all listed packages. +| |`apt-get install -y package` |Assumes "yes" where apt would usually prompt to continue. +|CentOS |`yum install package` | +| |`yum install package1 package2` |Installs all listed packages. +| |`yum install -y package` |Assumes "yes" where yum would usually prompt to continue. +|Fedora |`dnf install package` | +| |`dnf install package1 package2` |Installs all listed packages. +| |`dnf install -y package` |Assumes "yes" where dnf would usually prompt to continue. +|SuSE |`zypper install` | +|FreeBSD Packages |`pkg install package` | +| |`pkg install package1 package2` |Installs all listed packages. +|FreeBSD Ports |`cd /usr/ports/category/port && make install` |Builds and installs a port from source. +|======================================================================= + +Install a Package from the Local Filesystem +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +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. + +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. + +On CentOS and Fedora systems, yum and dnf are used to install individual files, and will also handle needed dependencies. + +[cols="^,<,^",options="header",] +|======================================================================= +|System |Command |Notes +|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. +|CentOS |`yum install package.rpm` | +|Fedora |`dnf install package.rpm` | +|SuSE|`zypper install package.rpm`| +|FreeBSD Packages |`pkg add package.txz` | +| |`pkg add -f package.txz` |Installs package even if already installed. +|======================================================================= + +Remove One or More Installed Packages +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +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. + +[cols="^,<,^",options="header",] +|======================================================================= +|System |Command |Notes +|Debian / Ubuntu |`apt-get remove package` |yum remove package +| |`apt-get autoremove` |Removes unneeded packages. +|CentOS |`yum remove package` | +|Fedora |`dnf erase package` | +|FreeBSD Packages |`pkg delete package` | +| |`pkg autoremove` |Removes unneeded packages. +|SuSE |`zypper rm package` |Removes unneeded packages. +|FreeBSD Ports |`pkg delete package` | +| |`cd /usr/ports/path_to_port && make deinstall` |De-installs an installed port. +|======================================================================= + +Get Help +~~~~~~~~ + +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 the `man` command. For example, `man yum` will give you a brief manual on how to use yum. + +Conclusion and Further Reading +------------------------------ + +This guide provides an overview of basic operations that can be +cross-referenced between systems, but only scratches the surface of a +complex topic. For greater detail on a given system, you can consult the +following resources: + +1. https://www.digitalocean.com/community/tutorials/ubuntu-and-debian-package-management-essentials[This +guide] covers Ubuntu and Debian package management in detail. +2. There's an https://www.centos.org/docs/5/html/yum/[official CentOS guide to managing software with yum]. +3. There's a https://fedoraproject.org/wiki/Dnf[Fedora wiki page about dnf], and an https://dnf.readthedocs.org/en/latest/index.html[official manual for dnf itself] +4. https://www.digitalocean.com/community/tutorials/how-to-manage-packages-on-freebsd-10-1-with-pkg[This guide] covers FreeBSD package management using pkg. +5. The https://www.freebsd.org/doc/handbook/[FreeBSD Handbook] contains +a https://www.freebsd.org/doc/handbook/ports-using.html[section on using +the Ports Collection]. +6. http://doc.opensuse.org/documentation/html/openSUSE_114/opensuse-reference/cha.sw_cl.html[OpenSuSE documentation for Zypper] and http://doc.opensuse.org/documentation/html/openSUSE_114/opensuse-reference/cha.onlineupdate.you.html[YaST]. \ No newline at end of file diff --git a/LDP/howto/docbook/Package-Management-Basics-HOWTO/Package-Management-Basics-HOWTO.xml b/LDP/howto/docbook/Package-Management-Basics-HOWTO/Package-Management-Basics-HOWTO.xml index 128be9b3..eaa9cdeb 100644 --- a/LDP/howto/docbook/Package-Management-Basics-HOWTO/Package-Management-Basics-HOWTO.xml +++ b/LDP/howto/docbook/Package-Management-Basics-HOWTO/Package-Management-Basics-HOWTO.xml @@ -1,532 +1,659 @@ - - - -
- -Package Management Basics: apt, yum, dnf, pkg - -Introduction - -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. -A package management system does much more than one-time installation of software. It also provides tools for upgrading already-installed packages. Package repositories help to ensure that code has been vetted for use on your system, and that the installed versions of software have been approved by developers and package maintainers. -When configuring servers or development environments, it's often necessary look beyond official repositories. Packages in the stable release of a distribution may be out of date, especially where new or 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. -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. + + +
+ +Package Management Basics +apt, yum, dnf, zypper, and pkg +2016-03-21 + +
+Abstract +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. +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 Digital Ocean. +The original version of this guide can be found at Digital Ocean. +
+
Revision History - - - - + + + + + -15.1.2016 -v1.0 converted and edited for TLDP -Jason Evans +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 -Brennen Bearnes (original author).Jason Evans (editor and maintainer for TLDP) + +Brennen Bearnes +(original author). + + +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 +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 Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. +This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. +
+
+Introduction +
+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. +A package management system does much more than one-time installation of software. It also provides tools for upgrading already-installed packages. Package repositories help to ensure that code has been vetted for use on your system, and that the installed versions of software have been approved by developers and package maintainers. +When configuring servers or development environments, it’s often necessary look beyond official repositories. Packages in the stable release of a distribution may be out of date, especially where new or 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. +
+
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, SuSE, and FreeBSD and will require one of those distributions to be installed. + +All of the commands in this guide assume that the user is running the commands as root or with sudo. + +
+
Package Management Systems: A Brief Overview -Most package systems are built around collections of package files. A package file is usually an archive which contains compiled binaries and other resources making up the software, along with installation scripts. Packages also contain valuable metadata, including their;dependencies, a list of other packages required to install and run them. -While their functionality and benefits are broadly similar, packaging formats and tools vary by platform: - - - - +In a Windows environment, programs are packaged in .exe or .msi installers which will then install most of the files needed to run the program. If your computer doesn’t have some dependant applications, then the program that you are trying to run will either not install or not run properly. You will then have to scour the internet in order to find the missing required applications or libraries. For example in CentOS 7, in order to install the VIM text editor, I need to add the following packages: + gpm-libs x86_64 1.20.7-5.el7 base 32 k + groff-base x86_64 1.22.2-8.el7 base 942 k + perl x86_64 4:5.16.3-286.el7 base 8.0 M + perl-Carp noarch 1.26-244.el7 base 19 k + perl-Encode x86_64 2.51-7.el7 base 1.5 M + perl-Exporter noarch 5.68-3.el7 base 28 k + perl-File-Path noarch 2.09-2.el7 base 26 k + perl-File-Temp noarch 0.23.01-3.el7 base 56 k + perl-Filter x86_64 1.49-3.el7 base 76 k + perl-Getopt-Long noarch 2.40-2.el7 base 56 k + perl-HTTP-Tiny noarch 0.033-3.el7 base 38 k + perl-PathTools x86_64 3.40-5.el7 base 82 k + perl-Pod-Escapes noarch 1:1.04-286.el7 base 50 k + perl-Pod-Perldoc noarch 3.20-4.el7 base 87 k + perl-Pod-Simple noarch 1:3.28-4.el7 base 216 k + perl-Pod-Usage noarch 1.63-3.el7 base 27 k + perl-Scalar-List-Utils x86_64 1.27-248.el7 base 36 k + perl-Socket x86_64 2.010-3.el7 base 49 k + perl-Storable x86_64 2.45-3.el7 base 77 k + perl-Text-ParseWords noarch 3.29-4.el7 base 14 k + perl-Time-HiRes x86_64 4:1.9725-3.el7 base 45 k + perl-Time-Local noarch 1.2300-2.el7 base 24 k + perl-constant noarch 1.27-2.el7 base 19 k + perl-libs x86_64 4:5.16.3-286.el7 base 687 k + perl-macros x86_64 4:5.16.3-286.el7 base 43 k + perl-parent noarch 1:0.225-244.el7 base 12 k + perl-podlators noarch 2.5.1-3.el7 base 112 k + perl-threads x86_64 1.87-4.el7 base 49 k + perl-threads-shared x86_64 1.43-6.el7 base 39 k + vim-common x86_64 2:7.4.160-1.el7 base 5.9 M + vim-filesystem x86_64 2:7.4.160-1.el7 base 9.6 k + which x86_64 2.20-7.el7 base 41 k +Imagine trying to manually install all of these programs one at a time just to be able to install a text editor! In the early days of Linux, we faced these kinds of problems, however this problem is fixed with package management systems such as apt, yum, and others. Package managers simplify everything. They look at the package that you want to install such as VIM, LibreOffice, etc., then look at what other package it depends upon, the dependencies of those packages, and so on; then it downloads them all and installs them. For example, in order to install VIM in CentOS 7 today, I simply have to run yum install vim. +
+Some different package management systems: +While their functionality and benefits are broadly similar, packaging formats and tools vary by platform: + + + + + -Operating System -Format +Operating System +Format Tool(s) -Debian -.deb -apt, apt-cache, apt-get, dpkg +Debian +.deb +apt, apt-cache, apt-get, dpkg -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 -FreeBSD -Ports,;.txz -make, pkg +SuSE +.rpm +zypper + + +FreeBSD +Ports, .txz +make, pkg - -In Debian and systems based on it, like Ubuntu, Linux Mint, and Raspbian, the package format is the;.debfile. APT, the Advanced Packaging Tool, provides commands used for most common operations: Searching repositories, installing collections of packages and their dependencies, and managing upgrades. APT commands operate as a front-end to the lower-level;dpkg;utility, which handles the installation of individual;.deb;files on the local system, and is sometimes invoked directly. -CentOS, Fedora, and other members of the Red Hat family use RPM files. In CentOS,;yum;is used to interact with both individual package files and repositories. -In recent versions of Fedora,;yum;has been supplanted by;dnf, a modernized fork which retains most ofyum's interface. -FreeBSD's binary package system is administered with the;pkg;command. FreeBSD also offers the Ports Collection, a local directory structure and tools which allow the user to fetch, compile, and install packages directly from source using Makefiles. It's usually much more convenient to use;pkg, but occasionally a pre-compiled package is unavailable, or you may need to change compile-time options. + + +In Debian and systems based on it, like Ubuntu, Linux Mint, and Raspbian, the package format is the .debfile. APT, the Advanced Packaging Tool, provides commands used for most common operations: Searching repositories, installing collections of packages and their dependencies, and managing upgrades. APT commands operate as a front-end to the lower-level dpkg utility, which handles the installation of individual .deb files on the local system, and is sometimes invoked directly. +Fedora and enterprise level distributions like Red Hat Enterprise Linux (RHEL), CentOS, and Oracle Linux use RPM files. In CentOS, Oracle, and RHEL, yum is used to interact with both individual package files and repositories. In recent versions of Fedora, yum has been supplanted by dnf, a modernized fork which retains most of yum’s interface. +SuSE also uses RPM files. However, the package management software is known as zypper. Zypper’s command line interface is very similar to yum and YasT can be access from a graphical mode or from the command line. +FreeBSD’s binary package system is administered with the pkg command. FreeBSD also offers the Ports Collection, a local directory structure and tools which allow the user to fetch, compile, and install packages directly from source using Makefiles. It’s usually much more convenient to use pkg, but occasionally a pre-compiled package is unavailable, or syou may need to change compile-time options. +
+
Update Package Lists -Most systems keep a local database of the packages available from remote repositories. It's best to update this database before installing or upgrading packages. As a partial exception to this pattern,;yumand;dnf;will check for updates before performing some operations, but you can ask them at any time whether updates are available. - - - +Most systems keep a local database of the packages available from remote repositories. It’s best to update this database before installing or upgrading packages. As a partial exception to this pattern, yum and dnf will check for updates before performing some operations, but you can ask them at any time whether updates are available. + + + + -System +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 -Making sure that all of the installed software on a machine stays up to date would be an enormous undertaking without a package system. You would have to track upstream changes and security alerts for hundreds of different packages. While a package manager doesn't solve every problem you'll encounter when upgrading software, it does enable you to maintain most system components with a few commands. -On FreeBSD, upgrading installed ports can introduce breaking changes or require manual configuration steps. It's best to read;/usr/ports/UPDATING;before upgrading with;portmaster. - - - - +Making sure that all of the installed software on a machine stays up to date would be an enormous undertaking without a package system. You would have to track upstream changes and security alerts for hundreds of different packages. While a package manager doesn’t solve every problem you’ll encounter when upgrading software, it does enable you to maintain most system components with a few commands. +On FreeBSD, upgrading installed ports can introduce breaking changes or require manual configuration steps. It’s best to read /usr/ports/UPDATING before upgrading with portmaster. + + + + + -System -Command +System +Command Notes -Debian / Ubuntu -sudo apt-get upgrade -Only upgrades installed packages, where possible. +Debian / Ubuntu +apt-get upgrade +Only upgrades installed packages, where possible. -sudo apt-get dist-upgrade -May add or remove packages to satisfy new dependencies. +apt-get dist-upgrade +May add or remove packages to satisfy new dependencies. -CentOS -sudo yum update +CentOS +yum update -Fedora -sudo dnf upgrade +Fedora +dnf upgrade -FreeBSD Packages -sudo pkg upgrade +SuSE +zypper update -FreeBSD Ports -less /usr/ports/UPDATING -Uses;less;to view update notes for ports (use arrow keys to scroll, pressq;to quit). +FreeBSD Packages +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. +cd /usr/ports/ports-mgmt/portmaster && make install && portmaster -a +Installs portmaster and uses it to update installed ports. - + + +
+
+
Find a Package -Most distributions offer a graphical or menu-driven front end to package collections. These can be a good way to browse by category and discover new software. Often, however, the quickest and most effective way to locate a package is to search with command-line tools. - - - - +Most distributions offer a graphical or menu-driven front end to package +collections. These can be a good way to browse by category and discover +new software. Often, however, the quickest and most effective way to +locate a package is to search with command-line tools. + + + + + -System -Command +System +Command Notes -Debian / Ubuntu -apt-cache search;search_string +Debian / Ubuntu +apt-cache search -CentOS -yum search;search_string +CentOS +yum search -yum search all;search_string -Searches all fields, including description. +yum search all +Searches all fields, including description. -Fedora -dnf search;search_string +Fedora +dnf search -dnf search all;search_string -Searches all fields, including description. +dnf search all +Searches all fields, including description. -FreeBSD Packages -pkg search;search_string -Searches by name. +SuSE +zypper se + + + +FreeBSD Packages +pkg search +Searches by name. -pkg search -f;search_string -Searches by name, returning full descriptions. +pkg search -f +Searches by name, returning full descriptions. -pkg search -D;search_string -Searches description. +pkg search -D +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 name. -cd /usr/ports && make search key=search_string -Searches comments, descriptions, and dependencies. +cd /usr/ports && make search key= +Searches comments, descriptions, and dependencies. - + + +
+
View Info About a Specific Package -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. - - - - +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. + + + + + -System -Command +System +Command Notes -Debian / Ubuntu -apt-cache show;package -Shows locally-cached info about a package. +Debian / Ubuntu +apt-cache show package +Shows locally-cached info 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. -FreeBSD Packages -pkg info;package -Shows info for an installed package. +SuSE +zypper info search string +Lists dependencies for a package. -FreeBSD Ports -cd /usr/ports/category/port;&& cat pkg-descr +FreeBSD Packages +pkg info package +Shows info for an installed package. + + +FreeBSD Ports +cd /usr/ports/category/port && cat pkg-descr - + + +
+
Install a Package from Repositories -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. - - - - +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. + + + + + -System -Command +System +Command Notes -Debian / Ubuntu -sudo apt-get install;package +Debian / Ubuntu +apt-get install package -sudo apt-get install;package1 package2 ... -Installs all listed packages. +apt-get install package1 package2 +Installs all listed packages. -sudo apt-get install -y;package -Assumes "yes" where;apt;would usually prompt to continue. +apt-get install -y package +Assumes "yes" where apt would usually prompt to continue. -CentOS -sudo yum install;package +CentOS +yum install package -sudo yum install;package1 package2 ... -Installs all listed packages. +yum install package1 package2 +Installs all listed packages. -sudo yum install -y;package -Assumes "yes" where;yum;would usually prompt to continue. +yum install -y package +Assumes "yes" where yum would usually prompt to continue. -Fedora -sudo dnf install;package +Fedora +dnf install package -sudo dnf install;package1 package2 ... -Installs all listed packages. +dnf install package1 package2 +Installs all listed packages. -sudo dnf install -y;package -Assumes "yes" where;dnf;would usually prompt to continue. +dnf install -y package +Assumes "yes" where dnf would usually prompt to continue. -FreeBSD Packages -sudo pkg install;package +SuSE +zypper install + + + +FreeBSD Packages +pkg install package -sudo pkg install;package1 package2 ... -Installs all listed packages. +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. +FreeBSD Ports +cd /usr/ports/category/port && make install +Builds and installs a port from source. - + + +
+
Install a Package from the Local Filesystem -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. -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. -On CentOS and Fedora systems,;yum;and;dnf;are used to install individual files, and will also handle needed dependencies. - - - - +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. +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. +On CentOS and Fedora systems, yum and dnf are used to install individual files, and will also handle needed dependencies. + + + + + -System -Command +System +Command Notes -Debian / Ubuntu -sudo dpkg -i;package.deb +Debian / Ubuntu +dpkg -i package.deb -sudo apt-get install -ygdebi && sudo gdebipackage.deb -Installs and uses gdebi to install package.deb and retrieve any missing dependencies. +apt-get install -yg debi && gdebi package.deb +Installs and uses gdebi to install package.deb and retrieve any missing dependencies. -CentOS -sudo yum install;package.rpm +CentOS +yum install package.rpm -Fedora -sudo dnf install;package.rpm +Fedora +dnf install package.rpm -FreeBSD Packages -sudo pkg add;package.txz +SuSE +zypper install package.rpm + + + +FreeBSD Packages +pkg add package.txz -sudo pkg add -f;package.txz -Installs package even if already installed. +pkg add -f package.txz +Installs package even if already installed. - + + +
+
Remove One or More Installed Packages -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. - - - - +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. + + + + + -System -Command +System +Command Notes -Debian / Ubuntu -sudo apt-get remove;package +Debian / Ubuntu +apt-get remove package +yum remove package + + + +apt-get autoremove +Removes unneeded packages. + + +CentOS +yum remove package + + + +Fedora +dnf erase package + + + +FreeBSD Packages +pkg delete package -sudo apt-get autoremove -Removes unneeded packages. +pkg autoremove +Removes unneeded packages. -CentOS -sudo yum remove;package - +SuSE +zypper rm package +Removes unneeded packages. -Fedora -sudo dnf erase;package - - - -FreeBSD Packages -sudo pkg delete;package +FreeBSD Ports +pkg delete package -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. +cd /usr/ports/path_to_port && make deinstall +De-installs an installed port. - + + +
+
Get Help -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: -In man, you can navigate with the arrow keys. Press / to search for text within the page, and q to quit. - - - - - - -System -Command -Notes - - - - -Debian / Ubuntu -man apt-get -Updating the local package database and working with packages. - - - -man apt-cache -Querying the local package database. - - - -man dpkg -Working with individual package files and querying installed packages. - - -CentOS -man yum - - - -Fedora -man dnf - - - -FreeBSD Packages -man pkg -Working with pre-compiled binary packages. - - -FreeBSD Ports -man ports -Working with the Ports Collection. - - - +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 the man command. For example, man yum will give you a brief manual on how to use yum. +
+
+
Conclusion and Further Reading -This guide provides an overview of basic operations that can be cross-referenced between systems, but only scratches the surface of a complex topic. For greater detail on a given system, you can consult the following resources: -This guide covers Ubuntu and Debian package management in detail. There's an official CentOS guide to managing software with~yum. There's a Fedora wiki page about~dnf, and an official manual for~dnf~itself. This guide covers FreeBSD package management using pkg. The FreeBSD Handbook;contains a;section on using the Ports Collection.
+This guide provides an overview of basic operations that can be +cross-referenced between systems, but only scratches the surface of a +complex topic. For greater detail on a given system, you can consult the +following resources: + + +This +guide covers Ubuntu and Debian package management in detail. + + +There’s an official CentOS guide to managing software with yum. + + +There’s a Fedora wiki page about dnf, and an official manual for dnf itself + + +This guide covers FreeBSD package management using pkg. + + +The FreeBSD Handbook contains +a section on using +the Ports Collection. + + +OpenSuSE documentation for Zypper and YaST. + + + +
\ No newline at end of file