Tuesday May 15, 2012

How to check if the running distribution is OL or RedHat

Note: this is not intended to be an official way to detect or identify a running linux distribution.

The PDFs linked here are useful to identify the running Linux version.

RedHat (RHEL) provides the file /etc/redhat-release, installed by the package redhat-release. Oracle Linux (OL) adds its own file /etc/enterprise-release, installed by enterprise-release, OL 6 adds /etc/oracle-release, installed by oraclelinux-release. As of OL 6, /etc/redhat-release retains the RHEL content.

in RHEL:
my-rhel-server# rpm -qf /etc/redhat-release
redhat-release-server-6Server-6.0.0.37

in OEL:
my-oel-server# rpm -qf /etc/redhat-release
enterprise-release-5-0.0.2

The PDFs from the link above gives a more detailed and precise information.

Some other methods are easily found just google-ing a bit, and may be prone to cause confusion. For instance, it's also possible to check /proc/version, although this one won't make it clear:

# cat /proc/version
Linux version 2.6.18-274.7.1.0.1.el5 (...) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-51))

A bit more reliable seems to be /etc/issue or /etc/issue.net:

# cat /etc/issue.net | head -1
Oracle Linux Server release 5.7


About

jorge_neidisch

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today