{"id":7807,"date":"2019-04-25T07:24:47","date_gmt":"2019-04-24T23:24:47","guid":{"rendered":"http:\/\/rmohan.com\/?p=7807"},"modified":"2019-04-25T07:24:49","modified_gmt":"2019-04-24T23:24:49","slug":"check-redhat-version","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=7807","title":{"rendered":"check Redhat version"},"content":{"rendered":"\n<p>\n\nThe objective of this guide is to provide you with some hints on how to check system version of your Redhat Enterprise Linux (RHEL). There exist multiple ways on how to check the system version, however, depending on your system configuration, not all examples described below may be suitable. For a CentOS specific guide visit&nbsp;<a href=\"https:\/\/linuxconfig.org\/how-to-check-centos-version\">How to check CentOS version<\/a>&nbsp;guide.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h2-requirements\">Requirements<\/h2>\n\n\n\n<p>Privileged access to to your RHEL system may be required.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h3-difficulty\">Difficulty<\/h2>\n\n\n\n<p>EASY<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h4-conventions\">Conventions<\/h2>\n\n\n\n<ul><li><strong>#<\/strong>&nbsp;&#8211; requires given&nbsp;<a href=\"https:\/\/linuxconfig.org\/linux-commands\" target=\"_blank\" rel=\"noreferrer noopener\">linux commands<\/a>&nbsp;to be executed with root privileges either directly as a root user or by use of&nbsp;<code>sudo<\/code>&nbsp;command<\/li><li><strong>$<\/strong>&nbsp;&#8211; requires given&nbsp;<a href=\"https:\/\/linuxconfig.org\/linux-commands\" target=\"_blank\" rel=\"noreferrer noopener\">linux commands<\/a>&nbsp;to be executed as a regular non-privileged user<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h5-instructions\">Instructions<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h5-1-using-hostnamectl\">Using hostnamectl<\/h3>\n\n\n\n<p><code>hostnamectl<\/code>&nbsp;is most likely the first and last command you need to execute to reveal your RHEL system version:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ hostnamectl \n   Static hostname: localhost.localdomain\nTransient hostname: status\n         Icon name: computer-vm\n           Chassis: vm\n        Machine ID: d731df2da5f644b3b4806f9531d02c11\n           Boot ID: 384b6cf4bcfc4df9b7b48efcad4b6280\n    Virtualization: xen\n  Operating System: <strong>Red Hat Enterprise Linux Server 7.3 (Maipo)<\/strong>\n       CPE OS Name: cpe:\/o:redhat:enterprise_linux:7.3:GA:server\n            Kernel: Linux 3.10.0-514.el7.x86_64\n      Architecture: x86-64\n\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h5-2-query-release-package\">Query Release Package<\/h3>\n\n\n\n<p>Use&nbsp;<code>rpm<\/code>&nbsp;command to query Redhat&#8217;s release package:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">RHEL 7\n$ rpm --query redhat-release-server\nredhat-release-server-<strong>7.3<\/strong>-7.el7.x86_64\nRHEL 8\n$ rpm --query redhat-release\nredhat-release-8.0-0.34.el8.x86_64\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h5-3-common-platform-enumeration\">Common Platform Enumeration<\/h3>\n\n\n\n<p>Check Common Platform Enumeration source file:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ cat \/etc\/system-release-cpe \ncpe:\/o:redhat:enterprise_linux:<strong>7.3<\/strong>:ga:server\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h5-4-lsb-release\">LSB Release<\/h3>\n\n\n\n<p>Depending on whether a&nbsp;<code>redhat-lsb<\/code>&nbsp;package is installed on your system you may also use&nbsp;<code>lsb_release -d<\/code>&nbsp;command to check Redhat&#8217;s system version:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ lsb_release -d\nDescription:\tRed Hat Enterprise Linux Server release <strong>7.3 (Maipo)<\/strong>\n<\/pre>\n\n\n\n<p>Alternatively install&nbsp;<code>redhat-lsb<\/code>&nbsp;package with:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># yum install redhat-lsb\n<\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h5-5-check-release-files\">Check Release Files<\/h3>\n\n\n\n<p>There are number of release files located in the \/etc\/ directory. Namely&nbsp;<code>os-release<\/code>,&nbsp;<code>redhat-release<\/code>&nbsp;and&nbsp;<code>system-release<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ ls \/etc\/*release\nos-release  redhat-release  system-release\n<\/pre>\n\n\n\n<p>Use&nbsp;<code>cat<\/code>&nbsp;to check the content of each file to reveal your Redhat OS version. Alternatively, use the below for loop for an instant check:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ for i in $(ls \/etc\/*release); do echo ===$i===; cat $i; done\n<\/pre>\n\n\n\n<p>Depending on your RHEL version, the output of the above shell for loop may look different:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">===os-release===\nNAME=\"Red Hat Enterprise Linux Server\"\nVERSION=\"<strong>7.3 (Maipo)<\/strong>\"\nID=\"rhel\"\nID_LIKE=\"fedora\"\nVERSION_ID=\"<strong>7.3<\/strong>\"\nPRETTY_NAME=\"Red Hat Enterprise Linux Server <strong>7.3 (Maipo)<\/strong>\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:\/o:redhat:enterprise_linux:<strong>7.3<\/strong>:GA:server\"\nHOME_URL=\"https:\/\/www.redhat.com\/\"\nBUG_REPORT_URL=\"https:\/\/bugzilla.redhat.com\/\"\n\nREDHAT_BUGZILLA_PRODUCT=\"Red Hat Enterprise Linux 7\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=<strong>7.3<\/strong>\nREDHAT_SUPPORT_PRODUCT=\"Red Hat Enterprise Linux\"\nREDHAT_SUPPORT_PRODUCT_VERSION=\"<strong>7.3<\/strong>\"\n===redhat-release===\nRed Hat Enterprise Linux Server release <strong>7.3 (Maipo)<\/strong>\n===system-release===\nRed Hat Enterprise Linux Server release <strong>7.3 (Maipo)<\/strong>\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h5-6-grub-config\">Grub Config<\/h3>\n\n\n\n<p>The least reliable way on how to check Redhat&#8217;s OS version is by looking at Grub configuration. Grub configuration may not produce a definitive answer, but it will provide some hints on how the system booted.&nbsp;<\/p>\n\n\n\n<p>The default locations of grub config files are&nbsp;<code>\/boot\/grub2\/grub.cfg<\/code>&nbsp;and&nbsp;<code>\/etc\/grub2.cfg<\/code>. Use&nbsp;<code>grep<\/code>&nbsp;command to check for&nbsp;<code>menuentry<\/code>&nbsp;keyword:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># grep -w menuentry \/boot\/grub2\/grub.cfg \/etc\/grub2.cfg\n<\/pre>\n\n\n\n<p>An another alternative is to check the value of the &#8220;GRUB Environment Block&#8221;:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># grep saved_entry \/boot\/grub2\/grubenv \nsaved_entry=Red Hat Enterprise Linux Server (3.10.0-514.el7.x86_64) <strong>7.3 (Maipo)<\/strong><\/pre>\n","protected":false},"excerpt":{"rendered":"\n<p> The objective of this guide is to provide you with some hints on how to check system version of your Redhat Enterprise Linux (RHEL). There exist multiple ways on how to check the system version, however, depending on your system configuration, not all examples described below may be suitable. For a CentOS specific [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7807"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7807"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7807\/revisions"}],"predecessor-version":[{"id":7808,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7807\/revisions\/7808"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7807"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7807"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7807"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}