Change hostname on terminal
As a System Admin, one must be aware of changing hostname. If you have entered wrong hostname during installation or requirement to change it, you can change it as below.
Display Hostname
[root@localhost ~]# hostname
localhost.localdomain
[root@localhost ~]# hostname
Change Hostname
Edit /etc/sysconfig/network file as below, look for HOSTNAME= to update desired hostname.
Before change:
[root@localhost sysconfig]# cat network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=localhost.localdomain
[root@localhost sysconfig]#
vi /etc/sysconfig/network
save the file
After change:
[root@localhost sysconfig]# cat network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=Chandan.Pro
[root@localhost sysconfig]#
Edit /etc/hosts file as below, look for current hostname and update desired hostname
Before change:
[root@localhost etc]# cat hosts
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
[root@localhost etc]#
vi /etc/hosts
save the file
After change:
[root@localhost etc]# cat hosts
127.0.0.1 chandan.pro
::1 localhost6.localdomain6 localhost6
[root@localhost etc]#
Change hostname on terminal
[root@localhost etc]# hostname chandan.pro
[root@localhost etc]# hostname
chandan.pro
[root@localhost etc]#
0 comentarios