Help - Search - Members - Calendar
Full Version: HOWTO: The proper way to change your servers host name!
The Planet Forums > Control Panels > Ensim > Ensim HOWTOs
Pages: 1, 2, 3, 4
aussie
This is a repost of my origional HOWTO on changing the hostname of your server. It is identical to my origional post but with some clarification.

My tutorial site is still down, somebody thought it was ok to delete my nameservers so until then this post will remain.

If you want to keep your warranty, and you do not want to break Ensim, you will NOT use linuxconf. Do not use it!

If this file contains "ensim.rackshack.net" anywhere it is WRONG! Ensim.rackshack.net should NOT be anywhere in this file!

Somthing like this

216.40.226.??? srv01.yourdomain.com ensim.rackshack.net
or
216.40.226.??? srv01.yourdomain.com ensim
or
216.40.226.??? srv01.yourdomain.com ensim.rackshack.net ensim

ALL OF THE ABOVE IS ABSOLUTELY INCORRECT!!!!!!!!!!!!!!

1) SSH to your box
2) login as root
3) type pico /etc/hosts
4) modify the line that says

You will be changing this line from

xxx.xxx.xxx.xxx ensim.rackshack.net ensim

to

216.40.226.??? srv01.yourdomain.com srv01

Substitue the above ip for your own, and same with the server name. Change that to your own. It can be anything but it must contain at least 2 periods in the name and preferably ending in com or some other tld eg, net, cc, tv or whatever. See my example above!

YOU MUST keep the format of this file correct or else you will have all kind of problems. The proper way of entering the above is as follows:

The origional /etc/hosts file looks like this:

127.0.0.1|tab|localhost.localdomain|tab|localhost
216.40.xxx.xxx|tab|ensim.rackshack.net|tab|ensim

You need to change it to look like this

127.0.0.1|tab|localhost.localdomain|tab|localhost
216.40.xxx.xxx|tab|srv05.primenet.cc|tab|srv05 <-- only line that changes

|tab| = USE your tab key everytime you see the words |TAB|, see above. Its the caps lock key on the left side of your keyboard!!

DO NOT USE YOUR SPACE BAR to create space. As mouse says, TAB is your friend.

NOTE: There is only ONE tab between each!!!!

The format above is EXACTLY the format thats produced when using LINUXCONF to change your server name, but since we DONT recommend that you use LINUXCONF because of Ensim, it could break your box, we do it manually by producing the IDENTICAL format of what LINUXCONF would produce. Linuxconf would never create formats of the host file that look like 99% of those i'v seen posted.

type cntrl-x and save your file.

5) type pico /etc/sysconfig/network and modify the second line in file network to match the address of your server name as you did in step 4:

NETWORKING=yes
HOSTNAME="ensim.rackshack.net"
GATEWAY="216.40.226.1"
GATEWAYDEV="eth0"
FORWARD_IPV4="yes"

So you would change the line
HOSTNAME="ensim.rackshack.net"

to

HOSTNAME="srv01.yourdomain.com"

Save with a ctrl-x

/sbin/reboot

If your webppliance refuses to restart, you've made an error. Check your tabs folks, check the format of the /etc/hosts file. Most importantly, make sure you have not introduced any NEWLINES. Did you remember to reboot, see above!

When using pico your cursor should be sitting here prior to saving the file.

216.40.xxx.xxx|tab|srv05.primenet.cc|tab|srv05 |<-- HERE
not
216.40.xxx.xxx|tab|srv05.primenet.cc|tab|srv05
|<-- HERE -or
|<-- HERE

Need more help? Visit this post http://forum.rackshack.net/showthread.php?...65115#post65115

Your Done!
foggy
Thanks aussie for the update.

I fixed mine, and it works fine.. Where did the other method come from?
zephyrwind69
If you have pre-existing sites you might have to issue a hostname command. If you receive errors restarting webppliance do the following:

1. hostname srv1.yourdomain.com
2. hostname

The second hostname will echo your new hostname. This will clear any issues with the hostname remaining in memory and making webppliance to fail.
daveman692
One thing to add.

My server is users.boardnation.com. If I change the hostname to that then apache dies.
webbcite
Did you restart both httpd and webppliance? When you say it "dies", what does that mean? Do you have any error messages or more information you can provide?
daveman692
Yes, I restarted both apache and ensim. I really shouldn't say die since it is so ambiguous. What I mean is when I pulled up that domain I think, been a few weeks since I tried, it gave me a 404 error. But any other domains on my server still worked fine. When I changed it back it works fine.
Bubble
i get permission denied with try to edit the host file. Ani idea why?
foggy
Are you root?


su -

to get there
aussie
Log in as ROOT not ADMIN!
skywalllker
Do we have to change /etc/resolv.conf as well?

sky
ZigZagMan
Follow the first post in the thread to a T. Try restarting it webappl... If it Fails, this do what zeph said.

1. hostname srv1.yourdomain.com
2. hostname

Then restart webappl
aussie
QUOTE
Originally posted by ZigZagMan
Follow the first post in the thread to a T.   Try restarting it webappl...  If it Fails, this do what zeph said.

1. hostname srv1.yourdomain.com  
2. hostname  

Then restart webappl


If your webppliance refuses to restart, you've made an error. Check your tabs folks, check the format of the /etc/hosts file. Most importantly, make sure you have not introduced any NEWLINES.

When using pico your cursor should be sitting here prior to saving the file.

216.40.xxx.xxx|tab|srv05.primenet.cc|tab|srv05 |<-- HERE
not
216.40.xxx.xxx|tab|srv05.primenet.cc|tab|srv05
|<-- HERE -or
|<-- HERE

Need more help? Visit this post http://forum.rackshack.net/showthre...65115#post65115

Your Done!
ZigZagMan
That wasnt my case. I didn't make an error. I thought I did and double checked because you said if it fails you made an error. eheh

So after double checking I tried restarting it again and it failed again. I used hostname srv01.mydomain.com then restarted it and it worked. Weird but true. ? Im not to savy in what happened, just know it worked. hehe
madsere
An alternative version has been available here for months.
aussie
QUOTE
Originally posted by ZigZagMan
That wasnt my case.  I didn't make an error.  I thought I did and double checked because you said if it fails you made an error. eheh

So after double checking I tried restarting it again and it failed again.  I used   hostname srv01.mydomain.com    then restarted it and it worked. Weird but true.  ?      Im not to savy in what happened, just know it worked. hehe


We are using exactly what is posted in the first machine on ALL our boxes, and we have more than one box. Also, on all the boxes i have worked on, not mine, we have implamented the above changes without fail.

What is hostname srv1.yourdomain.com anyway? Its not supposed to be hostname, hostname is supposed to be the IP of your box followed by your hostname. EG

123.456.78.90|TAB|srv1.yourhostname.com|TAB|srv1

If you used srv01.mydomain.com i can see why it failed!

icon_biggrin.gif
ZigZagMan
I use srv01.myREALdomain.com : )

Someone mentioned setting it cleared the memory or something. I don't know exactly. : (
foggy
QUOTE
The linux tutorial network http://linux.cvf.net. Your guide to the latest HOWTO's



icon_sad.gif your link is broke again icon_sad.gif
nvmyevo
I am a newbie, and i see a lot of Howtos about this same subject, What is the point of doing this? Also on another note, I have 7 domains added into ensim, all working fine. I tried to add in another name based site and I am getting an error:

bind - Enable service
(WARNING):Failed to add A record turbomr2.net IN A 216.127.94.130 : This name server is not authoritative for the given zone
ERROR:This name server is not authoritative for the given zone

sendmail - Enable service
(WARNING):Failed to add MX record, turbomr2.net IN MX 10 mail.turbomr2.net : This name server is not authoritative for the given zone
ERROR:This name server is not authoritative for the given zone

And when i goto delete
sendmail - Disable service
(WARNING):Failed to remove MX record, turbomr2.net IN MX 10 mail.turbomr2.net : This name server is not authoritative for the given zone
ERROR:This name server is not authoritative for the given zone

bind - Disable service
(WARNING):Please use the Bind DNS Manager to edit/delete the zone for this domain.

I setup a BNC on my box, and I wanted to setup a vhost so i had rackshack setup a reverse pointer record for zerofivezero.com (a domain i own) So while on IRC it shows @zerofivezero.com . I am wondering if this has something to do with it. Thank You

Kev
aussie
QUOTE
Originally posted by foggy
 


icon_sad.gif  your link is broke again icon_sad.gif


It was broke for a few hours while the new nameservers were propogating. The tutorial network was moved onto our Plain RH box and its up and running. We are also moving the linux tutorials under the correct heading links so that specific tutorials for Linux. Ensim and Plesk will be available based on the platform the tutorial was written for. A few other changes are in the works including updates to tutorials specific for RH 7.2 as opposed to RH 7.1.
reallynicejerk
QUOTE
Originally posted by zephyrwind69
If you have pre-existing sites you might have to issue a hostname command.  If you receive errors restarting webppliance do the following:

1. hostname srv1.yourdomain.com
2. hostname

The second hostname will echo your new hostname.  This will clear any issues with the hostname remaining in memory and making webppliance to fail.


This should be added to the original message, I sat here for five minutes deleting spaces and double checking tabs and whatnot thinking that I F****D up my server when I couldn't get the webppliance to restart after changing my hostname until I read further down and saw these instructions, issued the hostname command and got webppliance to restart.

Thanks for the help zephyrwind69 and Aussie!
huck
You really should reboot after these changes.

There are a few files in ensim that have host dependent names in them. Such as the servename field in the apache config.

Ensim dynamically sets these via a detectchanges script that runs on boot and looks for hostname changes. It them patches up the necessary files. Including issues with bind, mysql, name based sites and sqmail.
reallynicejerk
these are the few restart commands that I have so far,

/sbin/service httpd restart
restarts http

/etc/rc.d/init.d/webppliance restart
restarts webppliance

/sbin/reboot
reboots server

I would rather 'be a sissy' and reboot the entire server than just the part that I altered, but in almost all the how-tos everyone just seems to restart the part that they're working with... is there any advantage to this over rebooting the entire server besides momentary downtime? And how long should it normally take the server to reboot? Probably longer with the more sites that you have huh?
reallynicejerk
I forgot and went off on a tangent, but the point of that post was to ask about any other restarting commands that I don't know of yet.
foggy
shutdown -r now
huck
Some changes do not require a reboot while others do.

But changing the hostname does require a reboot to fix the files I mentioned above. Also do not run the detectchanges script manually. That scripts runs before mysql, apache, ssh and other items start during the init process. So when it is running those services are not. If you run it manually it changes the config of actively running services.


Those bind, mysql and other errors are because those services are still using the old hostname while the system is at a different hostname.
reallynicejerk
QUOTE
NAME
      shutdown - bring the system down

SYNOPSIS
      /sbin/shutdown [-t sec] [-arkhncfF] time [warning-message]

DESCRIPTION
      shutdown brings the system down  in  a  secure  way.   All
      logged-in  users  are  notified  that  the system is going
      down, and login(1) is blocked.  
......
      -r     Reboot after shutdown.
.......


Alright so this is a better, more secure way to reboot the server?

I was told to enter PANIC, does this work? Just kidding.
huck
As root
type
reboot

If you use shutdown and forget the -r flag the server goes down to singler user mode and you will have to get RS to reboot it for you.
reallynicejerk
yeah that's what I gathered from the manual, and with my luck I WOULD forget the -r
reallynicejerk
raventec2
Reading my linux books reveals aussie's method is completely correct.... and it just plain works.
Where did all these alternatives come from anyhow??? :confused:
aussie
QUOTE
Originally posted by raventec2
Reading my linux books reveals aussie's method is completely correct.... and it just plain works.
Where did all these alternatives come from anyhow??? :confused:


icon_biggrin.gif
raventec2
No offense to you at all web1, But I don't think anyone said that it won't work. The problem that I'd be worried about is it not working in the future after an upgrade or something. There's nothing stopping you from creating a different how-too showing how to do it your way.
raventec2
np web1 icon_smile.gif Did you use pico to edit? I'm wondering if alot of the problem is with pico wanting to throw an extra line in everything that gets edited with it? I've run into that problem before. I still use pico -w but am in a habit of backing it up to the last character before I save.
Subwoofer
I followed Aussie's way and it work, however web1's way did not. Don't have a clue why... Maybe I messed up somewhere?

Well, Thanks for the how to! Good one!
raventec2
web1, I honestly couldn't tell you which files it matters if there's an extra line or not with. (if anyone knows, I'd love to know) I crashed a box once about 2 1/2 years ago because of the extra line because of pico. heheh, it was an expensive reboot so I done learned my lesson the hard way there!icon_biggrin.gif I probably should use vi but I absolutely detest it.
web1
raventec2, I think pico is very good for quick edit of files on the console, anything else I use a gui editor and transfer the file over.

BTW: pico does include a extra 0x0A if you are not careful, but I don't think it matters. My file only has one 0X0A at the end but yet I used pico to edit it so I must have been careful. I am happy with my set up and ain't gonna mess with it now!

Want to test this?

hexdump -c hosts

and restart named also when you are done with this whole change of name thing.
aussie
QUOTE
Originally posted by web1
aussie, 2nd request, please delete the message you posted that contains my message, you don't want to confuse people so please remove it and then I will remove these three last messages I posted and all will be well. Press "edit" here and then select delete.

raventec2, I think pico is very good for quick edit of files on the console, anything else I use a gui editor.


Delete your own message, i cannot delete your msgs. Just edit your msg, the ones you want to delete, then check the delete box and whalla!
51.ca
I have successly changed my hostname to "srv01.mydomian.com", BUT if I want to change to "srv02.mydomain.com" again, I failed!

What is the problem??
reallynicejerk
try entering:

hostname new.hostname.com
hostname

second host name command should echo the new hostname. Then try restarting webppliance again.
51.ca
OK icon_biggrin.gif

You are great!
reallynicejerk
so it worked, right? just checking icon_wink.gif

as far as I can tell, it was originally posted by zephyrwind69, not me. It's a couple of posts up.
ghostrider
Hi All

I've read all the posts here and gratefuuly accept all the wealth of knowledge and experience expressed.

I am pretty new to all this and as such a little tentative when it comes to changing my nameservers over. Is there any body who can give me assistance in doing this operation. I am willing to renumerate the person if they are willing to help.

Alternatively could someone help this retard with a complete step by step guide to renaming the rackshack server to my hosting company name.

Cheers in advance
reallynicejerk
ghostrider, this thread is an excellent step by step how-to on how to change your server name. is it not working for you? or are the instructions not clear enough?

Do you know how to SSH yet? I'm guessing not, seeing as how this was your first post. If so, then the place to start would be Creator's how-to on how to use SSH. http://forum.rackshack.net/showthread.php?...s=&postid=65315

Please let us know where you're getting stumped.
Seeker
lol i would rather reboot the server.. but if you want to be a sissy and test it before the reboot...

make sure you do this.. after you edit the files.

hostname something.domain.com

Whatever that domain you used was..

this will temporarily set the hostname to that and then the app will restart w/ no problems.. but i would still reboot.

better to find out now if something else is wrong than 20 days later when you have various paying customers.

my two bytes. lol
vladgur
Comments removed as to not get the omniknowing guru upset......

However his thorough how-to did not mention doing hostname myalias.myhostname.com thus leaving my ensim server in a failed state. Thanks to both madsere and reallynicejerk for bringing the missing pieces to this "clean and outlined" how-to
gpan
(Hopefully he already got it sorted out)
aussie
QUOTE
Originally posted by vladgur
one thing I might add, webppliance failed to restart unless I included ensim.rackshack.net ensim in the line like this:

my.ip.addrs[tab]myalias.mydomain.com[tab]myalias[tab]ensim.rackshack.net[tab]ens
im[enter]


Again, that is ABSOLUTELY INCORRECT! Didnt i indicate this?
Again, i outlined the method you used as TOTALLY INCORRECT in my origional message didnt I?

Some of you will just not learn and will persist to use your own methods. If you wish your own method post in your own thread would you? I prefer to keep this thread clean, as outlined and posted by me.

I wish you would read the origional message and understand what is written. If it FAILS you better look are your modification again. Either that or i will just simply delete the entire thread. It just not worth wasting time with those who want to use their own methods!
reallynicejerk
QUOTE
Originally posted by vladgur
one thing I might add, webppliance failed to restart unless I included ensim.rackshack.net ensim in the line like this:

my.ip.addrs[tab]myalias.mydomain.com[tab]myalias[tab]ensim.rackshack.net[tab]ens
im[enter]


all that this does is negate your changing the hostname. So, yes, it will restart, but I don't think that you actually changed the hostname.

The real reason why ensim didn't restart is probably because you didn't issue the hostname newhostname.domain.com command afterwards
reallynicejerk
aussie, perhaps you should add the

1. hostname srv1.yourdomain.com
2. hostname

command to the end of your how-to so that people don't freak out when ensim doesn't restart to cut down on these people having to do that kind of stuff to get ensim to restart and then posting it here.

zephyrwind69 posted it like three posts below yours, but still, a lot of people don't see that, they follow your how-to and then freak out when ensim won't restart and they do all this crazy stuff until it restarts again.
reallynicejerk
also, your comment about the cursor position in the file was after you had already told people to restart ensim, I reccomend putting it BEFORE you tell them to save the files, and also tell them to use pico -w (or picow icon_wink.gif ) to avoid problems, I shamefully admit that I had already rebooted and failed to load ensim before I read your comment about the cursor position at the bottom of the post. icon_wink.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.