Revision as of 15:01, 17 August 2007 by Mmorse (talk | contribs) (spaces)

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>

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

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


2. Update DNS server

3. Edit /etc/sysconfig/network

4. Edit /etc/hosts file with new hostname

5. Reboot

Restarting services on all hosts is required after this operation

Someone else's notes:

there is a command "zmsetservername <new-zmhostname>" which changes hostname settings in zimbra. 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 etc...

these are changes i made manually after zmsetservername:

zmprov mcf zimbraLogHostname zmlocalconfig -e zmlocalconfig -e ldap_master_url=ldap:// zmlocalconfig -e ldap_url=ldap:// zmlocalconfig -e zmlocalconfig -e zmlocalconfig -e zmlocalconfig -e

also regenerate the certs

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): Under zimbra/conf: amavisd.con perdition.conf swatchrc I also had an entry in: zimbra/postfix/conf/ (myhostname)

Not checked for reliability-someone recently mentioned:

"I decided to just try ZmSetServerName 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."

Someone else's OLDER method: (again take with a grain of salt)

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 zimbraLmtpAdvertisedName ....

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

zmprov ma zimbraMailHost

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 ~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

You will see a line that looks like this:

  1., servers, zimbra

dn:,cn=servers,cn=zimbra [snip] cn:

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=servers,cn=zimbra

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:


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