Yum Log – Yum Install/remove/update log file location on CentOS/Redhat Server

What is Yum (Yellowdog Updater Modifier)

Yum (Yellowdog Updater Modifier) is used on RPM based linux distributions to install, update, remove, reinstall rpm packages. Yum will automatically download the required dependencies when you try to install any package.

yum package is installed by default on all linux servers during server installation.

[root@server ~]# rpm -qa | grep yum
yum-3.4.3-137.67.amzn1.noarch
yum-utils-1.1.31-34.28.amzn1.noarch
 

1. How to Install packages using yum

To install a new package you must run the command “yum install packagename”. Use “-y” option with yum install so that it will not ask for any confirmation while installing the package.

Command :

yum install packagename

OR

yum -y install packagename

Example :

I tried to install jwhois package on the below server and it shows ‘package is already installed on the server and it is the latest version’.

[root@server ~]# yum install jwhois

Package jwhois-4.0-19.7.amzn1.x86_64 already installed and latest version
Nothing to do

Example 2 :

Which command is not installed on my server and I am trying to install it.
 

[root@server ~]# yum install which

amzn-main/latest | 2.1 kB 00:00
amzn-updates/latest | 2.3 kB 00:00
Resolving Dependencies
–> Running transaction check
—> Package which.x86_64 0:2.19-6.10.amzn1 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

Install 1 Package

Total download size: 41 k
Installed size: 71 k
Is this ok [y/d/N]: y <--- Enter 'y' here to install the package Downloading packages: which-2.19-6.10.amzn1.x86_64.rpm | 41 kB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : which-2.19-6.10.amzn1.x86_64 1/1 Verifying : which-2.19-6.10.amzn1.x86_64 1/1 Installed: which.x86_64 0:2.19-6.10.amzn1 Complete!

 
Which command is installed on the above server.
 

2. How to Remove/Uninstall packages using yum

To remove a package you should run the command “yum remove packagename”.

Command :

yum remove packagename

OR

yum -y remove packagename

Example is given below :
 

[root@server ~]# yum remove jwhois
No Match for argument: jwhois
No Packages marked for removal

 
I tried to remove “jwhois” from the server and it shows there is no such package on the server (it might not installed or the package might be already uninstalled)

Example 2 :
 

[root@server ~]# yum remove which
Loaded plugins: priorities, universal-hooks, update-motd, upgrade-helper
Resolving Dependencies
–> Running transaction check
—> Package which.x86_64 0:2.19-6.10.amzn1 will be erased
–> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Removing:
which x86_64 2.19-6.10.amzn1 @amzn-main 71 k

Transaction Summary
========================================================================================================================================================================
Remove 1 Package

Installed size: 71 k
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : which-2.19-6.10.amzn1.x86_64 1/1
Verifying : which-2.19-6.10.amzn1.x86_64 1/1

Removed:
which.x86_64 0:2.19-6.10.amzn1

Complete!

I have removed which package on the above server.

How to upgrade a package using yum

If the package version is old, you can use the command “yum update packagename” to upgrade it to latest version.

Command :

yum update packagename

Example :

I upgraded kernel on the below server using yum update command
 

[root@server ~]# yum update kernel
Loaded plugins: priorities, universal-hooks, update-motd, upgrade-helper
Resolving Dependencies
–> Running transaction check
—> Package kernel.x86_64 0:4.4.44-39.55.amzn1 will be installed
–> Processing Dependency: dracut >= 004-336.27 for package: kernel-4.4.44-39.55.amzn1.x86_64
–> Running transaction check
—> Package dracut.noarch 0:004-409.31.amzn1 will be installed
–> Processing Dependency: which for package: dracut-004-409.31.amzn1.noarch
–> Running transaction check
—> Package which.x86_64 0:2.19-6.10.amzn1 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Installing:
kernel x86_64 4.4.44-39.55.amzn1 amzn-updates 17 M
Installing for dependencies:
dracut noarch 004-409.31.amzn1 amzn-main 128 k
which x86_64 2.19-6.10.amzn1 amzn-main 41 k

Transaction Summary
========================================================================================================================================================================
Install 1 Package (+2 Dependent packages)

Total download size: 17 M
Installed size: 69 M
Is this ok [y/d/N]: y
Downloading packages:
(1/3): dracut-004-409.31.amzn1.noarch.rpm | 128 kB 00:00
(2/3): kernel-4.4.44-39.55.amzn1.x86_64.rpm | 17 MB 00:00
(3/3): which-2.19-6.10.amzn1.x86_64.rpm | 41 kB 00:00
————————————————————————————————————————————————————————
Total 21 MB/s | 17 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : which-2.19-6.10.amzn1.x86_64 1/3
Installing : dracut-004-409.31.amzn1.noarch 2/3
Installing : kernel-4.4.44-39.55.amzn1.x86_64 3/3
Verifying : kernel-4.4.44-39.55.amzn1.x86_64 1/3
Verifying : dracut-004-409.31.amzn1.noarch 2/3
Verifying : which-2.19-6.10.amzn1.x86_64 3/3

Installed:
kernel.x86_64 0:4.4.44-39.55.amzn1

Dependency Installed:
dracut.noarch 0:004-409.31.amzn1 which.x86_64 0:2.19-6.10.amzn1

Complete!

 

Search a package using yum

Command : yum search packagename

All packages matching that package name will be displayed.
 

[root@server ~]# yum search phpmyadmin
Loaded plugins: priorities, universal-hooks, update-motd, upgrade-helper
======================================================================= N/S matched: phpmyadmin ========================================================================
cpanel-phpmyadmin.noarch : Admin tool for mysql written in PHP

Name and summary matches only, use “search all” for everything.

Yum localinstall command

“yum localinstall locaion” command will install the package from a local file, FTP or http.

Example : yum localinstall jwhois-3.2.3-12.el5.rpm

List all installed packages

yum list installed will show all installed packages on your linux server.

Command : yum list installed | less

Yum Provides, whatprovides

This will show which package the command/file belongs to

Example :

I just check what package provides whois command and it shows you must install “jwhois” package.

[root@server ~]# yum provides whois
jwhois-4.0-19.7.amzn1.x86_64
Filename : /usr/bin/whois

[root@server ~]# yum whatprovides whois
jwhois-4.0-19.7.amzn1.x86_64
Filename : /usr/bin/whois

 

Yum Install, remove and update log file location on CentOS/Redhat Linux Server


 

On CentOS/Redhat Linux Servers yum logs are saved in the /var/log directory.

Yum log file : /var/log/yum.log
 

root@server [/]# tail -n 10 /var/log/yum.log

 
“tail -n 10 /var/log/yum.log” – Use tail command to view the last 10 lines in yum log file.

Yum log (/var/log/yum.log) will show the date and month on which the package is installed/updated/removed.

Erased = The package is removed from the server
Updated = The package is updated on the server
Installed = Package installed on the server
 

root@server [/var/log]# tail -n 3 yum.log

Apr 27 00:04:16 Updated: nss-tools-3.21.0-9.el7_2.x86_64
Apr 28 21:59:56 Installed: whois-5.1.1-2.el7.x86_64
Apr 29 22:55:51 Erased: samba-libs-4.2.10-6.el7_2.x86_64

 
Package nss-tools is updated on April 27th server time 00:04:16. whois package is installed on April 28th and samba-libs is removed from the server on April 29th.

The below command will list all Installed packages on the server

root@server [/]# grep Installed /var/log/yum.log

Below command will list all packages removed from the server

root@server [/]# grep Erased /var/log/yum.log

Below command will list all packages updated on the server

root@server [/]# grep Updated /var/log/yum.log