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

安装lsb_release的更多相关文章

  1. Centos6.5离线安装lsb_release

    参考 http://www.linuxfromscratch.org/blfs/view/systemd/postlfs/lsb-release.html首先在其他电脑下载lsb_release源码地 ...

  2. HOSTNAME问题 和yum配置163源的操作 安装lsb_release,KSH,CSH

    HOSTNAME 在 /etc/hosts 里添加一行 127.0.0.1 yourhostname yum配置 来自http://www.cnblogs.com/wutengbiao/p/41889 ...

  3. lsb_release 提示命令不存在

    1. 报错信息 bash: lsb_release: command not found 2. 问题原因 未安装 lsb_release 命令 3. 解决方法 用 yum 命令安装 lsb_relea ...

  4. Centos里没有lsb_release

    查看Centos操作系统版本,输入指令 lsb_release -a 报无此命令 解决办法,安装lsb_release 1.执行指令:yum install -y redhat-lsb 2.安装完毕后 ...

  5. Linux命令——lsb_release

    简介 LSB是Linux Standard Base(Linux标准库)的缩写, lsb_release命令 用来与具体Linux发行版相关的Linux标准库信息. 注:LSB的译法有Linux标准库 ...

  6. OpenVINO在linux下安装

    一.准备安装环境: 1.带命令行的64位centos操作系统,推荐极简安装模式,先不要安装GNOME桌面,避免和后面的openvino环境冲突 2.cpu要求 我目前是在服务器的虚拟机里面安装 注意如 ...

  7. VMware 虚拟机图文安装和配置 AlmaLinux OS 8.6 教程

    前言: 这是<VMware 虚拟机图文安装和配置 Rocky Linux 8.5 教程>一文的姐妹篇教程,如果你需要阅读它,请点击这里. 2020 年,CentOS 宣布:计划未来将重心从 ...

  8. VMware 虚拟机图文安装和配置 Rocky Linux 8.5 教程

    前言 2020 年,CentOS 宣布:计划未来将重心从 CentOS Linux 转移到 CentOS Stream.CentOS 8 的生命周期已于 2021 年 12 月 31 日终止,而 Ce ...

  9. CentOS 添加常用 yum 源

    CentOS 的官方源去掉了一些与版权有关的软件,因此想要安装这些软件或者手动下载安装,或者使用其他源. 下面我推荐常用的两个源, 这两个源基本可以满足一般服务器的使用需求. 首先, 添加源之前要确定 ...

随机推荐

  1. String 类 的 使用

    package com.StringUse; import java.util.Arrays; /* String 的构造方法: String() 创建一个空内容 的字符串对象. String(byt ...

  2. NetFPGA-SUME下reference_nic测试

    Reference_nic Reference_nic是NetFPGA-SUME中提供的一个参考Demo,本文主要介绍如何构建并在SUME上运行reference_nic. GIT源 git clon ...

  3. 结对随即四则运算(带界面Java版)

    //随机四则运算类 public class 随机四则运算 { public static void main(String[] args) { new 界面();//进入随机四则运算的首界面 } } ...

  4. datatables 排序 如何禁止

    $.extend( true, $.fn.dataTable.defaults, {     "searching": false,     "ordering" ...

  5. Struts1简单开发流程梳理

    共享数据的4种范围MVC设计模式JSP model1.JSP model2struts实现MVC机制(ActionServlet.Action)struts-config.xml ActionServ ...

  6. 『编程题全队』Alpha 阶段冲刺博客Day2

    1.每日站立式会议 1.会议照片 2.昨天已完成的工作统计 孙志威:   确定了本阶段的团队目标   确定了个人所分配的任务(主要为客户端GUI模块) 孙慧君:    确定了自己的任务,并着手开始环境 ...

  7. PAT 甲级 1143 Lowest Common Ancestor

    https://pintia.cn/problem-sets/994805342720868352/problems/994805343727501312 The lowest common ance ...

  8. SQLSERVER 升级版本的方法

    1. 以SQLSERVER2014为例说明 SQLSERVER升级版本的方法, 也适用于evaluation 版本超过180天之后的处理. 2. 打开所有的应用 看到有一个 sqlserver2008 ...

  9. HDU 2255 奔小康赚大钱 (KM算法 模板题)

    奔小康赚大钱 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Subm ...

  10. org.hibernate.UnknownEntityTypeException: Unable to locate persister: com.hibernate2.pojo.News at org.hibernate.internal.SessionFactoryImpl.locateEntityPersister(SessionFactoryImpl.java:797)

    使用的是hibernate5的方法: ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySetti ...