Change host name

To temporarily change the host name, use command:

hostname newname.somedomain.net

To permanently change the hostname, open file /etc/sysconfig/network. Use, for example, vi-editor:

vi /etc/sysconfig/network 

Find and change following line to your host name (and domain)

HOSTNAME=newname.somedomain.net

save file and restart network service

service network restart

This works in CentOS and Red Hat version 6.x. You may also need to change /etc/hosts file.

Leave a Reply