How to 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 in Linux distributions, which use the RPM system.
It is a file package manager similar to APT-GET that automatically handles dependencies computing them and solving what must be done to treat them.
It has a configuration file that specifies which repositories YUM should use to search and download the RPM packages.
RPM-based Linux won’t always have the YUM package manager installed. If you need to install YUM, it can be obtained 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 archive of configuration /etc/yum.conf, YUM allows you to place files from configuring repositories in the /etc/yum.pos.d/ directory. In this directory The settings for each repository are listed.
You can add extra repositories or “beta-test” software repositories in the repository list of YUM.
Some yum commands:
- yum list: List all available packages;
- yum check-update or yum list updates: Checks if there are packages available for an update;
- yum update: Update your system;
- yum Install: installs a specific package and its dependencies; yum
- removes <package (s) & gt;: Removes a specific package
- yum info : Shows basic information for a given package.
See the examples:
To install a package:
# yum install postgresql
Resolving Dependencies
Install 2 Package (s)
Is this ok [Y/n]: and
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 & nbsp; 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 loaded: priorities, update-motd, upgrade-helper
amzn-main/latest
; Resolving dependencies
—> Performing transaction verification
---> The aws-cli.noarch package 0:1 .7.5-1.2.amzn1 will be updated
---> The aws-cli.noarch package 0:1 .7.12-1.3.amzn1 will be an update
—> Completed dependency resolution
& nbsp; Resolved dependencies
=============================================================
Package Ark. Repo Tam version.
=======================================================================
Installing:
kernel& nbsp; x86_64 3.14.34-27.48.amzn1 amzn-updates 16 M
Updating:
; aws-cli noarch 1.7.12-1.3.amzn1 amzn-updates 604 k
Transaction Summary
& nbsp; ======================================================================= Install 1 Package (+4 Dependent packages)
; Upgrade 1 Package
Total download size: 16 M
Is this ok [Y/d/n]:
To remove a package:
yum remove postgresql
Resolving Dependencies
---> Package postgresql.x86_64 0:9 .0.4-5.fc15 will be erased
Is this ok [Y/n]: and
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, soon, 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 obtain information about a particular package:
# yum info mysql
yum info mysql
Plugins loaded: priorities, update-motd, upgrade-helper
newrelic & nbsp; & nbsp; 59/59
Installed packages
Name: mysql
Architecture & nbsp;: noarch
Version: 5.5
Release: 1.6.amzn1
Size: 0.0
Repo: installed
From repository: amzn-main
Summary: MySQL meta package
URL: http://www.mysql.com
License: GPLv2 with exceptions
Description: 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 view all available packages on yum repository:
# yum list
Installed packages
GeoIP.x86_64 1.4.8-1.5.amzn1 & nbsp; @amzn -main
GeoIP-Devel.x86_64 1.4.8-1.5.amzn1 @amzn -main
Pyyaml.x86_64& nbsp; 3.10-3.6.amzn1 installed
acl.x86_64 & nbsp; 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 what package a particular file is belongs to:
# yum provides /etc/sysconfig/nfs
Plugins loaded: 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
Result from:
File name: /etc/sysconfig/nfs
To find out which repositories are active in YUM:
# yum replist
repo id repo name status
amzn-main/latest AMZN-Main-Base 5.019
amzn-updates/latest AMZN-Updates-Base 1.085
newrelic/x86_64 & nbsp; New Relic packages 59
repolist: 6,163
Yumdownloader
Use:
# yumdownloader
The yumdownloader command does the downloading RPM files from the YUM repositories. It is useful for you to download the packages for later installation, or when installing packages in several machines, without the need to download the same package several 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 & nbsp; | 1.3 MB 00:00
Do you want to know if a Linux professional certification is worth penalty? Learn 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 made up your mind, check out our Certification Guide.
And if you want to know where to take the tests, check the list of cities.
If you want to know the language of the exams, check out this post.
Learn much more about Linux in our online course. You can enroll here with a free 7-day trial. If you already have an account, you can log in here.