Difference between revisions of "ZmSetServerName"

(another note...sigh)
m
Line 30: Line 30:
  
 
------
 
------
 
  
 
Things to check afterwards:
 
Things to check afterwards:
Line 37: Line 36:
 
zmprov gacf | grep zimbra.personal.com
 
zmprov gacf | grep zimbra.personal.com
 
etc...
 
etc...
 +
 +
You may need to regenerate certificates.
  
 
------
 
------
Someone else's notes:
 
  
these are changes i made manually after zmsetservername:
+
Notes on what people had to change manually after zmsetservername:
  
 +
Someone's note:
 
zmprov mcf zimbraLogHostname zimbra.company.com
 
zmprov mcf zimbraLogHostname zimbra.company.com
 
zmlocalconfig -e zimbra_server_hostname=zimbra.company.com
 
zmlocalconfig -e zimbra_server_hostname=zimbra.company.com
Line 52: Line 53:
 
zmlocalconfig -e smtp_source=admin@company.com
 
zmlocalconfig -e smtp_source=admin@company.com
  
also regenerate the certs
+
Another response:
 
 
-----
 
 
 
Response to that was:
 
 
 
 
There are several files in which I found the old host name after making all the above changes. I edited these files and replaced the old name with the new one (root user):
 
There are several files in which I found the old host name after making all the above changes. I edited these files and replaced the old name with the new one (root user):
 
Under zimbra/conf:
 
Under zimbra/conf:
Line 75: Line 71:
 
Not checked for reliability-someone recently mentioned:
 
Not checked for reliability-someone recently mentioned:
  
If you follow the directions exactly (stopping the services first), you get an error. If, instead, you just run the command, there is no error, and it stops the services automatically. That seems to have solved my "problem", or at least alleviated my fears. Since the internal DNS lists both domains fully, I'm not too worried about any leftover domain issues."
+
If you follow the directions exactly (stopping the services first), you get an error. If, instead, you just run the command, there is no error, and it stops the services automatically. That seems to have solved my "problem", or at least alleviated my fears. Since the internal DNS lists both domains fully, I'm not too worried about any leftover domain issues.
http://www.zimbra.com/forums/installation/8530-question-about-host-names.html#post45154
 
  
just to confirm...
+
-----
i had to switch the domain name and found troubles with the logger and server statistics:
 
  
zimbra 4.5.5 on ubuntu 6.06:
+
I had to switch the domain name and found troubles with the logger and server statistics:
 +
 
 +
(zimbra 4.5.5 on ubuntu 6.06)
  
 
these two hints worked fine:
 
these two hints worked fine:
 
+
1) the stopping services first thing
I decided to just try ZmSetServerName at ZmSetServerName - ZimbraWiki.
+
2) then:
 
 
If you follow the directions exactly (stopping the services first), you get an error. If, instead, you just run the command, there is no error, and it stops the services automatically. That seems to have solved my "problem", or at least alleviated my fears. Since the internal DNS lists both domains fully, I'm not too worried about any leftover domain issues.
 
then:
 
 
change of /etc/hosts
 
change of /etc/hosts
 
and
 
and
 
hostname newhostname
 
hostname newhostname
  
followed by -For the record this has what fixed:
+
followed by
  
 
Code:
 
Code:
Line 105: Line 98:
 
And my graps started working on the fly.
 
And my graps started working on the fly.
  
after this, i had TWO server-statistics:
+
But after this, I had TWO server-statistics:
 +
1. the old ones with the old servername
 +
2. a new - empty - set with the new servername.
  
-- the old ones with the old servername
+
at this point dnsdomainname still gave me the old domain !
-- a new - empty - set with the new servername.
 
  
at this point
+
I changed the content of the filename /etc/hostname (containing the old hostname ) and did a reboot.
dnsdomainname still gave me the old domain !
 
  
-- i changed the content of the filename /etc/hostname (containing the old hostname ) and did a reboot.
+
Now serverstatistics gives me only one servername, the new one, with the old statistical data still there and the new one displayed in a new set of graphs.
 
 
now serverstatistics gives me only one servername, the new one, with the old statistical data still there and the new one displayed in a new set of graphs.
 
  
 
Beware:
 
Beware:
before going the way described above, i had tried to solve the logging problem with:
+
Before going the way described above, I had tried to solve the logging problem with:
 
zmprov mcf zimbraLogHostname newhostname
 
zmprov mcf zimbraLogHostname newhostname
i finished up with a big mess and had to reverse completely to the old hostname to get the admin-console working again.
+
I finished up with a big mess and had to reverse completely to the old hostname to get the admin-console working again.
  
 
------
 
------
  
Someone else's OLDER method: (again take with a grain of salt)
+
Someone else's OLDER sans-zmsetservername method:
  
 
I went through the very painful process of chaning my hostname without reinstalling zimbra. This will probably void your warranty, but it worked for me (FC4, M1):
 
I went through the very painful process of chaning my hostname without reinstalling zimbra. This will probably void your warranty, but it worked for me (FC4, M1):
Line 196: Line 187:
  
 
Make sure to back everything up and cross your fingers. This should really be possible through zmprov or the admin console, but beta software is fun!
 
Make sure to back everything up and cross your fingers. This should really be possible through zmprov or the admin console, but beta software is fun!
 +
 +
-----
  
 
[[Category:Command Line Interface]]
 
[[Category:Command Line Interface]]

Revision as of 18:02, 17 August 2007

Changing the zimbra server's hostname

Step 1: MAKE A VERY GOOD BACKUP (your entire /opt/zimbra and any linked folders)

The commands

 su - zimbra
 zmcontrol stop
 /opt/zimbra/libexec/zmsetservername NEW_HOSTNAME

will set the zimbra server's name to NEW_HOSTNAME

2. Now update the ip address(es) and host name(s) for the server(s).

3. Some additional conf files will need to modify manually to reflect the new hostname:

  - ldap-scm.cf
  - ldap-transport.cf
  - ldap-vad.cf
  - ldap-vmd.cf
  - ldap-vmm.cf
  - ldap-vam.cf

4. Update DNS server

5. Edit /etc/sysconfig/network

6. Edit /etc/hosts file with new hostname

7. Reboot

(Those in multi server setups-restarting services on all hosts is required after this operation be sure to change any corresponding references to the old hostname!)


Things to check afterwards: It may not catch everything, but you can check manually. use zmlocalconfig and zmprov to check the global config, server configs, user settings, etc.

zmprov gacf | grep zimbra.personal.com etc...

You may need to regenerate certificates.


Notes on what people had to change manually after zmsetservername:

Someone's note: zmprov mcf zimbraLogHostname zimbra.company.com zmlocalconfig -e zimbra_server_hostname=zimbra.company.com zmlocalconfig -e ldap_master_url=ldap://zimbra.company.com:389 zmlocalconfig -e ldap_url=ldap://zimbra.company.com zmlocalconfig -e snmp_trap_host=zimbra.company.com zmlocalconfig -e av_notify_user=admin@company.com zmlocalconfig -e smtp_destination=admin@company.com zmlocalconfig -e smtp_source=admin@company.com

Another response: There are several files in which I found the old host name after making all the above changes. I edited these files and replaced the old name with the new one (root user): Under zimbra/conf: ldap-vmd.cf ldap-vam.cf amavisd.con ldap-vad.cf ldap-scm.cf ldap-transport.cf ldap-vmm.cf perdition.conf swatchrc I also had an entry in: zimbra/postfix/conf/main.cf (myhostname)



Not checked for reliability-someone recently mentioned:

If you follow the directions exactly (stopping the services first), you get an error. If, instead, you just run the command, there is no error, and it stops the services automatically. That seems to have solved my "problem", or at least alleviated my fears. Since the internal DNS lists both domains fully, I'm not too worried about any leftover domain issues.


I had to switch the domain name and found troubles with the logger and server statistics:

(zimbra 4.5.5 on ubuntu 6.06)

these two hints worked fine: 1) the stopping services first thing 2) then: change of /etc/hosts and hostname newhostname

followed by

Code: su - zimbra zmloggerctl stop ps aux | grep zmlogger kill any logger processes zmloggerctl start /opt/zimbra/libexec/zmlogprocess

And my graps started working on the fly.

But after this, I had TWO server-statistics: 1. the old ones with the old servername 2. a new - empty - set with the new servername.

at this point dnsdomainname still gave me the old domain !

I changed the content of the filename /etc/hostname (containing the old hostname ) and did a reboot.

Now serverstatistics gives me only one servername, the new one, with the old statistical data still there and the new one displayed in a new set of graphs.

Beware: Before going the way described above, I had tried to solve the logging problem with: zmprov mcf zimbraLogHostname newhostname I finished up with a big mess and had to reverse completely to the old hostname to get the admin-console working again.


Someone else's OLDER sans-zmsetservername method:

I went through the very painful process of chaning my hostname without reinstalling zimbra. This will probably void your warranty, but it worked for me (FC4, M1):

Change your hostname using hostname. Change your hosts file and your /etc/sysconfig/network

use zmprov to change the following fields to your new hostname zimbraLmtpAdvertisedName zimbraServiceHostname zimbraSmtpHostname

for example:

zmprov cs oldserver.com zimbraLmtpAdvertisedName newserver.com ....

Then, for every single user in your sytem (that's right), you have to do this:

zmprov ma user@domain.com zimbraMailHost new.domain.com

I suggest writing a shell script. To get a list of users, do this or something similar:

zmprov gaa -v | grep '# name'

Once your done with this tedious task, do a:

grep -il oldserver.com ~zimbra/conf/*

Change the hostname in any of the files returned by this command using vi or whatever.

Then shutdown your zimbra software:

zmcontrol shutdown

Start it back up:

zmcontrol startup

The only service that will start is ldap and zmmon (for the server in question, at least). This is where it gets fun. You have to manually edit the directory as follows.

First figure out your DN. From ~zimbra/openldap/bin do a:

./ldapsearch -x | grep oldservername.com

You will see a line that looks like this:

  1. oldhost.domain.com, servers, zimbra

dn: cn=oldhost.domain.com,cn=servers,cn=zimbra [snip] cn: oldhost.domain.com

This is the dn of your server. You will need to change it. To do so create a file called, for example, changes.ldif. For the above example, it would look like this:

cn=oldhost.domain.com,cn=servers,cn=zimbra cn=newhost.domain.com

Now, grab your zimbra_ldap_password from ~zimbra/conf/localconfig.xml.

Then run the following command from your ~zimbra/openldap/bin dir:

./ldapmodrdn -h localhost -w password_From_above -D "uid=zimbra,cn=admins,cn=zimbra" -x -r -f changes.ldif

Now do a zmcontrol shutdown. Then do a ps -U zimbra and kill any zimbra-related processes that are still hanging around. If you kill perl, you should clear the .pid file here:

/opt/zimbra/zimbramon/FIFO/zm.pid

Now rebuild your SSL keys for the new hostname.

If all went well, everything should start on a zmcontrol startup

One thing I didn't address is changing the hostname on statistics data in mysql, but it doesn't seem to cause a problem, so I haven't gotten around to it yet.

Make sure to back everything up and cross your fingers. This should really be possible through zmprov or the admin console, but beta software is fun!


Jump to: navigation, search