How do I determine what version of Red Hat Enterprise Linux my server is running?

Solution 1:

You can find out in the file /etc/issue

cat /etc/issue

And also on redhat based systems, you can find out in /etc/redhat-release

cat /etc/redhat-release 

Solution 2:

cat /etc/redhat-release will tell you.

Solution 3:

/etc/redhat-release is the usual way, but be careful if you are working on an unfamiliar server. Administrators have been known to "tweak" redhat-release to permit certain software packages requiring Redhat Enterprise to install on similar distributions which are not officially supported by the vendor. For example, IBM's Lotus Domino package typically looks for RHEL before allowing the installer to run, but it can be installed on CentOS by "faking out" the string in /etc/redhat-release.

Solution 4:

rpm -q --whatprovides /etc/redhat-release can also be used (and it works on both RedHat and CentOS). The version portion of the output should be the OS version.

e.g. An output of "redhat-release-5Server-" shows that the box is running RHEL 5.4 while "centos-release-5-5.el5.centos" indicates that the box is running CentOS 5.5.

Solution 5:

cat /etc/redhat-release