Skip to main content

Package Managers

====================================================================================

RHEL - yum & dnf

yum and dnf are typically interchangeable in RHEL systems.

====================================================================================

yum

YUM

Cache(Yellowdog Update Manager) & Repositories

Update cache

yum makecache

List enabled repositories

yum repolist

List all repositories

yum repolist --all

repositories are stored in /etc/yum.repos.d/

DNF

------------------------------------------------------------------------------------------------------------------------------------------  

Cache & Repositories

Update cache
yum makecache
List enabled repositories
yum repolist
List all active repositories
yum repolist --all
Adding additional repositories

repositories are stored in /etc/yum.repos.d/ (for both YUM and DNF)

 

Searching repositories for packages and package info

The below can be used to check whether a package is available in the currently configured repositories (requires the exact package name):

dnf list packagename

The below can be used to search repositories for a keyword relating to a package - ie a part of its name or description:

dnf search packagename

or

yum list available | grep -i packagename
Retrieve information about an available package:
dnf info packagename

------------------------------------------------------------------------------------------------------------------------------------------  

Installing/ Searching/ Updating Packages

Install package

yum install packagename

or

dnf install packagename

remove package

yum remove packagename

or

dnf remove packagename

update all packages

yum update


or

dnf update

update a specific package

====================================================================================

Ubuntu - apt

====================================================================================

Cache & Repositories

Ubuntu apt uses a cache to store what can be installed/updated from repos. Before installing or updating software, it's worth checking that the cache has been recently updated, and if it hasn't; running an update on the cache.

Update cache

apt update

Check when cache was last updated:

stat -c %z /var/lib/apt/periodic/update-success-stamp

repositories are stored in /etc/apt/sources.list or /etc/apt/sources.list.d

------------------------------------------------------------------------------------------------------------------------------------------  

Installing/ Searching/ Updating Packages

Search packages

apt search packagename

Install package

apt install packagename

Remove package without removing configuration files

apt remove packagename

Remove package and configuration files

apt purge packagename

Check for updates

apt list --upgradable

Run all updates

apt upgrade

====================================================================================

openSuse - zypper

Cache & Repositories

Zypper uses a cache to store what can be installed/updated from repos. Before installing or updating software, it's worth checking that the cache has been recently updated, and if it hasn't; running an update on the cache.

update cache

zypper ref

List repositories 

zypper lr

Repositories are stored in /etc/zypp/repos.d

------------------------------------------------------------------------------------------------------------------------------------------  

Installing/ Searching/ Updating Packages

Search packages

zypper se packagename

Search specifically

zypper se --match-words packagename

or

zypper se --match-exact packagename

Install package

zypper in packagename

Remove package (only option to remove package and configuration files)

zypper rm packagename

====================================================================================