Portal Home > Knowledgebase > How-to > Dedicated servers > How to change the server name
To do this you should use the hostname command:
hostname
for instance:
hostname ns1.server.com
(Where "ns1.server.com" is the name of your machine)
Then you need to edit some configuration files.
Debian/ Ubuntu
/etc/hostname
You need to put hostname there, it can be done in the following way:
echo "ns1.server.com" >> /etc/hostname
Where "ns1.server.com" is the name of your machine
or
vi /etc/hostname
now it should look like:
cat /etc/hostname
ns1.server.com
CentOS / Redhat
You have to edit /etc/sysconfig/network
cat /etc/sysconfig/networkNETWORKING=yes
HOSTNAME=dXXXX.seedhost.eu
GATEWAY=213.186.XX.254
Just change the HOSTNAME variable
For instance :
vi /etc/sysconfig/network
after edit file it should look like that:
NETWORKING=yes
HOSTNAME=ns1.server.com
GATEWAY=213.186.XX.254
Now you have to edit /etc/hosts
cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
213.186.XX.XX dXXXX.seedhost.eu
vi /etc/hosts
Just change the variable dXXXX.seedhost.eu
cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
213.186.XX.XX ns1.server.com
Gentoo
nano -w /etc/conf.d/hostname
hostname="ns1.server"
FreeBSD
As root, type "hostname ", and the hostname will be changed
instantly. To keep this change across reboots, edit the file
'/etc/rc.conf', and add such a line:
Set the hostname variable to your host name:
hostname="ns1.server.com"
Add to Favourites Print this Article
Powered by WHMCompleteSolution