Differences between yum info and yumdb info with Example

 Command Line, Linux  Comments Off on Differences between yum info and yumdb info with Example
Apr 262016
 

Wise folks say a picture is worth a thousand words.

In Linux, an example is worth ten thousand words.

In this post, we’ll use an example to understand the difference between the commands yum info and yumdb info.

For purpose of this post, I will use the popular Cherrytree notes application.

In both examples I’ve run the commands after installing cherrytree.

By the way, I’m running the below commands on a CentOS 7 system.

So here we go, first with the yum info command.

yum info

[tommy@localhost ~]$ yum info cherrytree
Loaded plugins: aliases, changelog, fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: linux.cc.lehigh.edu
 * epel: mirrors.mit.edu
 * extras: mirror.vtti.vt.edu
 * updates: mirror.net.cen.ct.gov
Installed Packages
Name        : cherrytree
Arch        : noarch
Version     : 0.36.9
Release     : 1.el7
Size        : 3.1 M
Repo        : installed
From repo   : epel
Summary     : Hierarchical note taking application
URL         : http://www.giuspen.com/cherrytree/
License     : GPLv3+
Description : CherryTree is a hierarchical note taking application, featuring rich text and
            : syntax highlighting, storing all the data (including images) in a single XML
            : file with extension ".ctd".

Now let’s consider yumdb info with the same cherrytree application.

yumdb info

[tommy@localhost ~]$ yumdb info cherrytree
Loaded plugins: fastestmirror, langpacks
cherrytree-0.36.9-1.el7.noarch
checksum_data = febc31650e96f822cb1a4e52c66aa4a9e71503f861680b3fa3385a478300b7ed
checksum_type = sha256
command_line = install cherrytree
from_repo = epel
from_repo_revision = 1461632780
from_repo_timestamp = 1461640240
installed_by = 1000
origin_url = http://ftp.osuosl.org/pub/fedora-epel/7/x86_64/c/cherrytree-0.36.9-1.el7.noarch.rpm
reason = user
releasever = 7
var_infra = stock
var_uuid = 72c6b420-9095-4304-90a7-fbb60a47ec6a
[tommy@localhost ~]$ 

yumdb info provides information like the checksum data and type, command used to install it, the repository and the person (userid) who installed it but nothing about the application or the developer.

However yum info provides information about the application (both in summary form and in a slightly longer version) as well as the file size. But yum info provides no information about the checksum data or type, the command used for installation or the person (userid) who installed it.

So which command you want to use will depend on your unique needs.

 Posted by at 12:34 pm

How to Change Default Kernel in CentOS 7

 Command Line, Linux  Comments Off on How to Change Default Kernel in CentOS 7
Mar 282016
 

A typical CentOS 7 Linux system has multiple kernels.

How many kernels you have in your CentOS systems depends on the configuration setting.

Sometimes you might feel the need to change the default kernel to a different one (it may be an older or newer kernel) to ensure a particular application runs well.

Here’s how to change the default kernel at boot time.

List Available Kernels

First, let’s list the available kernels on our CentOS 7 system with the following command (you need to be root).

$ sudo egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \'
CentOS Linux (3.10.0-327.10.1.el7.x86_64) 7 (Core)
CentOS Linux (3.10.0-327.4.5.el7.x86_64) 7 (Core)
CentOS Linux (3.10.0-327.4.4.el7.x86_64) 7 (Core)
CentOS Linux (3.10.0-327.3.1.el7.x86_64) 7 (Core)
CentOS Linux (3.10.0-229.20.1.el7.x86_64) 7 (Core)
CentOS Linux, with Linux 0-rescue-ddf73bd8a3a44950a327a6961955c015

Once you have the kernel list, you can decide which kernel you want as the default boot kernel.

Change Default Kernel

Multiple kernel boot options are available to us in the above list.

Now it’s time to set our preferred boot kernel.

Important – The boot options in the above kernel list start at 0.

So if you want the 3.10.0-229.20.1.el7.x86_64 kernel as the default kernel, note that its boot option will be 4 in the above list.

Now let’s set 3.10.0-229.20.1.el7.x86_64 as our default kernel with the sudo grub2-set-default command.

$ sudo grub2-set-default 4

After changing the default kernel, you must reboot (remember to close all your open applications).

$ sudo reboot

Once the system has come up after reboot, it’s time to check if the default kernel has changed via the uname -r command.

$ uname -r 
3.10.0-229.20.1.el7.x86_64

Voila, changing the default boot kernel in CentOS 7 is as simple as that.

Related Posts
Get Rid of Old Kernels in CentOS 7 and Red Hat 7
 Posted by at 11:50 am  Tagged with:

How to Shut Down or Reboot Linux from Command Line

 Command Line, Linux  Comments Off on How to Shut Down or Reboot Linux from Command Line
Dec 042015
 

If you love tinkering with Linux, here’s something to pique your interest.

In this post, we’ll look at various methods to shut down or reboot a Linux system via the terminal.

Shutdown, poweroff, and reboot are three commands to shut down or reboot a Linux system.

I recommend you install Oracle’s free Virtualbox virtualization software and then install a guest OS (CentS or Ubuntu) before running the below commands on it to avoid accidentally disrupting important running processes.

Shut Down Linux

There are multiple options to shut down a Linux system on the command line.

Let’s first consider the shutdown and poweroff commands.

You can use the shutdown command to both shut down and reboot a Linux system.

First, we’ll look at the commands to shut down the system and then run through the commands for rebooting.

$ shutdown
Must be root.

As we see above, we need to be root or use sudo to run the shutdown command.

So we’ll run the command again, this time with sudo.

[jason@localhost ~]$ sudo shutdown
[sudo] password for jason: 
Shutdown scheduled for Thu 2015-12-03 21:02:24 EST, use 'shutdown -c' to cancel.
[jason@localhost ~]$ 
Broadcast message from root@localhost.localdomain (Thu 2015-12-03 21:01:25 EST):
The system is going down for power-off at Thu 2015-12-03 21:02:24 EST!

As we note above, the system provides users with advance notice of the impending power-off.

Shut Down Immediately

$ sudo shutdown now

When you run the above command, the system will shut down immediately so make sure you have everything saved and no important processes running.

Delayed Shut Down
Say you want to shut down your Linux system after three minutes.

Here’s the command for that.

[jason@localhost ~]$ sudo shutdown 3
[sudo] password for jason: 
Shutdown scheduled for Thu 2015-12-03 22:55:16 EST, use 'shutdown -c' to cancel.
Broadcast message from root@localhost.localdomain (Thu 2015-12-03 22:53:16 EST):
The system is going down for power-off at Thu 2015-12-03 22:55:16 EST!

You can even specify the exact time for the system to be shut down.

[jason@localhost ~]$ sudo shutdown 11:45
Shutdown scheduled for Fri 2015-12-04 11:45:00 EST, use 'shutdown -c' to cancel.
[jasoni@localhost ~]$ 
Broadcast message from root@localhost.localdomain (Fri 2015-12-04 11:35:27 EST):
The system is going down for power-off at Fri 2015-12-04 11:45:00 EST!

Remember to use 24-hour time for PM (so for a scheduled shut down at 1:35PM you must write sudo shutdown 13:35).

Cancel Shut Down

What if you change your mind. Continue reading »

 Posted by at 12:54 pm

How to Check Yum History in Red Hat or CentOS

 Command Line, Linux  Comments Off on How to Check Yum History in Red Hat or CentOS
Nov 252015
 

One of the most frequently used commands by Linux administrators of a Red Hat or CentOS system is the yum package management tool.

Yum History – What For?

Some would argue that Yum is the most powerful tool in a Linux systems administrator’s command line arsenal.

So what does yum do?

Yum is used for installing and upgrading packages, checking for updates, searching for packages, listing installed and available packages, downloading packages, adding and enabling/disabling repositories and installing local packages.

The beauty of yum is that when you install an update or package it automatically resolves dependencies (i.e. it installs all the other software required for your package to work).

But why is the yum history of any importance to a Linux administrator?

Knowing what commands we ran with yum and when we ran them is extremely useful in investigating problems, should they arise, and to roll back updates or remove packages if necessary.

Here are a few key commands to check yum history.

Remember to run yum history commands as root or sudo.

1. List the Last 20 Yum Transactions

$ sudo yum history list
Loaded plugins: aliases, changelog, fastestmirror, langpacks
ID     | Command line             | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
   102 | update mate*             | 2015-11-24 09:32 | Update         |    1   
   101 | update atril             | 2015-11-24 09:31 | Update         |    3  
   100 | update -y                | 2015-11-18 10:15 | Update         |    1 
    99 | update -y                | 2015-11-14 09:09 | Update         |    1   
    98 |                          | 2015-11-11 14:14 | Erase          |    4 EE
    97 | update -y                | 2015-11-11 09:29 | Update         |    1 EE
    96 | update -y                | 2015-11-06 15:11 | Update         |    6
    [output truncated]

2. List All Yum Transactions

The below command will spit out the entire history of yum commands which can go back a year or even earlier depending on the age of your CentOS or RedHat system.

$ sudo yum history list all
Loaded plugins: aliases, changelog, fastestmirror, langpacks
ID     | Login user  | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
   103 | michaelpc   | 2015-11-25 16:14 | Update         |    1   
   102 | michaelpc   | 2015-11-24 09:32 | Update         |    1   
   101 | michaelpc   | 2015-11-24 09:31 | Update         |    3  <
   100 | michaelpc   | 2015-11-18 10:15 | Update         |    1 > 
    99 | michaelpc   | 2015-11-14 09:09 | Update         |    1   
    98 | michaelpc   | 2015-11-11 14:14 | Erase          |    4 EE
    97 | michaelpc   | 2015-11-11 09:29 | Update         |    1 EE
    [output truncated]

3. Selective Yum History

The yum history command is flexible enough that you can tweak it to get the output you want.

For instance, in the below example we’re looking at yum history from IDs 20 through 25.

$ sudo yum history list 20..25
Loaded plugins: aliases, changelog, fastestmirror, langpacks
ID     | Command line             | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    25 | install clamtk-5.15-1.el | 2015-03-30 08:06 | Install        |   44   
    24 | install clamav clamtk    | 2015-03-30 08:00 | Install        |    4   
    23 | groupinstall MATE Deskto | 2015-03-23 09:38 | Install        |  133   
    22 | install docker           | 2015-03-22 08:51 | Install        |    1   
    21 | install yum-plugin-chang | 2015-03-13 21:57 | Install        |    2   
    20 | install yum-plugin-alias | 2015-03-13 21:55 | Install        |    1

4. Specific Yum Event
In this below example from my CentOS 7 system, when I ran yum history for ID 25, I found that on March 30, 2015 at 8:06AM I’d installed the Clam anti-virus software.

Now you see how powerful yum history is.

$ sudo yum history list 25
Loaded plugins: aliases, changelog, fastestmirror, langpacks
ID     | Command line             | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    25 | install clamtk-5.15-1.el | 2015-03-30 08:06 | Install        |   44

5. Yum History Summary

When all you’re looking for is the summary of yum history, the below command is what you’d run.

$ sudo yum history summary
Loaded plugins: aliases, changelog, fastestmirror, langpacks
Login user    | Time                | Action(s)        | Altered 
-------------------------------------------------------------------------------
michaelpc     | Last day            | Update           |        1
michaelpc     | Last week           | Update           |        4
michaelpc     | Last 2 weeks        | Update           |        2
michaelpc     | Last 3 months       | D, E, I, U       |      208
michaelpc     | Last 6 months       | E, I, O, U       |      313
System        | Last 6 months       | Install          |        1
michaelpc     | Last year           | E, I, O, U       |     2026
System        | Last year           | I, U             |    363

Folks, I hope the above post has given you a good overview of yum history commands.

 Posted by at 9:58 pm  Tagged with:

How to Set Up Password Aging on CentOS 7

 Command Line, Linux  Comments Off on How to Set Up Password Aging on CentOS 7
Aug 052015
 

How to Set Password Aging on CentOS 7In this age of relentless online attacks by criminals, forcing password changes upon users is a must adopt security policy.

As any seasoned Linux system administrator will tell you, only idiots don’t implement password aging.

The concept of setting timelines for password validity is known as password aging.

The key advantage of password aging (forcing password changes) is that even if a password is cracked or stolen, its value to criminals is only for a short window of time.

In a sign of its importance, some US banks are already enforcing password changes for its customers at periodic intervals (90 days, 120 days or 180 days, depending on the bank).

Password Aging on CentOS 7

In this post, we’ll examine how to set up password aging on CentOS 7 and Red Hat Enterprise Linux 7. Continue reading »

Linux Tip of the Day – Yum Search vs Yum List

 Command Line  Comments Off on Linux Tip of the Day – Yum Search vs Yum List
Jul 292015
 

Yum Search vs Yum ListYum is one of the most powerful tools in the arsenal of a RedHat or CentOS systems administrator for package management.

When installing, upgrading, removing or searching for packages, yum is the best choice because it automatically resolves dependencies.

In this post, let’s examine the difference between yum search and yum list commands.

While both command are used to find a package, yum search is more comprehensive.

When you run yum search, the command searches for package name, summaries and description.

But yum list only looks for the search term in the package name.

Here’s an example of how the two commands differ in their results.

Let’s first try yum search without any glob expression.

# yum search vim
vim-gtk-syntax.noarch : Vim syntax highlighting for GLib, Gtk+, Gstreamer, and more
vim-vimoutliner.noarch : Script for building an outline editor on top of Vim
beakerlib-vim-syntax.noarch : Files for syntax highlighting BeakerLib tests in VIM editor
golang-vim.noarch : Vim plugins for Go
protobuf-vim.x86_64 : Vim syntax highlighting for Google Protocol Buffers descriptions
vim-X11.x86_64 : The VIM version of the vi editor for the X Window System
vim-clustershell.noarch : VIM files for ClusterShell
vim-common.x86_64 : The common files needed by any version of the VIM editor
vim-enhanced.x86_64 : A version of the VIM editor which includes recent enhancements
vim-filesystem.x86_64 : VIM filesystem layout
vim-minimal.x86_64 : A minimal version of the VIM editor
vile-common.x86_64 : The common files needed by any version of the VIM editor
youtube-dl.noarch : A small command-line program to download online videos

As we can see in the above output, vim is present in both the package name and description.

Now let’s run the yum list command with the wildcard character * and examine the results.

# yum list '*vim*'
Installed Packages
vim-common.x86_64                                                                        2:7.4.160-1.el7                                                               @base    
vim-enhanced.x86_64                                                                      2:7.4.160-1.el7                                                               @base    
vim-filesystem.x86_64                                                                    2:7.4.160-1.el7                                                               @base    
vim-minimal.x86_64                                                                       2:7.4.160-1.el7                                                               @anaconda
Available Packages
beakerlib-vim-syntax.noarch                                                              1.10-2.el7                                                                    epel     
golang-vim.noarch                                                                        1.3.3-3.el7                                                                   base     
protobuf-vim.x86_64                                                                      2.5.0-7.el7                                                                   epel     
vim-X11.x86_64                                                                           2:7.4.160-1.el7                                                               base     
vim-clustershell.noarch                                                                  1.6-4.el7                                                                     epel     
vim-gtk-syntax.noarch                                                                    20130716-1.el7                                                                epel     
vim-vimoutliner.noarch                                                                   0.3.7-5.el7                                                                   epel

As we see from the above results, yum list only considers the search term in the package name.

By the way, yum search all is even more exhaustive but runs a bit slower.

 Posted by at 3:56 pm