How to change server hostname and name servers via SSH – Commandline cpanel server

This is my first article after long time. I hope very soon I can publish more networking and server related tricks and topics in

this block.

Here we go with very short and effective article for changing Hostname and Nameservers of the server

Step 1. Change Server Hostname

# hostname anyname.yourdomain.com

Step 2: Change Hostfile

Use any editor I used nano

# sudo nano /etc/hosts/

 

127.0.0.1               localhost localhost.localdomain
54.xxx.xx.151           anyname.yourdomain.com
10.0.0.10               anyname.yourdomain.com anyname ip-10-0-0-10

 

 

Step 3: Change Network Config

# sudo nano /etc/sysconfig/network

 

HOSTNAME="anyname.yourdomain.com"
NETWORKING=yes
NOZEROCONF=true

 

Step 4: Change Nameserver IP’s of Cpanel Server

sudo nano/var/cpanel/nameserverips.yaml

 

--
ns1.yourdomain.com:
54.xxx.xx.151: 1
count: '14'
zones: anyname.yourdomain.com,domain2.com,ns1.yourdomain.com$
ns2.yourdomain.com:
54.xxx.xx.151: 1
count: '14'
zones: anyname.yourdomain.com,domain2.com,ns1.yourdomain.com$

 

Final Step will be register your nameserver IP’s with your domain registrar and use your own nameservers.

Hope you enjoyed reading this.