Install Programs on Linux with Yum
Yum is an acronym for Yellow dog Updater, Modified. It is a tool used to manage the installation and removal of packages on Linux distributions that use the RPM system.
It is a package manager similar to APT-GET that automatically handles dependencies by computing and resolving what must be done to address them.
It has a configuration file that specifies which repositories YUM should use to search for and download RPM packages.
Not every RPM-based Linux will have the YUM package manager installed. If you need to install YUM, you can get it at http://yum.baseurl.org.
The installation command is:
# rpm -ivh yum.rpm
YUM requires you to configure the package repositories in the yum.conf configuration file
Example:
# vi /etc/yum.conf
[fedora-us-3-core]
name=Fedora Core 3 — Fedora US mirror
baseurl=http://SERVERNAME/fedora/fedora/$releasever/$basearch/RPMS.os
[fedora-us-3-updates]
name=Fedora Core 3 Updates — Fedora US mirror
baseurl=http://SERVERNAME/fedora/fedora/$releasever/$basearch/RPMS.updates
In addition to the configuration file /etc/yum.conf, YUM allows you to place repository configuration files in the /etc/yum.repos.d/ directory. This directory contains the configurations for each repository.
You can add extra or "beta-test" software repositories to YUM's repository list.
Some yum commands:
- yum list: Lists all available packages;
- yum check-update or yum list updates: Checks if there are packages available for an update;
- yum update: Updates your system;
- yum install <package(s)>: Installs a specific package and its dependencies;
- yum remove <package(s)>: Removes a specific package
- yum info <package>: Shows basic information about a specific package.
See the examples:
To install a package:
# yum install postgresql
Resolving Dependencies
Install 2 Package(s)
Is this ok [y/N]: y
Package(s) data still to download: 3.0 M
(1/2): postgresql-9.0.4-5.fc15.x86_64.rpm | 2.8 MB 00:11
(2/2): postgresql-libs-9.0.4-5.fc15.x86_64.rpm | 203 kB 00:00
------------------------------------------------------------------
Total 241 kB/s | 3.0 MB 00:12
Running Transaction
Installing : postgresql-libs-9.0.4-5.fc15.x86_64 1/2
Installing : postgresql-9.0.4-5.fc15.x86_64 2/2
Complete!
To update installed packages:
# yum update
Plugins carregados: priorities, update-motd, upgrade-helper
amzn-main/latest
Resolvendo dependências
--> Executando verificação da transação
---> O pacote aws-cli.noarch 0:1.7.5-1.2.amzn1 será atualizado
---> O pacote aws-cli.noarch 0:1.7.12-1.3.amzn1 será uma atualização
--> Resolução de dependências finalizada
Dependências resolvidas
===============================================================
Package Arq. Versão Repo Tam.
===============================================================
Instalando:
kernel x86_64 3.14.34-27.48.amzn1 amzn-updates 16 M
Atualizando:
aws-cli noarch 1.7.12-1.3.amzn1 amzn-updates 604 k
Resumo da transação
=============================================================== Instalar 1 Package (+4 Dependent packages)
Upgrade 1 Package
Tamanho total do download: 16 M
Is this ok [y/d/N]:
Para remover um pacote:
# yum remove postgresql
Resolving Dependencies
---> Package postgresql.x86_64 0:9.0.4-5.fc15 will be erased
Is this ok [y/N]: y
Running Transaction
Erasing : postgresql-9.0.4-5.fc15.x86_64 1/1
Removed:
postgresql.x86_64 0:9.0.4-5.fc15
Complete!
To search for all packages with the word "firefox":
# yum search firefox
Loaded plugins: langpacks, presto, refresh-packagekit
============== N/S Matched: firefox ======================
firefox.x86_64 : Mozilla Firefox Web browser
gnome-do-plugins-firefox.x86_64 : gnome-do-plugins for firefox
mozilla-firetray-firefox.x86_64 : System tray extension for firefox
mozilla-adblockplus.noarch : Adblocking extension for Mozilla Firefox
mozilla-noscript.noarch : JavaScript list extension for Mozilla Firefox
Name and summary matches only, use "search all" for everything.
To get information about a specific package:
# yum info mysql
yum info mysql
Plugins carregados: priorities, update-motd, upgrade-helper
newrelic 59/59
Pacotes instalados
Nome : mysql
Arquitetura : noarch
Versão : 5.5
Lançamento : 1.6.amzn1
Tamanho : 0.0
Repo : installed
Do repositório : amzn-main
Sumário : MySQL meta package
URL : http://www.mysql.com
Licença : GPLv2 with exceptions
Descrição : MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
: client/server implementation consisting of a server daemon (mysqld)
: and many different client programs and libraries. The base package
: contains the standard MySQL client programs and generic MySQL files.
To see all available packages in the yum repository:
# yum list
Pacotes instalados
GeoIP.x86_64 1.4.8-1.5.amzn1 @amzn-main
GeoIP-devel.x86_64 1.4.8-1.5.amzn1 @amzn-main
PyYAML.x86_64 3.10-3.6.amzn1 installed
acl.x86_64 2.2.49-6.9.amzn1 installed
acpid.x86_64 1.0.10-2.1.6.amzn1 installed
alsa-lib.x86_64 1.0.22-3.9.amzn1 installed
apr.x86_64 1.5.0-2.11.amzn1 @amzn-updates
(…)
To find out which package a specific file belongs to:
# yum provides /etc/sysconfig/nfs
Plugins carregados: priorities, update-motd, upgrade-helper
1:nfs-utils-1.2.3-39.15.amzn1.x86_64 : NFS utilities and supporting clients and daemons for the kernel NFS server
Repo : amzn-main
Resultado a partir de:
Nome de arquivo : /etc/sysconfig/nfs
To find out which repositories are active in YUM:
# yum repolist
id do repo nome do repo status
amzn-main/latest amzn-main-Base 5.019
amzn-updates/latest amzn-updates-Base 1.085
newrelic/x86_64 New Relic packages 59
repolist: 6.163
yumdownloader
Usage:
# yumdownloader
The yumdownloader command downloads RPM files from YUM repositories. It's useful for downloading packages for later installation, or when you're going to install packages on multiple machines, without the need to download the same package multiple times.
Example:
$ yumdownloader httpd24
amzn-main/latest | 2.1 kB 00:00
amzn-updates/latest | 2.3 kB 00:00
httpd24-2.4.10-15.58.amzn1.x86_64.rpm | 1.3 MB 00:00
Want to know if a Linux professional certification is worth it? Find out why salaries are good, and why companies are looking for Linux professionals.
You'll understand that the benefits far outweigh the sacrifice.
And if you've already decided, check out our Certification Guide.
And if you want to know where to take the exams, check the city list.
If you want to know the language of the exams, see this post.
Learn much more about Linux in our online course. You can enroll here with a 7-day free trial. If you already have an account, you can access here.
Did you like it? Share :-)
That was just one piece. The course teaches the whole path — from your first command to exam day.