Skip to content
Work Insights
Login →
Talk to a senior advisor
hosting

How to change your hostname Centos6 and Centos7

How to change your server hostname

in X
How to change your hostname Centos6 and Centos7
hosting2019

Changing your server hostname must be the first step you do when you're getting a new installation for a webserver or control panel. here's how we can change simply it.

Centos6

You could change the hostname by this simple command

 # hostname host.name.com

which is host.name.com is the hostname you want to set

Centos7

on this OS it's a little bit complicated

 # sudo nano /etc/sysconfig/network

then you have to write this line on the file

 HOSTNAME=host.name.com

then save and exit

You may need to restart the network on server/machine though this command

# /etc/init.d/network restart

#reboot

----

Don't forgot to add your hostname to hosts file, by the following command

# nano /etc/hosts

xxx.xxx.xxx.xxx host.name.com 

the ip of the server followed by the hostname then save the exit the file

 

 

Muhammad El-Saeed

Technical writer and software engineer, he's a part of the great Brightery team that have many project on the opensource community

Editorially reviewedOctober 2, 2019

0 Responses

Share your perspective and continue the conversation.

No responses yet

Be the first to share your thoughts.

Join the conversation