change hostname on centos 6.3

To change your centos hostname:

sudo vi /etc/sysconfig/network

Modify HOSTNAME value with your FQDN host name

HOSTNAME=myserver.domain.com

Than you should change host name which is associated with your IP

sudo vi /etc/hosts


127.0.0.1 localhost localhost.localdomain
#change ip 123.123.123.123 to your IP
123.123.123.123 hostname.mydomain.com hostname

At this point you should restart network service. You can do that with following command:

sudo /etc/init.d/network restart

Залишити відповідь

Ваша e-mail адреса не оприлюднюватиметься. Обов’язкові поля позначені *