#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