Quantcast
Channel: TechSpotting » fedora
Viewing all articles
Browse latest Browse all 6

YUM How To guide for Linux RPM distros Fedora, CentOS, RHEL

$
0
0

Ultimate how to guide for YUM the Linux package manager used on a number of Linux distributions such as Redhat RHEL, CentOS & Fedora. Yum uses repositories of RPM packages to download and install new software for your Linux server.

The instructions for YUM should be the same for each Linux distro CentOS, RHEL or Fedora.

How to update all RPM packages with YUM

yum update

How to update a single installed RPM package with YUM

yum update package-name

How to install RPM packages with YUM

yum install package-name

How to exclude a package from being updated with YUM

Say for example you want to update your system but you do not want the kernel to be updated…

yum --exclude=package kernel* update

How to check what packages need updating using YUM

This command checks all packages on Fedora, CentOS or RHEL to see if they need updating.

check-update 

Uninstall Packages using YUM

yum remove package-name

Or…

yum erase package-name

List information about about Packages with YUM

To find out more information about packages with use “yum list” it is best used with a package name, otherwise it will list info about all the packages in the YUM repos you have installed ;)

 
yum list package-name

Yum – Find out what a package does

For example if you want to find out what the httpd package does…

yum provides httpd

Which should display something similar to the following:

httpd-2.2.15-5.el6.centos.x86_64 : Apache HTTP Server

Search for a package with YUM

If you don’t know the name of the package search for it, this will search through the RPM’s info looking for the string you have provided. Say for example I want to find the package name for Bacula but I don’t know the name of it, I would enter the following:

yum search bacula

Which would give me the following out put:

[root@skywalker ~]# yum search bacula
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.netrino.co.uk
 * extras: mirror.netrino.co.uk
 * updates: mirror.netrino.co.uk
================================================= Matched: bacula =================================================
bacula-client.x86_64 : Bacula backup client
bacula-common.x86_64 : Common Bacula utilities
bacula-console.x86_64 : Bacula management console
bacula-console-bat.x86_64 : Bacula bat console
bacula-director-common.x86_64 : Common Bacula Director files
bacula-director-mysql.x86_64 : Bacula Director with MySQL database support
bacula-director-postgresql.x86_64 : Bacula Director with PostgresSQL database support
bacula-director-sqlite.x86_64 : Bacula Director with sqlite database support
bacula-docs.x86_64 : Bacula documentation
bacula-storage-common.x86_64 : Common Bacula storage daemon files
bacula-storage-mysql.x86_64 : MySQL Bacula storage daemon files
bacula-storage-postgresql.x86_64 : Common Bacula storage daemon files
bacula-storage-sqlite.x86_64 : SQLite Bacula storage daemon files
bacula-traymonitor.x86_64 : Bacula monitor for the Gnome and KDE system tray

Note if you search for something like apache, then you are going to get a huge list of packages so you might want to use the less or more command to allow easy scrolling of the output.

How to list yum Package info for a package

This is my favorite way of listing package info with yum, personally I do not use list I always use info, below is an example of the yum info command with httpd.

[root@skywalker ~]# yum info httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.netrino.co.uk
 * extras: mirror.netrino.co.uk
 * updates: mirror.netrino.co.uk
Available Packages
Name       : httpd
Arch       : x86_64
Version    : 2.2.15
Release    : 5.el6.centos
Size       : 811 k
Repo       : base
Summary    : Apache HTTP Server
URL        : http://httpd.apache.org/
License    : ASL 2.0
Description: The Apache HTTP Server is a powerful, efficient, and extensible
           : web server.

How to clean up the yum cache and downloaded packages

Everytime you install packages with yum it downloads an RPM and installs it, over time these RPM files can take up a lot of space… To clear up yum enter:

yum clean all

How to use YUM to install local RPM files

Say for example you need to build your own RPM and install it locally you can use YUM to resolve dependancies this package might have from it’s repositories by using the following:

yum localinstall package-name.rpm

Use YUM to update a local RPM package

If you want to update a local rpm package using YUM enter the following:

 
yum localupdate update-package.rpm

Find out what dependancies an RPM package has

How to find out what deps a package has using yum, might be handy if you need to do a source install for something (shame on you!). deplist will show you what the package depends on and what packages provide them.

 
yum deplist package-name

How to use YUM Priorities

If you have a bunch of different repos installed on your system like the EPEL repo and you want to make sure when you install a package or update your system the packages come from the base system first if they don’t exist there then use a 3rd party repo. I would recommend you go follow our guide on How to use YUM priorities and check this guide out if you need instructions on how to install the EPEL repo.

Find out what version of YUM you have installed

yum -v

How to install packages into a chroot with YUM

If you need to install packages into a chroot with YUM then use the following:

yum --installroot=/path/to/chroot/

Enable a disabled YUM repository on the command line

If you have a repo installed and you need to enable that repo to install a package, you can enter:

yum --enablerepo=epel install rsnapshot

The above example would install rsnapshot from the epel repo if you had it installed but disabled.

Disabled a YUM repository on the command line

If you have a repo installed and you need to disable that repo to prevent yum from installing a package form it, you can enter:

yum --disablerepo=epel install package-name

That’s about all I do with YUM on my RHEL / CentOS & Fedora Linux servers, if you can think of any other handy tips drop me a comment! Don’t forget to subscribe to our RSS feed or follow us on Twitter.

Technorati Tags: CentOS, fedora, How-To, HowTo, install, Linux, package manager, RHEL, RPM, software, YUM


Viewing all articles
Browse latest Browse all 6

Trending Articles