Redhat has many modification from regular popular linux distributions.


To change hostname on redhat7, simple as issuing following commands, no needs to change hosts file one by one:

hostnamectl set-hostname name

Network Manager

Redhat uses NM to manage all interface settings, including IP, DNS and Routes. It’s also supported to use traditional script under /etc/sysconfig/network-scripts/ifcfg-*. To show current interface:

nmcli con show

To add a new interface profile with static IP:

nmcli con add  con-name "UA_NEW-STATIC"  ifname eth0 autoconnect no type ethernet ip4 gw4

To add DNS on existing profile:

nmcli con mod "System eth0" ipv4.dns
nmcli con mod "System eth0" ipv4.dns-search

new settings can be freshed by:

nmcli con reload "System eth0"

Register and subscribe

To register

subscription-manager register --username <username> --password <password> --auto-attach

To unregister

subscription-manager remove --all

Open firewall on Redhat

sudo firewall-cmd --zone=public --add-port=53/tcp --permanent
sudo firewall-cmd --zone=public --add-port=53/udp --permanent
sudo firewall-cmd --reload

Bind9 permission issue

Redhat doesn’t have apparmor installed by default, it’s using SELinux context to protect files. When using Bind9, this may cause permission issues even if all files have 777 and correct ownership. To fix this, add correct context on each related files, including master folder and log files:

chcon  system_u:object_r:named_zone_t:s0 /var/log/named.log
chcon system_u:object_r:named_zone_t:s0

to default context:

restorecon -v

Install Ansible

Ansible is by default not included in built-in repos on RHEL7, users need to add its repo manually:

yum install
subscription-manager repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms"

Dispatch SSH key and passwordless login

There’s a simple command on redhat that can help dispatch pub keys onto remote hosts:

ssh-copy-id -i ~/.ssh/

this will copy local pub key onto [email protected] home folder .ssh.