Book Image

Learning RHEL Networking

By : Andrew Mallett, Adam Miller
Book Image

Learning RHEL Networking

By: Andrew Mallett, Adam Miller

Overview of this book

Table of Contents (18 chapters)
Learning RHEL Networking
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Determining your distribution and version


If you are installing from scratch, then we hope that you are able to determine what you are actually installing. If you can't, then we have some issues we need to resolve before the installation. Often though, you may be faced with a machine that is preinstalled or a lab machine that you may have access to. An obvious first step to any faultfinding task will be to determine the actual OS and patch level that we will work on. We will now look at the many ways that exist to determine the flavor of Linux that you will use.

The /etc/system-release file

The /etc/system-release file is consistent across all Red Hat variants that we have discussed here. This can be simply read with the cat command, short for concatenate. As a matter of fact, on all three systems, this file is a symbolic link that provides a shortcut to the relevant file from the following list:

/etc/redhat-release
/etc/centos-release
/etc/fedora-release

However, reading the linked file does make sense as the /etc/system-release file will always be available on any of these flavors and points to the correct OS file. Running the following command on the demonstration RHEL 7.1 system reveals the following command:

$ cat /etc/system-release

Red Hat Enterprise Linux Server release 7.1 Beta (Maipo)

The /etc/issue file

A second method could be to read the login banner from a standard terminal on the physical box. These physical terminals can be tty1 through to tty6 if no graphical system is running on the device. However, if you are running a GUI on your desktop or server, then often tty2 is the first command-line terminal. You can access this terminal from the GUI with the CTRL + ALT + F2 key sequence. The /etc/issue content will be displayed before the logon prompt. The /etc/issue content needs to be read by the /sbin/agetty TTY program. We can concatenate the file, but it's not useful because it contains special escape characters. These characters are expanded by agetty. Looking at the file as plain text, we see the following command:

$ cat /etc/issue

\S
Kernel \r on an \m

The \S command will display the OS, the \r command will display the kernel version, and the \m command will display the machine type. On the RHEL 7.1 system, we will use this file as displayed when logging on from a terminal as:

Red Hat Enterprise Linux Server 7.1 (Maipo)
Kernel 3.10.0-210.el7.x86_64 on an x86_64

Using lsb_release

If there is one way to display the OS details that you are using, why should there not be three ways! As is typical with Linux, we can address this issue in many ways. A third way is to use the lsb_release command. This is generally not installed as part of the default installation. So, it needs to be added to your system (if this has not already been done).

Installing this software can be achieved using yum, but this needs to be run as the root user (administrator). So, either use su - to switch to the root account or use sudo if your account is set up as an administrator, as shown in the following code:

$ sudo yum install redhat-lsb-core

Tip

If you are new to the Linux administration, then the next chapter will start with a quick lesson on how administrative rights are gained and managed within RHEL.

Despite the redhat element in the package name, this command can also be used on CentOS (if this is the system you are using for your journey to Enterprise 7 Linux). With the package installed, we will use the lsb_release command to identify the OS. On the system we use for this book, we can view the following output:

$ lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: RedHatEnterpriseServer
Description:    Red Hat Enterprise Linux Server release 7.1 Beta (Maipo)
Release:        7.1
Codename:       Maipo

If you are using Fedora, you can install the package using the following command:

$ sudo yum install redhat-lsb

The output is similar, but relates to the Fedora release, as shown in the following output from the Fedora 21 server:

$ lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: Fedora
Description:    Fedora release 21 (Twenty One)
Release:        21
Codename:       TwentyOne

Determining the kernel version

We have seen that the Linux kernel version may well be displayed with the /etc/issue file when logging on to a terminal. However, we can also easily display the version of the current kernel using the uname -r command. The kernel is the core of an OS and is maintained as open source software by the Linux Foundation. This command can be run as a standard user. On the RHEL 7.1 system, it displays the following information:

$ uname -r
3.10.0-210.el7.x86_64

Again, knowing the version of the Linux kernel is a great starting point in order to build a picture of the system for faultfinding and placing support calls.