A suggestion for cPanel -- Hostname Change

trakwebster

Well-Known Member
Jan 29, 2003
145
0
166
Our new managed server was installed with the wrong hostname. No problem, I thought, and used the WHM to change the hostname.

It did change the hostname, but maybe not everywhere --

1) The reverse DNS entry still showed the original, wrong hostname.

2) Apache's httpd.conf file still showed the original. wrong hostname in ServerName and ServerAdmin equates.

3) There may be an original wrong hostname somewhere in the exim (sendmail) system, or maybe the emails from [email protected] have been created by the bad reverse DNS. I am too ignorant in this area to know, and haven't found the exim config files yet.

Anybody else ever do a hostname change via WHM, and then needed to patch up a few places where WHM did not change the hostname for you?

-- Arthur Cronos



PS: One other thing. When setting up WHM for the first time, I got a warning that told me that the 'hostname' needed to be a domain I owned and that it could not be any user on the system.

Well, that was very ambiguous to me at the time. I didn't know if 'hostname', in that context, meant 'server', 'domain', 'domain.com', or 'server.domain.com'.

Now after fiddling a bit, I'm pretty sure you meant that the 'hostname' is the first part, then 'domain.com' is the domain, and than the 'server name' is the whole thing. IE:
hostname -- boogie
domain -- shoes.com
servername -- boogie.shoes.com

Is this correct? If so, a definition or example during that set-up script (and in the manual) would avoid some confusion for cpanel users in future.
 

casey

Well-Known Member
Jan 17, 2003
2,303
0
191
Me, too. I am now getting errors saying Apache failed on server.domain.com, which was the old hostname. The new hostname is server2.domain.com. How do I get Apache to quit giving me those errors?
 
Last edited:

xsenses

Well-Known Member
Aug 29, 2002
233
0
166
Huntington Beach, Ca
I have done a hostname change and got the details from the support guys at fastservers.
This is what I did and everything works
Edit: /etc/hosts (to reflect new hostname)
Edit: httpd.conf servername
Edit: /etc/wwwacct.conf (to reflect new nameservers)

As well as the standard WHM changes and manual edit's of DNS zones.

That's all I can remember, hope it helps.
 

Tom Pyles

Well-Known Member
Apr 26, 2002
254
0
316
Soma,
Everytime we needed to set up reverse DNS, our datacenter had to do it for us. If you contact your provider, they should be able to easily set this up for you.
 
O

ozzi4648

Guest
That hostname feature is a useless feature. It really is.

Do it manually then reboot the server. Its the only way to get things working properly.

Edit

/etc/resolv.conf
/etc/hosts
/etc/sysconfig/network

Reboot

Whalla!
 

trakwebster

Well-Known Member
Jan 29, 2003
145
0
166
Whalla you mean?

Hi Ozzi4648,

Thanks for the info. My server is running fine now as far as I can tell, but I'd never seen some of these files that you mention, so I looked at them.

They all contain sensible information except the resolv.conf, which appears to contain darkorb's info --

domain darkorb.net
search darkorb.net
nameserver 127.0.0.1
nameserver 66.197.217.11
nameserver 66.197.217.12

What is this stuff? And do I leave it alone? Or change it to something else?

-- Arthur Cronos from Voltos
 
O

ozzi4648

Guest
Re: Whalla you mean?

Originally posted by trakwebster
Hi Ozzi4648,

Thanks for the info. My server is running fine now as far as I can tell, but I'd never seen some of these files that you mention, so I looked at them.

They all contain sensible information except the resolv.conf, which appears to contain darkorb's info --

domain darkorb.net
search darkorb.net
nameserver 127.0.0.1
nameserver 66.197.217.11
nameserver 66.197.217.12

What is this stuff? And do I leave it alone? Or change it to something else?

-- Arthur Cronos from Voltos
Well i see nobody bothered to reply to your messages, typical around here. Anyway, that is wrong. You need to modify resolv.conf. Change

domain darkorb.net to domain yourdomain.com
search darkorb.net to search yourdomain.com

Are those your nameserver ips? If so they are correct. If those are not the ips of your nameserver change them to reflect that.

find /etc/hosts

make sure yours says something like this

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost
207.xx.xxx.xxx srv08.domain.com srv08

change 207.xx.xxx.xxx to your servers ip
change srv08.domain.com to your.hostname.com
change srv08 to the first letters before the first period in your hostname.

If you dont know what your hostname is type

hostname

Next, find /etc/sysconfig/network

pico network

It should look something like this

NETWORKING=yes
HOSTNAME="srv08.domain.com"
GATEWAY="207.xx.xxx.x"
GATEWAYDEV="eth0"
FORWARD_IPV4="yes"

Chane HOSTNAME above to reflect the name of your hostname. Dont modify anything else

Reboot if you made any change to the above files.
 
Last edited by a moderator:

trakwebster

Well-Known Member
Jan 29, 2003
145
0
166
And Whalla!

Hi again, Ozzi4648,

Actually it was only 15 minutes ago that I posted my question about resolv.conf, and here I have an answer (from you) almost immediamento!

The hosts and network files were fine, containing my correct information.

It was only the resolv.conf that contains somebody elses. No those aren't my IPs, except I suppose 127.0.0.1 might be correct for me as well as anybody.

I will change them to my IPs and domain info. But if this file is used, how is it that the server has been apparently working OK? What is the usage for which resolv.conf is designed?

Thanks for taking the time to fill me in.

-- Arthur Cronos from Voltos
 
O

ozzi4648

Guest
Re: And Whalla!

Originally posted by trakwebster
Hi again, Ozzi4648,

Actually it was only 15 minutes ago that I posted my question about resolv.conf, and here I have an answer (from you) almost immediamento!

The hosts and network files were fine, containing my correct information.

It was only the resolv.conf that contains somebody elses. No those aren't my IPs, except I suppose 127.0.0.1 might be correct for me as well as anybody.

I will change them to my IPs and domain info. But if this file is used, how is it that the server has been apparently working OK? What is the usage for which resolv.conf is designed?

Thanks for taking the time to fill me in.

-- Arthur Cronos from Voltos
Are you running your own DNS. You need to change that information. Are you sure it was working? Probably not optimally anyway.
 

trakwebster

Well-Known Member
Jan 29, 2003
145
0
166
Hmmm. Optimally ...

Hi Ozzi4648,

From what I could see of the DNS entries, they looked OK. (I'm a bit too ignorant to feel certain of what it *should* look like, but at least none of the old name was in there, and all the numbers and names were mine.)

The tech at the NOC -- upon my query -- said he found an error in the 'Reverse DNS' and he fixed that for me. I gather that the 'Reverse DNS' is something like the third string on a three-string mandolin (Bass, Treble, Reverse), and it's something that I cannot look at for myself.

But now you've got me worried. I don't know if it's running optimally. It runs, that's all I know.

Hmmm.
 

dreamwiz

Well-Known Member
Aug 28, 2003
93
0
156
I had same problems with my server, the hostname was old and wrong, though I had changed it from every possible place. It took a complete reboot of the server and the problem was fixed immediately. So when your getting a new server, first fix the new hostname, reboot, then go on with your configuration. :)