How to change a server's hostname in CentOS

Aaron Lavers

Member
Registered
Joined
May 20, 2016
Messages
61
Points
8
Using a text editor like nano

Code:
sudo nano /etc/sysconfig/network
Modify the HOSTNAME= value to match your FQDN hostname.

Code:
HOSTNAME=yoruserver.domain.com
For internal networking, find at at /etc/hosts to change the host that is associated with the main IP address for your server

Code:
127.0.0.1      localhost localhost.localdomain
123.25.57.79   yoruserver.domain.com   hostname
Restart networking on your server to ensure that changes will be affected
Code:
/etc/init.d/network restart
 
Latest Threads
Replies
0
Views
24
Replies
1
Views
38
Replies
0
Views
227
Replies
1
Views
49
Recommended Threads
Replies
6
Views
3,034
Replies
13
Views
5,227
Replies
14
Views
3,590
Replies
0
Views
2,085

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top