Press Ctrl/Cmd + P to print
or save as PDF

Linux OS: CentOS Version

Linux OS: CentOS Version

The latest CentOS version is CentOS7 (version 7.7.1511)

However, here are the others CentOS version under support: CentOS 6 (version 6.6.8)  End Of Life (EOL) CentOS; CentOS 5 — version 5.5.11  –> 31st March 2017; CentOS 4 — version 4.4.9    –>  29th February 2012

For more information, kindly visit our Linux VPS page or contact our support team.

8 Ways to Check CentOS Version

Before starting to learn about how to check CentOS version, you should know that CentOS version consists of three parts, which are:

  1. Major Version: Major release version number
  2. Minor Version: Minor release version number
  3. Monthstamp: codebase month and year timestamp

1. /etc/centos-release file

There are CentOS release and version details in the CentOS specific file.

[root@centos ~]# cat /etc/centos-release
CentOS Linux release 8.1.1911 (Core)
[root@centos ~]#
  • Major Version: 8
  • Minor Version: 1
  • Monthstamp: 1911 i.e. November 2019.

Centos Release Version

2. /etc/system-release file

This file also contains the same information as the centos-release file.

[root@centos ~]# cat /etc/system-release
CentOS Linux release 8.1.1911 (Core)
[root@centos ~]#

3. /etc/os-release file

This file contains the Linux OS information. So, you can get the major version number from this file.

[root@centos ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="8 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
 
CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="8"
 
[root@centos ~]#

4. /etc/redhat-release file

CentOS is built on top of RedHat Linux distribution. Besides, this file also contains the same information as the centos-release file.

[root@centos ~]# cat /etc/redhat-release
CentOS Linux release 8.1.1911 (Core)
[root@centos ~]#

5. lsb_release command

This command doesn’t come pre-installed with the CentOS server. However, you can install it using the following command.

[root@centos ~]# yum install redhat-lsb

Then, check the CentOS version using the following command.

[root@centos ~]#  lsb_release -d
Description:    CentOS Linux release 8.1.1911 (Core)
[root@centos ~]#

6. rpm query

Besides using the command above, we can query the rpm package manager to get the CentOS version information.

[root@centos ~]# rpm -q centos-release
centos-release-8.1-1.1911.0.8.el8.x86_64
[root@centos ~]#

7. rpm macro

Here is a simple rpm macro evaluation to get the CentOS major version.

[root@centos ~]# rpm -E %{rhel}
8
[root@centos ~]#

8. hostnamectl command

Next, the hostnamectl command can be used to get the system information. Also, it reveals the Operating System version.

[root@centos ~]# hostnamectl
   Static hostname: localhost.localdomain
Transient hostname: li1176-240.members.linode.com
         Icon name: computer-vm
           Chassis: vm
        Machine ID: c2a4bfa7e0c74457b3a978656ab959e8
           Boot ID: c89bae2d3ec7493987a455bfa15e4818
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-1062.12.1.el7.x86_64
      Architecture: x86-64
[root@centos ~]#
[root@centos ~]#
[root@centos ~]# hostnamectl | grep "Operating System"
  Operating System: CentOS Linux 7 (Core)
[root@centos ~]#

Are you wondering why this command is printing CentOS 7, whereas others are printing CentOS 8?

Well, it’s because the hostnamectl command doesn’t work in Docker containers. This command output is from my own VPS machine. The other commands output is from my local Docker CentOS 8 container.