Setup hostname for Linux Kernel 3 on RHEL/CentOS 7

Q: How to set system hostname and check OS release in Kernel 3(RHEL7/CentOS7,SLES 12)

New "hostnamectl" with "set-hostname" option is the command to set the hostname:

# hostnamectl set-hostname centos7.lab.local

# hostnamectl
Static hostname: centos7.lab.local
Icon name: computer
Chassis: n/a
Machine ID: 4fdda1019a87407292b81632baaee833
Boot ID: cbf0ab39a62e4f09a55e74ccc8dd979c
Virtualization: kvm
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-229.el7.x86_64
Architecture: x86_64


To check the release version in new kernel 3, /etc/os-release is used:

Legacy method:

# cat /etc/SuSE-release 
openSUSE 13.2 (x86_64)
VERSION = 13.2
CODENAME = Harlequin
# /etc/SuSE-release is deprecated and will be removed in the future, use /etc/os-release instead

New method:

# cat /etc/os-release 
NAME=openSUSE
VERSION="13.2 (Harlequin)"
VERSION_ID="13.2"
PRETTY_NAME="openSUSE 13.2 (Harlequin) (x86_64)"
ID=opensuse
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:opensuse:13.2"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://opensuse.org/"
ID_LIKE="suse"






Comments

Popular posts from this blog

Linux and AIX user non expiry and force password change at first login

Rebuild your new Yum repository after changing the packages

Running Docker Wildfly/JBoss Application Server in Debug mode via Eclipse