安装lsb_release

lsb_release命令用于查看Linux系统的发行版信息,包括发行版类型和版本号。当系统未预装此命令时,可以查看/etc/issue文件获取信息。要安装lsb_release,通常需要使用yum provides来查找包含该命令的软件包,然后通过yum install进行安装。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

lsb_release命令用来查看当前系统的发行版信息(prints certain LSB (Linux Standard Base) and Distribution information.)。有了这个命令就可以清楚的知道到底是RedHat的、还是别的发行版,还有具体的版本号,比如3.4还是5.4等等。有些系统上不一定安装了这个命令,可以通过查看/etc/issue文件得到发行版信息。

[root@localhost linux-3.18.26]# cat /etc/issue
CentOS release 6.6 (Final)
Kernel \r on an \m

但一般这个命令用习惯了,如果没有我们可以安装一下。具体步骤如下:

1)查找哪个源包含这个命令

[root@localhost linux-3.18.26]# yum provides */lsb_release
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
redhat-lsb-core-4.0-7.el6.centos.x86_64 : LSB base libraries support for CentOS
Repo        : ustack_custom_products
Matched from:
Filename    : /usr/bin/lsb_release
2)从上面的输出可以看到redhat-lsb-core-4.0-7.el6.centos.x86_64这个package包含这个命令,那就安装这个包。
64ot@localhost linux-3.18.26]# yum install redhat-lsb-core-4.0-7.el6.centos.x86_
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package redhat-lsb-core.x86_64 0:4.0-7.el6.centos will be installed
--> Processing Dependency: perl-Test-Simple for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: perl-Test-Harness for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: perl-ExtUtils-MakeMaker for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: perl-CGI for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: /usr/bin/time for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: /usr/bin/pax for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: /usr/bin/patch for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: /usr/bin/msgfmt for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: /usr/bin/man for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: /usr/bin/batch for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: /usr/bin/at for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: /bin/mailx for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: /bin/gettext for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: /bin/ed for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Running transaction check
---> Package at.x86_64 0:3.1.10-43.el6_2.1 will be installed
---> Package ed.x86_64 0:1.1-3.3.el6 will be installed
---> Package gettext.x86_64 0:0.17-16.el6 will be installed
--> Processing Dependency: cvs for package: gettext-0.17-16.el6.x86_64
---> Package mailx.x86_64 0:12.4-7.el6 will be installed
---> Package man.x86_64 0:1.6f-32.el6 will be installed
--> Processing Dependency: lzma for package: man-1.6f-32.el6.x86_64
---> Package patch.x86_64 0:2.6-6.el6 will be installed
---> Package pax.x86_64 0:3.4-10.1.el6 will be installed
---> Package perl-CGI.x86_64 0:3.51-131.el6_4 will be installed
---> Package perl-ExtUtils-MakeMaker.x86_64 0:6.55-131.el6_4 will be installed
--> Processing Dependency: perl-devel for package: perl-ExtUtils-MakeMaker-6.55-131.el6_4.x86_64
---> Package perl-Test-Harness.x86_64 0:3.17-131.el6_4 will be installed
---> Package perl-Test-Simple.x86_64 0:0.92-131.el6_4 will be installed
---> Package time.x86_64 0:1.7-37.1.el6 will be installed
--> Running transaction check
---> Package cvs.x86_64 0:1.11.23-15.el6 will be installed
---> Package perl-devel.x86_64 4:5.10.1-131.el6_4 will be installed
--> Processing Dependency: perl(ExtUtils::ParseXS) for package: 4:perl-devel-5.10.1-131.el6_4.x86_64
---> Package xz-lzma-compat.x86_64 0:4.999.9-0.5.beta.20091007git.el6 will be installed
--> Running transaction check
---> Package perl-ExtUtils-ParseXS.x86_64 1:2.2003.0-131.el6_4 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package               Arch   Version              Repository              Size
================================================================================
Installing:
 redhat-lsb-core       x86_64 4.0-7.el6.centos     ustack_custom_products  25 k
Installing for dependencies:
 at                    x86_64 3.1.10-43.el6_2.1    ustack_custom_products  60 k
 cvs                   x86_64 1.11.23-15.el6       ustack_custom_products 711 k
 ed                    x86_64 1.1-3.3.el6          ustack_custom_products  72 k
 gettext               x86_64 0.17-16.el6          ustack_custom_products 1.8 M
 mailx                 x86_64 12.4-7.el6           ustack_custom_products 235 k
 man                   x86_64 1.6f-32.el6          ustack_custom_products 263 k
 patch                 x86_64 2.6-6.el6            ustack_custom_products  90 k
 pax                   x86_64 3.4-10.1.el6         ustack_custom_products  69 k
 perl-CGI              x86_64 3.51-131.el6_4       ustack_custom_products 208 k
 perl-ExtUtils-MakeMaker
                       x86_64 6.55-131.el6_4       ustack_custom_products 292 k
 perl-ExtUtils-ParseXS x86_64 1:2.2003.0-131.el6_4 ustack_custom_products  44 k
 perl-Test-Harness     x86_64 3.17-131.el6_4       ustack_custom_products 230 k
 perl-Test-Simple      x86_64 0.92-131.el6_4       ustack_custom_products 111 k
 perl-devel            x86_64 4:5.10.1-131.el6_4   ustack_custom_products 421 k
 time                  x86_64 1.7-37.1.el6         ustack_custom_products  26 k
 xz-lzma-compat        x86_64 4.999.9-0.5.beta.20091007git.el6
                                                   ustack_custom_products  16 k

Transaction Summary
================================================================================
Install      17 Package(s)

Total download size: 4.6 M
Installed size: 12 M
Is this ok [y/N]: y
Downloading Packages:
(1/17): at-3.1.10-43.el6_2.1.x86_64.rpm                  |  60 kB     00:00
(2/17): cvs-1.11.23-15.el6.x86_64.rpm                    | 711 kB     00:00
(3/17): ed-1.1-3.3.el6.x86_64.rpm                        |  72 kB     00:00
(4/17): gettext-0.17-16.el6.x86_64.rpm                   | 1.8 MB     00:00
(5/17): mailx-12.4-7.el6.x86_64.rpm                      | 235 kB     00:00
(6/17): man-1.6f-32.el6.x86_64.rpm                       | 263 kB     00:00
(7/17): patch-2.6-6.el6.x86_64.rpm                       |  90 kB     00:00
(8/17): pax-3.4-10.1.el6.x86_64.rpm                      |  69 kB     00:00
(9/17): perl-CGI-3.51-131.el6_4.x86_64.rpm               | 208 kB     00:00
(10/17): perl-ExtUtils-MakeMaker-6.55-131.el6_4.x86_64.r | 292 kB     00:00
(11/17): perl-ExtUtils-ParseXS-2.2003.0-131.el6_4.x86_64 |  44 kB     00:00
(12/17): perl-Test-Harness-3.17-131.el6_4.x86_64.rpm     | 230 kB     00:00
(13/17): perl-Test-Simple-0.92-131.el6_4.x86_64.rpm      | 111 kB     00:00
(14/17): perl-devel-5.10.1-131.el6_4.x86_64.rpm          | 421 kB     00:00
(15/17): redhat-lsb-core-4.0-7.el6.centos.x86_64.rpm     |  25 kB     00:00
(16/17): time-1.7-37.1.el6.x86_64.rpm                    |  26 kB     00:00
(17/17): xz-lzma-compat-4.999.9-0.5.beta.20091007git.el6 |  16 kB     00:00
--------------------------------------------------------------------------------
Total                                           2.7 MB/s | 4.6 MB     00:01
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 1:perl-ExtUtils-ParseXS-2.2003.0-131.el6_4.x86_64           1/17
  Installing : 4:perl-devel-5.10.1-131.el6_4.x86_64                        2/17
  Installing : perl-Test-Harness-3.17-131.el6_4.x86_64                     3/17
  Installing : perl-ExtUtils-MakeMaker-6.55-131.el6_4.x86_64               4/17
  Installing : perl-Test-Simple-0.92-131.el6_4.x86_64                      5/17
  Installing : at-3.1.10-43.el6_2.1.x86_64                                 6/17
  Installing : time-1.7-37.1.el6.x86_64                                    7/17
  Installing : cvs-1.11.23-15.el6.x86_64                                   8/17
  Installing : gettext-0.17-16.el6.x86_64                                  9/17
  Installing : perl-CGI-3.51-131.el6_4.x86_64                             10/17
  Installing : pax-3.4-10.1.el6.x86_64                                    11/17
  Installing : patch-2.6-6.el6.x86_64                                     12/17
  Installing : mailx-12.4-7.el6.x86_64                                    13/17
  Installing : xz-lzma-compat-4.999.9-0.5.beta.20091007git.el6.x86_64     14/17
  Installing : man-1.6f-32.el6.x86_64                                     15/17
  Installing : ed-1.1-3.3.el6.x86_64                                      16/17
  Installing : redhat-lsb-core-4.0-7.el6.centos.x86_64                    17/17
  Verifying  : man-1.6f-32.el6.x86_64                                      1/17
  Verifying  : perl-Test-Harness-3.17-131.el6_4.x86_64                     2/17
  Verifying  : ed-1.1-3.3.el6.x86_64                                       3/17
  Verifying  : xz-lzma-compat-4.999.9-0.5.beta.20091007git.el6.x86_64      4/17
  Verifying  : 1:perl-ExtUtils-ParseXS-2.2003.0-131.el6_4.x86_64           5/17
  Verifying  : redhat-lsb-core-4.0-7.el6.centos.x86_64                     6/17
  Verifying  : perl-ExtUtils-MakeMaker-6.55-131.el6_4.x86_64               7/17
  Verifying  : mailx-12.4-7.el6.x86_64                                     8/17
  Verifying  : patch-2.6-6.el6.x86_64                                      9/17
  Verifying  : gettext-0.17-16.el6.x86_64                                 10/17
  Verifying  : pax-3.4-10.1.el6.x86_64                                    11/17
  Verifying  : perl-CGI-3.51-131.el6_4.x86_64                             12/17
  Verifying  : cvs-1.11.23-15.el6.x86_64                                  13/17
  Verifying  : time-1.7-37.1.el6.x86_64                                   14/17
  Verifying  : perl-Test-Simple-0.92-131.el6_4.x86_64                     15/17
  Verifying  : at-3.1.10-43.el6_2.1.x86_64                                16/17
  Verifying  : 4:perl-devel-5.10.1-131.el6_4.x86_64                       17/17

Installed:
  redhat-lsb-core.x86_64 0:4.0-7.el6.centos

Dependency Installed:
  at.x86_64 0:3.1.10-43.el6_2.1
  cvs.x86_64 0:1.11.23-15.el6
  ed.x86_64 0:1.1-3.3.el6
  gettext.x86_64 0:0.17-16.el6
  mailx.x86_64 0:12.4-7.el6
  man.x86_64 0:1.6f-32.el6
  patch.x86_64 0:2.6-6.el6
  pax.x86_64 0:3.4-10.1.el6
  perl-CGI.x86_64 0:3.51-131.el6_4
  perl-ExtUtils-MakeMaker.x86_64 0:6.55-131.el6_4
  perl-ExtUtils-ParseXS.x86_64 1:2.2003.0-131.el6_4
  perl-Test-Harness.x86_64 0:3.17-131.el6_4
  perl-Test-Simple.x86_64 0:0.92-131.el6_4
  perl-devel.x86_64 4:5.10.1-131.el6_4
  time.x86_64 0:1.7-37.1.el6
  xz-lzma-compat.x86_64 0:4.999.9-0.5.beta.20091007git.el6

Complete!
3)验证命令。
[root@localhost linux-3.18.26]# lsb_release -a
LSB Version:	:base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch
Distributor ID:	CentOS
Description:	CentOS release 6.6 (Final)
Release:	6.6
Codename:	Final
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值