How to fix lsb_release command not found on CentOS 7.3

In Ubuntu and all derivatives we can use the lsb_release command to display general information about the distro version, code name and other stuffs. But in other distribution such as CentOS, the lsb_command is not available by default. If you run lsb_release command you will get a command not found error message.

In case you need lsb_release to work with CentOS 7, we can have a look at which packages that provide the lsb_relase command.

[root@localhost ~]# yum provides lsb_release
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.nes.co.id
 * extras: mirror.nes.co.id
 * updates: mirror.nes.co.id
ce_stable/filelists                                                                                                            |  71 kB  00:00:00     
redhat-lsb-core-4.1-27.el7.centos.1.i686 : LSB Core module support
Repo        : base
Matched from:
Filename    : /usr/bin/lsb_release



redhat-lsb-core-4.1-27.el7.centos.1.x86_64 : LSB Core module support
Repo        : base
Matched from:
Filename    : /usr/bin/lsb_release

As you can see from the result above, lsb_release is provided by redhat-lsb-core package. We need to install this package.

[root@localhost ~]# yum install redhat-lsb-core
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.nes.co.id
 * extras: mirror.nes.co.id
 * updates: mirror.nes.co.id
Resolving Dependencies
--> Running transaction check
---> Package redhat-lsb-core.x86_64 0:4.1-27.el7.centos.1 will be installed
--> Processing Dependency: redhat-lsb-submod-security(x86-64) = 4.1-27.el7.centos.1 for package: redhat-lsb-core-4.1-27.el7.centos.1.x86_64
--> Processing Dependency: spax for package: redhat-lsb-core-4.1-27.el7.centos.1.x86_64
--> Processing Dependency: /usr/sbin/fuser for package: redhat-lsb-core-4.1-27.el7.centos.1.x86_64
--> Processing Dependency: /usr/bin/time for package: redhat-lsb-core-4.1-27.el7.centos.1.x86_64
--> Processing Dependency: /usr/bin/patch for package: redhat-lsb-core-4.1-27.el7.centos.1.x86_64
--> Processing Dependency: /usr/bin/m4 for package: redhat-lsb-core-4.1-27.el7.centos.1.x86_64
--> Processing Dependency: /usr/bin/lpr for package: redhat-lsb-core-4.1-27.el7.centos.1.x86_64
--> Processing Dependency: /usr/bin/lp for package: redhat-lsb-core-4.1-27.el7.centos.1.x86_64
--> Processing Dependency: /usr/bin/killall for package: redhat-lsb-core-4.1-27.el7.centos.1.x86_64
--> Processing Dependency: /usr/bin/bc for package: redhat-lsb-core-4.1-27.el7.centos.1.x86_64
--> Processing Dependency: /usr/bin/batch for package: redhat-lsb-core-4.1-27.el7.centos.1.x86_64
--> Processing Dependency: /usr/bin/at for package: redhat-lsb-core-4.1-27.el7.centos.1.x86_64
--> Processing Dependency: /bin/mailx for package: redhat-lsb-core-4.1-27.el7.centos.1.x86_64
--> Processing Dependency: /bin/ed for package: redhat-lsb-core-4.1-27.el7.centos.1.x86_64
--> Running transaction check
---> Package at.x86_64 0:3.1.13-22.el7 will be installed
---> Package bc.x86_64 0:1.06.95-13.el7 will be installed
---> Package cups-client.x86_64 1:1.6.3-26.el7 will be installed
--> Processing Dependency: cups-libs(x86-64) = 1:1.6.3-26.el7 for package: 1:cups-client-1.6.3-26.el7.x86_64
--> Processing Dependency: libcups.so.2()(64bit) for package: 1:cups-client-1.6.3-26.el7.x86_64
---> Package ed.x86_64 0:1.9-4.el7 will be installed
---> Package m4.x86_64 0:1.4.16-10.el7 will be installed
---> Package mailx.x86_64 0:12.5-12.el7_0 will be installed
---> Package patch.x86_64 0:2.7.1-8.el7 will be installed
---> Package psmisc.x86_64 0:22.20-11.el7 will be installed
---> Package redhat-lsb-submod-security.x86_64 0:4.1-27.el7.centos.1 will be installed
---> Package spax.x86_64 0:1.5.2-13.el7 will be installed
---> Package time.x86_64 0:1.7-45.el7 will be installed
--> Running transaction check
---> Package cups-libs.x86_64 1:1.6.3-26.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
 Package                                         Arch                        Version                                  Repository                 Size
======================================================================================================================================================
Installing:
 redhat-lsb-core                                 x86_64                      4.1-27.el7.centos.1                      base                       38 k
Installing for dependencies:
 at                                              x86_64                      3.1.13-22.el7                            base                       51 k
 bc                                              x86_64                      1.06.95-13.el7                           base                      115 k
 cups-client                                     x86_64                      1:1.6.3-26.el7                           base                      149 k
 cups-libs                                       x86_64                      1:1.6.3-26.el7                           base                      356 k
 ed                                              x86_64                      1.9-4.el7                                base                       72 k
 m4                                              x86_64                      1.4.16-10.el7                            base                      256 k
 mailx                                           x86_64                      12.5-12.el7_0                            base                      244 k
 patch                                           x86_64                      2.7.1-8.el7                              base                      110 k
 psmisc                                          x86_64                      22.20-11.el7                             base                      141 k
 redhat-lsb-submod-security                      x86_64                      4.1-27.el7.centos.1                      base                       15 k
 spax                                            x86_64                      1.5.2-13.el7                             base                      260 k
 time                                            x86_64                      1.7-45.el7                               base                       30 k

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

Total download size: 1.8 M
Installed size: 3.6 M
Is this ok [y/d/N]: 

Now try to use lsb_release command again

[root@localhost ~]# lsb_release -a
LSB Version:	:core-4.1-amd64:core-4.1-noarch
Distributor ID:	CentOS
Description:	CentOS Linux release 7.3.1611 (Core) 
Release:	7.3.1611
Codename:	Core

 

Admin

Leave a Reply

Your email address will not be published. Required fields are marked *