Web Hosting Talk







View Full Version : HOW TO: Change the hostname and not get cpanels licence error


Ben James
07-14-2007, 07:04 PM
I have found over the years that it is anoying when you update the hostname on a server running cpanel and cpanel gives you an invalid licence error, if you want to change the hostname on a cpanel server then

1)log into shell with root

2)type "hostname (then at the end put anything you want as your hostname, but it must be something.yourdomain.xxx please be aware that the something will show as the server name in cpanel

3)type /usr/local/cpanel/cpkeyclt

then just load cpanel as you would normaly, but dont forget to add an a entry for the new hostname

ramdak5000
07-14-2007, 10:51 PM
Very useful. I have a few VPS accounts whose hostnames I have changed several times to reflect the changes in my business strategy and each time, I had to ask my hosting company to take care of the cPanel licence issue.

When you say, "then just load cpanel as you would normaly", do you actually mean WHM?

layer0
07-15-2007, 03:00 AM
If you change hostnames on a Virtuozzo/OpenVZ VPS, you should also ensure that your host has updated the hostname from their side as well...else your hostname will be reset the next time your VPS reboots. There are ways around that too, but its simpler just provide your host with the up to date info.

Ben James
07-15-2007, 07:18 AM
you could load cpanel or whm normally, it is just to test that it has worked correctly

ihostq
08-09-2007, 09:06 PM
I have always had this problem. Now, i just type in /usr/local/cpanel/cpkeyclt in command promt, and it works great! No problem at all, as it updates with cpanel.net automatically when you type it.

TGJ_Sean
09-21-2007, 09:51 PM
Thanks it helped.

Great info, :)

Ben James
10-06-2007, 12:33 PM
Glad to be able to help :)

Checkers
12-23-2007, 05:48 PM
LOL thanks mate.. i was kinda struggling with this..

supportoncall
12-25-2007, 04:07 PM
Easy and well known stuff to do.

Ben James
01-13-2008, 09:57 AM
it may be easy and well known however some people still dont know this stuff and this sort of forum is the perfect place to learn :)

psyxakias
01-13-2008, 04:40 PM
/usr/local/cpanel/cpkeyclt re-downloads the license from cPanel's site which is s required if you change mainIP (requires license adjustment from cPanel's side too) or hostname. However, changing hostname with "hostname <new.host.name>" without setting it in O/S's configuration, will be reverted at the next reboot giving you the unlicensed error again.

So there should be another step to change it on the O/S startup configuration (depending the O/S or type of server: dedicated/vps), not just using hostname command ;)

Thank you.

Ben James
01-14-2008, 12:51 PM
I will post how to do this when i have the time :)

Ben James
04-11-2008, 04:12 PM
ok, sorry it has taken me so long to post the final pice to this thread i have been kind of busy recently.

first pico /etc/hosts

type something similar to

<your server shared ip here> <chosen hostname here>.<your domain here>.<extension>

the below that have

127.0.0.1 localhost


then you can use the hostname command to set your hostname to the same as it is in your /ect/hosts configuration.

linux-tech
04-11-2008, 04:58 PM
if you want to change the hostname on a cpanel server then

Use CPanel to manage cpanel and related materials. Don't make it more complicated than it has to be. WHM no longer gives you a 'license error'.


first pico /etc/hosts

/etc/hosts is NOT a valid place to change a hostname, nor is it any sort of relevant place for your system's hostname to be changed. 2 places require changing, but NOT /etc/hosts

#1:
/etc/sysconfig/network needs to be updated
#2:
/proc/sys/kernel/hostname needs to be updated

Now, since you're using Cpanel, it's best to use CPanel to manage Cpanel's things (backups, etc), because otherwise it'll try to rewrite system files (ie: hostname)

This brings us to the question:

what is /etc/hosts for



Well, that's answered in the man pages:

This file is a simple text file that associates IP addresses with hostnames, one line per IP address. For each host a single line should be present with the following information:


In english (layman's terms):
/etc/hosts is a 'dns' of sorts. It doesn't rely on dns running, the resolvers running, or anything of the like. It is NOT used to control the system's hostname, though it CAN be used to look up the system's hostname. You can add multiple ip host combinations in there and they will ALWAYS be available to the system, REGARDLESS of whether your dns is running or not

The files needed to edit the hostname are listed above, though, again, if you're using a control panel (CPanel), or even a VPS (virtuozzo, etc), you'll want to use THEIR setup to change and manipulate your hostname so that you can be sure it doesn't go right back where you don't want it to go

Ben James
04-11-2008, 05:04 PM
Thanks for this, i have allways used cpanel to change the hostname so have never had to do it manualy, just update the licence.

Thanks.

larwilliams
04-11-2008, 05:55 PM
I have found over the years that it is anoying when you update the hostname on a server running cpanel and cpanel gives you an invalid licence error, if you want to change the hostname on a cpanel server then

1)log into shell with root

2)type "hostname (then at the end put anything you want as your hostname, but it must be something.yourdomain.xxx please be aware that the something will show as the server name in cpanel

3)type /usr/local/cpanel/cpkeyclt

then just load cpanel as you would normaly, but dont forget to add an a entry for the new hostname

Using the Hostname function in WHM, I have never had any errors with regards to an invalid license. It has always "just worked".

linux-tech
04-11-2008, 05:59 PM
Back when this was written (IE: before CP11 was stable), there was a strong chance that it would do what the OP was talking about. You'd change the hostname in Cp/WHM and then have to run cpkeyclt . Now, it's a no-brainer, they've setup the script to either automatically run it (possible), or done some other sort of licensing check (possible too). Either way, it did used to be a rather annoying issue that would come up every time the hostname was changed

op3l
12-09-2010, 10:47 PM
my cpanel doesn't support php-cli and I can't manually install, centos OS. please somebody help me with that

petteyg359
12-09-2010, 11:51 PM
my cpanel doesn't support php-cli and I can't manually install, centos OS. please somebody help me with that

Start a new thread with an appropriate topic, instead of reviving a long-dead thread that isn't even related to your question.

op3l
12-10-2010, 01:11 AM
I'm new member can't start new topic so I looking thread under cpanel title, please forgive me

SamiBH
12-15-2010, 11:11 AM
Thank you...