Thursday, March 2, 2017

YUM - Linux tool for managing updates.

9/4/2020:  DNF - Dandified yum is the next generation version of yum. See these links:
Commands work just like yum.
 
 
 
Yum is a package installer/remover for rpm systems. It can also update your system and is used mainly by the Linux systems such as Oracle Linux to simplify these tasks.
Some simple tasks using yum is to list,install, search, remove the packages on your system.

To list packages :
  • yum list installed  #list installed packages
  • yum list #Just list all
  • yum list |grep ^java  #find in the list
  • yum list 'tk*' #find in list

To remove a package
  • yum remove pkg #this will remove dependencies as well 
    yum erase pkg #similar to above
     
To install a package(s)
  • yum install pkg eg. yum install ksh
  • yum install libpng-devel ; gd-devel; openmotif-devel ; zlib-devel; expat-devel 
  • yum install gtk2-devel pango-devel glib2-devel pygtk2-devel python-devel
    libXt-devel  zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel rea
    dline-devel tk-devel gdbm-devel libpcap-devel xz-devel libX11-devel libpng-devel
      gd-devel openmotif-devel  zlib-devel expat-devel libglade2-devel numpy pycairo
    -devel pygobject2-devel expect perl-CPAN

To update package

  • yum update pkg
  • yum update-minimal --skip-broken 
If you just do yum update without pkg, then it will update entire system.

Few other very useful commands:
  • yum info package # Gives info on the package similar to rpm –qi
  • yum install yum-utils  #this package gives yumdownloader utility to download but not install packages.
  • repoquery --list package_name #Lists all file in package
  • yum provides "*bin/named"  #Find what package provides the given value
  • yum search gtk #Searches any package thus named 


Yum's configuration file contains other useful info. Eg. To setup a proxy for yum ,if you go over vpn do
vi /etc/yum.conf
proxy=http://host:80 
 
Yum can also work with group of packages. yum grouplist will display list of installed and available package groups. yum groupinfo GRP will display info on that group
.
Any changes yum does to your system gets recorded in a file ,most likely at location /var/log/yum.log . This is very useful to track changes .

" When a package is downloaded, installed and is removed there is a chance that the package may still be saved/stored in the yum’s cache. So to clean all the cached packages from the enabled repository cache directory, login as root and execute the following:
yum clean packages
To purge the old package information completely, execute the following command:
yum clean headers
To clean any cached xml metadata from any enabled repository, execute the following
yum clean metadata
If you wish to clean all the cached files from any enabled repository at once, execute the
yum clean all
" From Ref 6



PackageKit issue- This is where yum list complains that it is already running and locked by other process.

You should wait for it to clear up, if you know for a fact process is not running and is an issue, you could just kill the process as mentioned its pid.
Package kit can also be disabled in gnome via System > Preferences > Startup Applications

Dependencies issue
Rare cases few packages don't get installed due to latest version already available, if you need older version of it you need to remove that one.. Removing packages thus is not recommended, but can be done thus:
  •   rpm -e --nodeps graphite2-1.3.10-1.el7_3.i68
  •   rpm -e --nodeps graphite2-1.3.10-1.el7_3.x86_64


Instructions for manually connecting to Oracle Linux Yum Server can be found here:
http://public-yum.oracle.com/getting-started.html

/etc/yum.repos.d -> has repositories mentioned 

To get further help you can always do  yum -h , or man yum.




Finally, few good links on yum for further information:
  1. http://yum.baseurl.org/  #Yum Site
  2. http://docs.oracle.com/cd/E37670_01/ #OL6 documentation
  3. http://www.centos.org/docs/5/html/yum/index.html #YUM in Install guide
  4. http://www.thegeekstuff.com/2011/08/yum-command-examples/
  5. http://linuxgazette.net/issue68/nazario.html ##RPM
  6. https://kb.hivelocity.net/how-to-clear-the-yum-cache/
  7. http://public-yum.oracle.com/
  8. https://blogs.oracle.com/wim/entry/setting_up_oracle_linux_6
  9. Book: Practical guide to Linux Commands, Editors and Shell Programming by Mark G. Sobell. 

 

RPM

https://www.tecmint.com/20-practical-examples-of-rpm-commands-in-linux/

https://www.cyberciti.biz/howto/question/linux/linux-rpm-cheat-sheet.php

 

 

 

No comments: