4 Ways to Check CentOS or RHEL Version
Do you know the version of CentOS/RHEL release you are running on your server? Why is this even important? There are several reasons to keep this information in mind: to quickly gather information about your system; keep up with bug fixes and security updates, and configure correct software repositories for a specific release, among others.
This is probably an easy task for experienced users, but it’s not usually the case for newbies. In this article, we will show how to check the version of CentOS or RHEL Linux installed on your server.
How to Check Linux Kernel Version in CentOS
Knowing the kernel version is just as important as knowing the distro release version. To check Linux kernel version, you can use the uname command.
$ uname -or OR $ uname -a #print all system information
From the output of the above command, the CentOS is powered by an old kernel version, to install or upgrade to the latest kernel release, follow the instructions in our article: How to Install or Upgrade to Kernel 4.15 in CentOS 7.
How to Check CentOS or RHEL Release Version
CentOS release version numbers have two parts, a major version such as “6” or “7” and a minor or update version, such as or “6.x” or “7.x”, which correspond to the major version and update set of RHEL receptively, used to build a particular CentOS release.
To elaborate more in this, take for instance CentOS 7.5 is built from the source packages of RHEL 7 update 5 (also known as RHEL version 7.5), which is referred to as a “point release” of RHEL 7.
Let’s take a look at these 4 useful ways to check CentOS or RHEL release version.
1. Using RPM Command
RPM (Red Hat Package Manager) is a popular and core package management utility for Red Hat based systems like (RHEL, CentOS and Fedora), using this rpm command, you will get your CentOS/REHL release version.
$ rpm --query centos-release [On CentOS] $ rpm --query redhat-release [On RHEL]
2. Using Hostnamectl Command
hostnamectl command is used to query and set Linux system hostname, and show other system related information, such as operating system release version as shown in the screenshot.
3. Using lsb_release Command
lsb_release command displays some LSB (Linux Standard Base) and distribution information. On CentOS/REHL 7, the lsb_release command is provided in the redhat-lsb package which you can install it.
$ sudo yum install redhat-lsb
Once you have installed it, you can check your CentOS/REHL version as shown.
$ lsb_release -d
4. Using Distro Release Files
All the above commands retrieve OS release information from a number of system files. You can view the contents of these files directly, using the cat command.
$ cat /etc/centos-release [On CentOS] $ cat /etc/redhat-release [On RHEL] $ cat /etc/system-release $ cat /etc/os-release #contains more information
That’s all for now! If you know any other method that should be covered here, let us know via the comment form below. You can also ask any questions related to the topic.