Posts
Showing posts from June, 2018
Hostname changes in 4 different ways
- Get link
- X
- Other Apps
Method 1 We have been using this way for most of the Linux versions & it works fine in CentOS/RHEL 7 as well. In this way, we will manually add hostname by editing /etc/sysconfig/network, $ vi /etc/sysconfig/network and add your hostname, NETWORKING=yes HOSTNAME=centos7.linux.com Restart network services to implement the changes. $ systemctl restart network You can now view the new hostname using command ‘hostname’. Method 2 Second way for changing hostname is by using command ‘hostnamectl’. Hostnamectl is used to change or query hostname. For changing hostname, run the following command $ hostnamectl set-hostname “centos7.linux.com” To view the changes hostname, only run ‘hostnameclt‘ command, $ hostnamectl hostnamectl If you completely want to remove the hostname, use ‘hostnamectl set-hostname “” ‘. This remove the hostname completely. Method 3 Third method to change the hostname is not a preferred way but none the less it gets the job do...