
如果你第一次登录CentOS计算机时,您可能务必检查系统中运行的CentOS版本,此信息将呈现有关如何检查系统软件上安装的CentOS版本好多个不同种类的命令
现如今CentOS Linux有3个主要的实施支派,CentOS 5,CentOS 6和CentOS 7
从命令行检查CentOS版本
lsb_release
命令说明有关Linux发行版的Linux Standard Base(LSB信息。
这必不可少方法,不管你运行的是哪一种CentOS版本都应该能用。
打开智能终端并键入以下命令:
lsb_release -a

CentOS版本将展现在"description"行中。从上面的导出来可以获知我运用的是CentOS Linux 7.5.1804版。
这类版本号数据信息 7.5.1804
都指的是什么
-
7
是CentOS的主要支派 -
7.5
是CentOS 7发布的次序版本 -
1804
是次序版本的日期编号,1804说明2018年4月,数据信息用于标识发布时间也
如果你在推行命令的时候发现bash: lsb_release: command not found...
,还表示redhat-lsb-core
并没在你的系统中未安装该软件包。您可以使用以下方法拼装此手机软件sudo yum install redhat-lsb-core
运用rpm命令检查CentOS版本
rpm
(Red Hat Package Manager都是围绕Red Hat的软件(如RHEL,CentOS和Fedora的app包管理工具。
您可以使用rpm常用工具说明有关centos-release
包的信息,主要包含名字中的CentOS版本
rpm --query centos-release
centos-release-7-5.1804.4.el7.centos.x86_64
运用/etc/centos-release文本文档检查CentOS版本
/etc/centos-release
文本文档由centos-release
包给与。
要检查CentOS版本,请输入以下命令:
cat /etc/centos-release
CentOS Linux release 7.5.1804 (Core)
运用/etc/os-release
文本文档检查CentOS版本
/etc/os-release
文本文档存有运行systemd的所有系统中,并包含具体电脑操作系统标示数据信息信息。
只有拥有CentOS 7时,此方法才有用:
cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="
运用hostnamectl
命令检查你CentOS版本
hostnamectl
是一个允许您设置主机名的命令,但您也可以使用这个来直接搜索的CentOS版本
会在CentOS 7时,此方法才有用
hostnamectl
Static hostname: localhost.localdomain
Icon name: computer-vm
Chassis: vm
Machine ID: 2849f743fbe74706abaa6cb8b2ae5377
Boot ID: 8259a43c6265465884920ac6d762ed5e
Virtualization: kvm
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-862.9.1.el7.x86_64
Architecture: x86-64
有关CentOS版本深层次的信息,请访问Wiki CentOS版本网站页面,假如你有任何疑问,请随时
