Zusammenfassung der Ressource
102.5 Use RPM
and YUM package
management
- rpm, yum, dnf and
zypper
- install, manage and
remove software on
a Linux system.
- rpm:redhat,fedora,centos
- DNF:Fedora
- zypper:Suse
- yum:Rhel, Centos
- rpm The RPM
Package Manager
- rpm -i
PACKAGENAME.rpm
- Installing,
- rpm -U PACKAGENAME.rpm
- upgrade
- If there is a
previous version
- If there is no previous version
of PACKAGENAME installed,
then a fresh copy will be
installed.
- rpm -F PACKAGENAME.rpm
- only upgrade an
installed package
- rpm -ivh PACKAGENAME.rpm
- install, verbose, #
- rpm -e PACKAGENAME.rpm
- to remove a
installed
Package
- rpm -e unzip
error: Failed
dependencies:
- /usr/bin/unzip is
needed by (installed)
file-roller-3.28.1-2.el7.x86_64
- Dealing with Dependencies
- rpm will list what is missing.
However it cannot solve
dependencies by itself.
- # rpm -i
gimp-2.8.22-1.el7.x86_64.rpm
error: Failed dependencies:
- Listing Installed
Packages
- rpm -qa
- To get a list of all
installed packages
on your system
- query all
- Getting Package
Information
- # rpm -qi unzip
- To get information about an
installed package, such as its
version number, architecture,
install date, packager,
summary
- query info
- rpm -ql info
- To get a list of what
files are inside an
installed package
- query list
- If you wish to get information or
a file listing from a package that
has not been installed yet
- rpm -qip atom.x86_64.rpm
- Version, number, install date,
- rpm -qlp atom.x86_64.rpm
- List of
archives
- Finding Out Which
Package Owns a Specific
File
- rpm -qf /usr/bin/unzip unzip-6.0-19.el7.x86_64
- query file
- YellowDog
Updater
Modified (YUM)
- yum can be used to install a single
package, or to upgrade a whole
system at once.
- Searching for Packages
- yum search 7zip
- Installing, Upgrading and
Removing Packages
- yum install p7zip
- install
- yum update wget
- upgrade install package
- yum remove package
- Delete Package
- Finding Which Package Provides a Specific File
- yum whatprovides libgimpui-2.0.so.0
- The answer is
gimp-libs-2.8.22-1.el7.i686. You
can then install the package
with the command yum install
gimp-libs.
- if you wish to know where
the file /etc/hosts came
from, you can use:
- # yum whatprovides /etc/hosts
- The answer is
setup-2.8.71-10.el7.noarch.
- Getting Information
About a Package
- yum info firefox
- Managing Software Repositories
- For yum the “repos”
are listed in the
directory
/etc/yum.repos.d/
- CentOS-Base.repo.
- Additional, extra
repositories can be
added by the user by
adding a .repo file in the
directory mentioned
above, or at the end of
/etc/yum.conf.
- However, the recommended
way to add or manage
repositories is with the
yum-config-manager tool.
- However, the
recommended way
to add or manage
repositories is with
the
yum-config-manager
tool.
- yum-config-manager --add-repo https://rpms.remirepo.net/enterprise/remi.repo
- To get a list of all
available
repositories
- yum repolist all
- repo id repo name status
updates/7/x86_64 CentOS-7 - Updates
enabled: 2,500 updates-source/7 CentOS-7
- Updates Sources disabled
- To enable or disable a repository,
use the yum-config-manager
utility, followed by the repository
id.
- the repository id is shown on the
first column (repo id) of each line.
Use only the part before the first /
- yum-config-manager --disable updates
- yum-config-manager --enable updates
- Yum stores downloaded packages
and associated metadata in a
cache directory
- /var/cache/yum)
- To clean the cache and reclaim
disk space you can use the yum
clean command,
- yum clean packages
- yum clean metadata
- Zypper
- used for suse y opensuse
- # zypper refresh
- refresh metadata
- zypper se[arch] gnumeric
- search
- zypper se -i
- # zypper se -i firefox
- # zypper in[stall] unrar
- zypper in /home/john/newpackage.rpm
- install
- zypper update
- actualizar pquete
- zypper list-updates
- only list the
available updates
- zypper rm unrar
- remove package
- zypper se --provides /usr/lib64/libgimpmodule-2.0.so.0
- find Package
- zypper info gimp
- info Package
- zypper repos
- list all repository
- # zypper modifyrepo -d repo-non-oss
- disablesd repo-non-oss
- zypper modifyrepo -e repo-non-oss
- enabled repo-non-oss
- zypper modifyrepo -F repo-non-oss
- zypper modifyrepo -f repo-non-oss
- refresh
- zypper addrepo http://packman.inode.at/suse/openSUSE_Leap_15.1/ packman
- zypper removerepo packman
- add o remove repository
- DNF
- is the package
management
tool used on
Fedora
- dnf search package
- dnf install package
- dnf info packagename
- dnf remove packagename
- dnf upgrade packaname
- dnf provides filename
- dnf list --installed
- dnf repoquery -l PACKAGENAME
- dnf repolist
- dnf config-manager --add_repo URL
- dnf config-manager --set-enabled REPO_ID.
- dnf config-manager --set-disabled REPO_ID
- Preguntas Y Repuestas
- 1.- Using rpm on a Red Hat Enterprise Linux system,
how would you install the package
file-roller-3.28.1-2.el7.x86_64.rpm showing a
progress bar during the installation?
- rpm -ih file-roller-3.28.1-2.el7.x86_64.rpm
- 2.- Using rpm, find out which
package contains the file
/etc/redhat-release
- rpm -qf /etc/redhat-release
- 3.- How would you use yum to
check for updates for all
packages in the system?
- yum check-update
- 4.- Using zypper, how would
you disable a repository called
repo-extras?
- zipper modifyrepo -d repo-extras
- 5.- If you have a .repo file describing a
new repository, where this file
should be put so that it is
recognized by DNF?
- .repo files for DNF should be put on the
same place used by YUM, inside
/etc/yum.repos.d/
- Preguntas y
Respuestas
exploratorias
- 6.- How would you use zypper to
find out which package owns
the file /usr/sbin/swapon?
- zipper se --provides /usr/sbin/swapon
- 7.-How can you get a list of all
installed packages in the system
using dnf?
- dnf list --installed
- 8.- Using dnf, what is the command to add a
repository located at URL
- dnf config-manager --add_repo URL
- 9.- How can you use zypper to
check if the package unzip
is installed?
- zypper se -i unzip
- 10.- Using yum, find out which
package provides the file
/bin/wget
- yum whatprovides /bin/wget