Configure network interface as DHCP client on RHEL7 Linux

In this config we are going to configure a network interface to receive an IP configuration settings from DHCP server. First get the name of the network interface you would like to set as DHCP client. To do this you can run command:

# ip addr show
2: enp0s3:  mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:15:38:b7 brd ff:ff:ff:ff:ff:ff
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe15:38b7/64 scope link 
       valid_lft forever preferred_lft forever

Once we have located a name of the network interface in question open a corresponding configuration file. So as an example, for network interface epn0s3 vi will edit a /etc/sysconfig/network-scripts/ifcfg-enp0s3. Open this file and enter the minimum configuration settings in order to make this network interface act as a DHCP client:

DEVICE=enp0s3
BOOTPROTO=dhcp
ONBOOT=yes

Read more

How to change a static hostname on RHEL7 linux with hostnamectl

Instead of changing a hostname on your Redhat 7 server manually by editing /etc/hostname you may preferably use a dedicated command hostnamectl to do this job. By default when no other options are supplied the hostnamectl command will display basic information including static hostname:

[root@rhel7 ~]# hostnamectl 
   Static hostname: rhel7
         Icon name: computer
           Chassis: n/a
        Machine ID: 75387b56d72b44b380810499805ec28a
           Boot ID: 6ad251d0e12a10e3af1894eae5fe5cb6
    Virtualization: oracle
  Operating System: Red Hat Enterprise Linux Server 7.0 (Maipo)
       CPE OS Name: cpe:/o:redhat:enterprise_linux:7.0:GA:server
            Kernel: Linux 3.10.0-123.el7.x86_64
      Architecture: x86_64

Read more

How to list all available locales on RHEL7 Linux

The following linux command will list all available locales currently available on the Redhat 7 system:

[root@rhel7 ~]# localectl list-locales

The list of all available locales on your system my be quite long so use grep command to narrow down your search. Bellow command will display for example all German available locales:

[root@rhel7 ~]# localectl list-locales | grep ^de
de_AT
de_AT.iso88591
de_AT.iso885915@euro
de_AT.utf8
de_AT@euro
de_BE
de_BE.iso88591
de_BE.iso885915@euro
de_BE.utf8
de_BE@euro
de_CH
de_CH.iso88591
de_CH.utf8
de_DE
de_DE.iso88591
de_DE.iso885915@euro
de_DE.utf8
de_DE@euro
de_LU
de_LU.iso88591
de_LU.iso885915@euro
de_LU.utf8
de_LU@euro
deutsch

Read more

How to change a timezone on RHEL7 Linux server

Changing a timezone on Redhat 7 Linux server is a easy task which can be done on a command line with a few commands. First find your timezone using timedatectl command. The following linux command will list all timezones:

[root@rhel7 ~]# timedatectl list-timezones

To narrow down the search you can use grep to search for a specific city. For example:

[root@rhel7 ~]# timedatectl list-timezones | grep -i bratislava
Europe/Bratislava

Read more

Using timedatectl command to change time and date on RHEL7 Linux system

When not using NTP you may need to set your system time manually. You have two options to set time and date on your RHEL7 linux. First option is to use date command to do this job or engage dedicated systemd timedatectl command. By default and without any arguments timedatectl will display a current time, local, universal and RTC times:

[root@rhel7 ~]# localectl
   System Locale: LANG=en_AU.iso88591
       VC Keymap: us
      X11 Layout: us
[root@rhel7 ~]# timedatectl
      Local time: Thu 2014-09-04 18:30:11 WST
  Universal time: Thu 2014-09-04 10:30:11 UTC
        RTC time: Thu 2014-09-04 10:30:10
        Timezone: Australia/Perth (WST, +0800)
     NTP enabled: n/a
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a

Read more

Sync an accurate time using ntpdate on RHEL7 Linux server

To sync a correct time on your Redhat server with a NTP publicly available time servers first you need to install ntpdate package:

[root@rhel7 ~]# yum install ntpdate

To check your current time use date command:

[root@rhel7 ~]# date
Thu Sep  4 17:20:42 WST 2014

Next, we can use pool.ntp.org timeserver to synchronize our time. This is be done with ntpdate command:

[root@rhel7 ~]# ntpdate pool.ntp.org
11 Dec 06:08:13 ntpdate[2225]: step time server 173.230.144.109 offset 8426822.014383 sec

Read more

How to reset the root password in RHEL7/CentOS7/Scientific Linux 7- based systems

Objective

Resetting the root password in RHEL7/CentOS7/Scientific Linux 7

Requirements

RHEL7 / CentOS7 / Scientific Linux 7

Difficulty

MODERATE

Instructions

Things have changed in the RHEL7 world and so has the preferred way of resetting the root password. Although the old way of interrupting the boot process (init=/bin/bash) still works, it is no longer bulletproof and recommended.
‘Systemd’ uses ‘rd.break’ to interrupt the boot. Let’s have a quick walk through the whole procedure.

Read more