安装lsb_release
lsb_release命令用来查看当前系统的发行版信息(prints certain LSB (Linux Standard Base) and Distribution information.)。有了这个命令就可以清楚的知道到底是RedHat的、还是别的发行版,还有具体的版本号,比如3.4还是5.4等等。有些系统上不一定安装了这个命令,可以通过查看/etc/issue文件得到发行版信息。
例如
[root@localhost ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.2.1511 (Core)
Release: 7.2.1511
Codename: Core
但是如果没有这个的话,直接通过命令行yum install lsb_release安装的结果是这样的:
[root@localhost bin]# yum install lsb_release
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: mirrors.cn99.com
* updates: centos.ustc.edu.cn
No package lsb_release available.
Error: Nothing to do
自己安装的经历,找了好多博客,最后这样成功了:
1.查找哪个源包含这个命令
[root@localhost ~]# yum provides */lsb_release
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: mirrors.cn99.com
* updates: centos.ustc.edu.cn
base/7/x86_64/filelists_db | 6.7 MB 00:00:04
extras/7/x86_64/filelists_db | 528 kB 00:00:00
updates/7/x86_64/filelists_db | 3.0 MB 00:00:07
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
2.从上面的输出可以看到redhat-lsb-core-4.1-27.el7.centos.1.x86_64 这个package包含这个命令,那就安装这个包。
[root@localhost ~]# yum install redhat-lsb-core-4.1-27.el7.centos.1.x86_64
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* extras: mirrors.cn99.com
* updates: centos.ustc.edu.cn
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/bin/m4 for package: redhat-lsb-core-4.1-27.el7.centos.1.x86_64
--> Running transaction check
---> Package m4.x86_64 0:1.4.16-10.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
--> 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:
m4 x86_64 1.4.16-10.el7 base 256 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
Transaction Summary
===================================================================================
Install 1 Package (+3 Dependent packages)
Total download size: 569 k
Installed size: 1.1 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): spax-1.5.2-13.el7.x86_64.rpm | 260 kB 00:00:00
(2/4): redhat-lsb-core-4.1-27.el7.centos.1.x86_64.rpm | 38 kB 00:00:00
(3/4): redhat-lsb-submod-security-4.1-27.el7.centos.1.x86_6 | 15 kB 00:00:00
(4/4): m4-1.4.16-10.el7.x86_64.rpm | 256 kB 00:00:02
-----------------------------------------------------------------------------------
Total 265 kB/s | 569 kB 00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : spax-1.5.2-13.el7.x86_64 1/4
Installing : redhat-lsb-submod-security-4.1-27.el7.centos.1.x86_64 2/4
Installing : m4-1.4.16-10.el7.x86_64 3/4
Installing : redhat-lsb-core-4.1-27.el7.centos.1.x86_64 4/4
Verifying : m4-1.4.16-10.el7.x86_64 1/4
Verifying : redhat-lsb-submod-security-4.1-27.el7.centos.1.x86_64 2/4
Verifying : spax-1.5.2-13.el7.x86_64 3/4
Verifying : redhat-lsb-core-4.1-27.el7.centos.1.x86_64 4/4
Installed:
redhat-lsb-core.x86_64 0:4.1-27.el7.centos.1
Dependency Installed:
m4.x86_64 0:1.4.16-10.el7
redhat-lsb-submod-security.x86_64 0:4.1-27.el7.centos.1
spax.x86_64 0:1.5.2-13.el7
Complete!
3 验证命令
[root@localhost ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.2.1511 (Core)
Release: 7.2.1511
Codename: Core
posted on 2018-01-05 14:05 怀想天空2013 阅读(11163) 评论(0) 编辑 收藏 举报