A commercial Linux distribution like RHEL is very stable as only old, stable and thoroughly tested software are distributed. RHEL also has long term support for all its releases. So it is ideal for small, medium and big companies and institutions.
CentOS is another Linux distribution which has the same codebase as RHEL and is freely distributed. It’s free to download and use. The only downside is that it does not have paid support. Basically you are responsible for fixing any problem you may have with your operating system. You can’t ask Red Hat or CentOS to fix them for you. So CentOS is RHEL without paid support.
There are many version of CentOS available, for example, CentOS 5, CentOS 6, CentOS 7. CentOS 7 is the latest version of CentOS and it is based on RHEL 7. CentOS 6 is an earlier version of CentOS which is based on RHEL 6, and is still supported till November 30, 2020 according to the official website of CentOS at the time of this writing. CentOS 5 and earlier is at the EOL (End of Life) and you will not get any updates or bug fixes any more.
Since you will have to fix all the problems you face while using CentOS, the version of CentOS you’re using is a must have knowledge. If you can’t tell which version of CentOS you’re using, getting help from online forums and other places would be really hard for you.
You will also need to know which version of CentOS you’re using while installing new software. For example, NodeJS has packages for CentOS 6 and CentOS 7. To install it on CentOS 6, you must follow the procedures for CentOS 6 given on the official website of NodeJS. To install it on CentOS 7, you will be following instructions for CentOS 7 the same way. Otherwise things won’t work as expected.
Now you can tell how important it is to actually know the version of CentOS you’re using. In this article, I will show you ways of checking version of your CentOS operating system. Let’s get started.
Using the cat Command:
The CentOS release information is stored in the /etc/redhat-release file on CentOS and RHEL. The easiest way to check CentOS version is to read that file with the following command:
As you can see, the version information is printed. I am using CentOS 7.4.
Using lsb_release Command:
You can check CentOS version with the widely used lsb_release command as well. But there is a slight problem with this command on CentOS and RHEL operating systems. The command is not available by default. Because, on CentOS and RHEL systems, the redhat-lsb-core package is not installed.
You can easily install it with the following command:
The package should be installed.
Now run the following command to check version of your CentOS operating system:
As you can see, the correct CentOS version is printed. I am using CentOS 7.4.
So that’s how you check the version of your CentOS operating system. Thank you for reading this article.