- admin
- CentOS
There are several ways on how to check what version of CentOS is running on your system. Below you can find multiple examples on how to determine CentOS version. However, depending on your system not all examples may be applicable. For a Redhat specific guide visit How to check Redhat version.
First, example uses
First, example uses
hostnamectl
command:# hostnamectl Static hostname: localhost.localdomain Icon name: computer-laptop Chassis: laptop Machine ID: 6892999b8d8c43fab29fca961dbff24b Boot ID: b0a95bf56f61417ca8073b3847a73ab1 Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 3.10.0-229.7.2.el7.x86_64 Architecture: x86_64The next example uses
rpm
command to do query for centos-release
package to reveal CentOS version:# rpm --query centos-release centos-release-7-1.1503.el7.centos.2.8.x86_64Yet, another alternative is to use
lsb_release
command. However, this command is part of redhat-lsb
package and is not installed by default so the actual lsb_release
command may be unavailable on your system. If this is the case it is recommended to use some other alternative approach on how to check CentOS version on your system.# lsb_release -d Description: CentOS Linux release 7.1.1503 (Core)If none of the above does not reveal CentOS version we can try to query release numbers directly. Attempt to read the content of the following files to reveal CentOS version number:
- /etc/centos-release
- /etc/os-release
- /etc/redhat-release
- /etc/system-release Use
cat
command to read their content in order to show CentOS version:# cat /etc/centos-release CentOS Linux release 7.1.1503 (Core) # 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="7" # cat /etc/redhat-release CentOS Linux release 7.1.1503 (Core) # cat /etc/system-release CentOS Linux release 7.1.1503 (Core)
No hay comentarios:
Publicar un comentario