How to set Permanent or static hostname for CentOs7 Minimal Server:

This article help you set Permanent or static hostname for CentOS 7 Minimal server.

Prerequisites:

CentOs 7 Minimal Server installed – May it be Physical or VPS or a VM.

hostname abc.abc.comĀ 

Entering hostname abc.abc.comwill change the hostname temporarily. To find it, type

hostnamectl

Sample Output:

Sample Output of hostnamectl will show ,

Static hostname: localhost.localdomain & Transient hostname: abc.abc.com . when the server is restarted the hostname will change itself to old name.

To overcome this scenario, we have to set a permanent or static host name. To set, use the following command.

hostnamectl set-hostname abc.abc.com

In this case, the output of command hostnamectl will be shown as,

Static hostname: abc.abc.com (FQDN)

Icon name: computer-vm

Chassis: vm

Machine ID: 31ff204cc76641e99460750cef4d0e0e

Boot ID: 9992b7511b4942c29ea48a0aada0294c

Virtualization: vmware

Operating System: CentOS Linux 7 (Core)

CPE OS Name: cpe:/o:centos:centos:7

Kernel: Linux 3.10.0-514.el7.x86_64

Architecture: x86-64

Keywords: CentOS 7 , Hostname , Hostnamectl ,Hostnamectl set-hostname , Linux, Permanent Hostname, Command , VPS, VM , Static Hostname , Transient hostname .

 

Leave a Reply