Sunday, September 15, 2013

How to change Hostname of a Linux server


Steps
1) Run command: hostname to check the current hostname

To set new hostname Run below Command


hostname new_server_name
2) Modify the hostname in file: /etc/sysconfig/network

vi /etc/sysconfig/network
3) Modify the hostname in file: /etc/hosts

vi /etc/hosts

Output Will be like 

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
Your-Server-IP   Host-Name 


4)Run the command  service network restart


2 comments:

Jenna said...

Good one keep up the good work.........

Unknown said...

Thanx Jenna :)

Post a Comment

Do Write about the Blog and Welcome to the world where open source is every thing :-)