Select Your Language

Infrastructure and Management

Cloud Computing

Storage

Runtimes

Integration and Automation

  • Comments
  • How do *you* retrieve the release version on your systems?

    Posted on

    I am looking for a clean/easy/simple way to gather the release version (specific only to the 5/6/7 EL releases, I suppose).
    I have considered using the following files/commands:
    /etc/redhat-release
    /etc/system-release-cpe
    lsb-release
    uname -r

    The problem I am running in to with any of the above methods is the lack of consistency (either due to differing build standards on my hosts, or the output is slightly different).
    For example:

    /etc/redhat-release (seems consistent thus far regarding the number of fields - however, Fedora is different and I have not tested CentOS)
    /etc/system-release-cpe (was not implemented on RHEL 5 - AFAIK)
    lsb-release (not all of my systems have lsb installed)
    uname -r (parsing for el5 vs el6, etc... might be the ticket?)

    I'm just wondering what other folks are doing. My bootstrap script determines which activation key to use based on the OS release and a few of my 3rd-party Repositories as well. I'm searching for the lowest common denominator(s) or most consistent way to determine the information.

    Then there is things like this (notice column 5)

    #  cat /etc/system-release-cpe
    cpe:/o:redhat:enterprise_linux:6server:ga:server
    # cat /etc/system-release-cpe
    cpe:/o:redhat:enterprise_linux:7.0:ga:server
    

    Then... notice the difference in the yum vars (6server vs 6Server)

    # python -c 'import yum, pprint; yb = yum.YumBase(); pprint.pprint(yb.conf.yumvar, width=1)'
    {'arch': 'amd64',
     'basearch': 'x86_64',
     'releasever': '6Server',
    

    EDIT: I apologize - I should have mentioned that I am doing this from the client itself. So, I need a consistent command that could be run on a RHEL 5/6/7 client (Sorry for the confusion)

    by

    points

    Responses

    Red Hat LinkedIn YouTube Facebook X, formerly Twitter

    Quick Links

    Help

    Site Info

    Related Sites

    © 2025 Red Hat