Wednesday, September 18, 2013

Yummy yum for CentOSians

Lets say someone wants to install a package, or update a package or just wanted to check if there is any update of a package. The command "yum" would be pretty helpful for them. The basic syntax for yum would be like below:

yum install
Used to install the latest version of a package or group of packages.

yum update
Used to update the specified packages to the latest available version.

yum update stuck due to broken package: (Lets say due to firefox and java packages)

                                  vi /etc/yum.conf --> In main section add below line:
                                  exclude=firefox* java*

Then run the update again like below:
                                  yum update --skip-broken

yum check-update
This command allows you to determine whether any updates are available for your installed packages. yum returns a list of all package updates from all repositories if any are available.

yum localinstall
Used when using yum to install a package located locally in the machine

yum provides
Used to determine which packages provide a specific file or feature.

yum search
This command is used to find any packages containing the specified keyword in the description, summary, packager and package name fields of RPMs in all repositories.

To search for a specific package by name, use the list function. To search for the package tsclient, use the command: (provide root's password when prompts)

su -c 'yum list tsclient'

What about uninstalling a package? Yes yum will again help you in this regard.

yum remove
Used to remove specified packages, along with any other packages dependent on the packages being removed.

By default, yum is configured through /etc/yum.conf.

cat /etc/yum.conf

[main]
cachedir=/var/cache/yum
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
metadata_expire=1800

[myrepo]
name=RHEL 5 $releasever - $basearch
baseurl=http://local/path/to/yum/repository/
enabled=1
A typical /etc/yum.conf file is made up of two types of sections: a [main] section, and a repository section. There can only be one [main] section, but you can specify multiple repositories in a single /etc/yum.conf.
 

Blogger news

Blogroll