Hostname/Box name change question

digitard

Well-Known Member
Aug 13, 2004
70
0
156
I know how to change the hostname in WHM. Thats no biggie and I know how to retrieve my box's hostname info from SSH.

My question is this. I started my service w/ my dedicated hosting company with a single site name, and box name in mind. So I set it to go to my current site and my hostname to be server1.currentsite.com

Now since then I have come to the decision the hosting site name sorta wasn't fit for a more 'global community' (it had to do w/ gaming) and I bought a new domain that I want to be my primary site because its a bit more global.

So how do I:
- Change my actual box's info to be primarily on the new server.
- Change my hostname to something else so its not so blatantly server1/server2/etc

If I need to do a PTR or anything I can do that through my providers control panel.
 

DigitalN

Well-Known Member
Sep 23, 2004
419
1
168
Which OS?

For redhat/centos this will change the hostname

# hostname your.newhostname.com

Replace the hostname in each of the following files, with the new one.

/etc/hosts
/etc/sysconfig/network

Then

Add a dns zone for your new domain name and hostname.

Modify apache

# replace 'old.hostname.com' 'your.newhostname.com' -- /usr/local/apache/conf/httpd.conf

# /etc/init.d/httpd graceful

# /etc/init.d/exim restart

Restart exim so the new hostname will be in mail headers.

Then add the new PTR record for the new hostname.
 

digitard

Well-Known Member
Aug 13, 2004
70
0
156
I cant believe I forgot which OS. I was like 'remember to put Redhat' and then I forgot since it was so late...lol.

Thanks. I'll give that a go as soon as I get to work.
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
31
473
Go on, have a guess
For the hostname you have to edit the zone file for the domain that it is is and add an A record for the subdomain to point to the servers main IP address.