Difference between revisions of "ZmSetServerName"

(Clean the zmloggerhostmap)
 
(47 intermediate revisions by 13 users not shown)
Line 1: Line 1:
== Changing the zimbra server's hostname ==
+
{{BC|Certified}}
 +
__FORCETOC__
 +
<div class="col-md-12 ibox-content">
 +
=ZmSetServerName=
 +
{{KB|{{ZC}}|{{ZCS 8.6}}|{{ZCS 8.5}}|{{ZCS 8.0}}|}}
 +
{{WIP}}
 +
=ZmSetServerName=
 +
The following article outlines how to use '''zmsetservername''' to change the Zimbra server's hostname.  Please note that the usage of this CLI command differs depending on what version of ZCS you are running.
  
 +
==Syntax==
 +
./zmsetservername [-h] [-d] [-f] [-s] [-o <prev servername>] [-v+] -n
 +
<servername>
  
1. MAKE A VERY GOOD BACKUP (your entire /opt/zimbra and any linked folders)
+
===Description===
 +
Changes the name of the local zimbra server.
  
2. The commands: (Warning: Once again before you run the below, heed the advice - ''make a backup'' - it seems simple but there's a million ways this process can get messed up)
+
===Options===
  su - zimbra
+
{|style="width:100%" border="1" cellpadding="5" cellspacing="0"
  zmcontrol stop
+
! align="left" style="color:white;" bgcolor="#0087c3" |Name
  /opt/zimbra/libexec/zmsetservername NEW_HOSTNAME
+
! align="left" style="color:white;" bgcolor="#0087c3" |Description
 +
|-
 +
|<nowiki>--help</nowiki>
 +
|Displays usage options for '''zmsetservername'''.
 +
|-
 +
|<nowiki>--force</nowiki>
 +
|Force the rename, bypassing safety checks.
 +
|-
 +
|<nowiki>--oldServerName</nowiki>
 +
|'''<oldname>''' Previous name for the server.  Defaults to LC zimbra_server_hostname.
 +
|-
 +
|<nowiki>--newServerName</nowiki>
 +
|'''<newname>''' New name for the server.
 +
|-
 +
|<nowiki>--deletelogger</nowiki>
 +
|Delete the logger database for the old server.  Default is to remap its data to the new hostname.
 +
|-
 +
|<nowiki>--skipusers</nowiki>
 +
|Skips modifying the user database with the new server.
 +
|-
 +
|<nowiki>--usersonly</nowiki>
 +
|Only updates the user database.  This way, you can run once to do all the server updates, and then a second time to update the accounts.  Likely
 +
requires --force.
 +
|-
 +
|<nowiki>--verbose</nowiki>
 +
|Set the verbosity level.  Can be specified multiple times to increase the level.
 +
|}
  
3. Some additional conf files will need to be modified manually to reflect the new hostname:
+
=Steps to change the hostname at Server level=
    ldap-scm.cf
+
*1.- The first step is take a complete Zimbra Backup, Snapshot, and VM Backup, or all of them if you have the chance.
    ldap-transport.cf
+
*2.- Backup your actual folder /opt/zimbra/ssl/zimbra/ you will need later
    ldap-vad.cf
+
Deploy a SSL Self-signed instead your commercial one
    ldap-vmd.cf
+
/opt/zimbra/bin/zmcertmgr createca -new
    ldap-vmm.cf
+
/opt/zimbra/bin/zmcertmgr createcrt -new -subjectAltNames <servername> -days 365
    ldap-vam.cf
+
/opt/zimbra/bin/zmcertmgr deploycrt self
 +
/opt/zimbra/bin/zmcertmgr deployca
 +
/opt/zimbra/bin/zmcertmgr viewdeployedcrt
 +
zmcontrol restart
 +
*3.- Change the hostname in '''/etc/hosts'''. Note that if you are running '''dnsmasq''' in your server, you should have both hostnames in the /etc/hosts like:
 +
<pre>
 +
127.0.0.1      localhost.localdomain  localhost
 +
192.168.211.20  NEWHOSTNAME.example.com        NEWHOSTNAME
 +
192.168.211.20  OLDHOSTNAME.example.com        OLDHOSTNAME
  
Now update the ip address(es) and host name(s) for the server(s)
+
# The following lines are desirable for IPv6 capable hosts
 +
::1    localhost ip6-localhost ip6-loopback
 +
ff02::1 ip6-allnodes
 +
ff02::2 ip6-allrouters
 +
</pre>
 +
If not you will obtain the next error:
 +
Unable to contact ldap://OLDHOSTNAME.example.com:389: Invalid argument
  
4. Update DNS server
+
*4.- Change the hostname in '''/etc/hostname'''
  
5. Edit /etc/sysconfig/network
+
=Steps to change the hostname at DNS level=
 +
You need to create or change the DNS, A and MX entry at your DNS level.  
  
6. Edit /etc/hosts file with new hostname
+
==Example using dnsmasq in Single-Server==
 +
For example, running a Single-Server using dnsmasq, you need to edit the dnsmasq.conf file and change the next files with your new values:
 +
server=8.8.8.8
 +
server=208.67.222.222
 +
domain=example.com
 +
mx-host=example.com,<servername>.example.com,5
 +
listen-address=127.0.0.1
  
7. Reboot
+
Restart the dnsmasq service:
 +
service dnsmasq restart
  
(Those in multi-server setups: Be sure to change any corresponding references to the old hostname & restart services on all hosts)
+
==Bind server or another DNS in other server==
 +
If you have an external DNS server, you need to create a new A entry for the new hostname, and change the MX to point to the new hostname. It is important don't delete yet the old hostname A entry or you will obtain the next error:
 +
Unable to contact ldap://OLDHOSTNAME.example.com:389: Invalid argument
  
8. Things to check afterwards:
+
=Steps to change the Zimbra server's hostname using zmsetservername=
 +
Use the following steps to change the Zimbra server's hostname using the '''zmsetservername''' command line utility.
  
It may not catch everything, but you can check manually. Use zmlocalconfig and zmprov to check the global config, server configs, user settings, etc.
+
*1.- Stop the flow of mail/Zimbra and back up your entire '''/opt/zimbra''' and any linked foldersFor more information on creating a backup, see [[:Category:Backup and Restore]].
  zmprov gacf | grep zimbra.domain.com
+
*2.- The new hostname must exist in the DNS before '''zmsetservername''' is run. If it does not already exist in the DNS, add the new hostname to the DNS now.
etc...
 
  
9. You may need to regenerate certificates. (another wiki article)
+
'''''Note:''' <font color=red><strong>If the box is duplicate of production server, prevent this command from affecting the production server by halting communications between test and live servers.</strong></font color=red>
  
10. And if it didn't work (you'll start getting a lot of errors/funny quirks) double check a few of the below comments & suggestions:
+
*3.- Run the following commands:
 
 
 
 
------
 
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 /opt/zimbra/conf:
 
amavisd.conf
 
perdition.conf
 
swatchrc
 
I also had an entry in /opt/zimbra/postfix/conf/main.cf (myhostname)
 
 
 
 
 
------
 
 
 
 
 
------
 
Not checked for reliability-someone 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.
 
 
 
 
 
-----
 
The logger/stats graphs issues (this is mainly if you didn't zmcontrol stop/reboot):
 
 
 
I had to switch the domain name and found troubles with the logger and server statistics-extra steps needed:
 
(zimbra 4.5.5 on ubuntu 6.06)
 
 
 
the not stopping services first thing
 
 
 
then:
 
change of /etc/hosts
 
and
 
hostname newhostname
 
 
 
followed by:
 
 
  su - zimbra
 
  su - zimbra
zmloggerctl stop
+
  /opt/zimbra/libexec/zmsetservername -n <servername>
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.
+
You will obtain the next output retrieving all the data of the ldap with the old hostname:
 +
<pre>Getting local config zimbra_server_hostname=zimbra-sn-u14-01.example.com
 +
Getting local config zimbra_ldap_userdn=uid=zimbra,cn=admins,cn=zimbra
 +
Getting local config zimbra_ldap_password=YOURPASS
 +
Getting local config ldap_is_master=true
 +
Getting local config ldap_url=ldap://zimbra-sn-u14-01.example.com:389
 +
Getting local config ldap_master_url=ldap://zimbra-sn-u14-01.example.com:389
 +
Getting local config ldap_starttls_supported=1
 +
Starting ldap...already running.
 +
Renaming zimbra-sn-u14-01.example.com to zimbra-sn-u14-02.example.com
 +
Shutting down zimbra...done.
 +
Setting local config ldap_master_url=ldap://zimbra-sn-u14-02.example.com:389
 +
Setting local config ldap_url=ldap://zimbra-sn-u14-02.example.com:389
 +
Getting local config ldap_host=zimbra-sn-u14-01.example.com
 +
Setting local config ldap_host=zimbra-sn-u14-02.example.com
 +
Getting local config av_notify_user=admin@example.com
 +
Getting local config av_notify_domain=example.com
 +
Getting local config snmp_trap_host=zimbra-sn-u14-01.example.com
 +
Setting local config snmp_trap_host=zimbra-sn-u14-02.example.com
 +
Getting local config smtp_source=admin@example.com
 +
Getting local config smtp_destination=admin@example.com
 +
Setting local config zimbra_server_hostname=zimbra-sn-u14-02.example.com
 +
Starting ldap...done.</pre>
  
Then shutdown your zimbra software (zmcontrol shutdown/stop)
+
And then, you will see the next output with all the changes with the new hostname:
 +
<pre>Searching for ldap server entry...done.
 +
Renaming cn=zimbra-sn-u14-01.example.com,cn=servers,cn=zimbra...done.
 +
Updating zimbraServiceHostname for cn=zimbra-sn-u14-02.example.com,cn=servers,cn=zimbra...done.
 +
Updating zimbraSpellCheckURL for cn=zimbra-sn-u14-02.example.com,cn=servers,cn=zimbra...done.
 +
Updating zimbraSmtpHostname for cn=zimbra-sn-u14-02.example.com,cn=servers,cn=zimbra...done.
 +
Updating zimbraLogHostname for cn=config,cn=zimbra...done.
 +
Updating zimbraMailHost for uid=admin,ou=people,dc=example,dc=com...done.
 +
Updating zimbraMailHost for uid=spam.y8za6ogxq,ou=people,dc=example,dc=com...done.
 +
Updating zimbraMailHost for uid=ham.unqt3dpn,ou=people,dc=example,dc=com...done.
 +
Updating zimbraMailHost for uid=virus-quarantine.mezhhbmuys,ou=people,dc=example,dc=com...done.
 +
Updating zimbraMailHost for uid=galsync.r9xuodn2,ou=people,dc=example,dc=com...done.
 +
Updating zimbraMailTransport for uid=admin,ou=people,dc=example,dc=com...done.
 +
Updating zimbraMailTransport for uid=spam.y8za6ogxq,ou=people,dc=example,dc=com...done.
 +
Updating zimbraMailTransport for uid=ham.unqt3dpn,ou=people,dc=example,dc=com...done.
 +
Updating zimbraMailTransport for uid=virus-quarantine.mezhhbmuys,ou=people,dc=example,dc=com...done.
 +
Updating zimbraMailTransport for uid=galsync.r9xuodn2,ou=people,dc=example,dc=com...done.
 +
Services:
 +
Getting local config ldap_port=389
 +
Reinitializing the mta config...done.
 +
Reinitializing the snmp config...done.</pre>
  
Start it back up (zmcontrol startup/start)
+
*4.- Delete the entry to the old hostname in /etc/hosts if you are using dnsmasq, and delete the A entry in for the old hostname in the DNS if you are running external DNS Server
  
The only service that will start is ldap and zmmon (for the server in question, at least). This is where it gets fun.
+
=Clean the zmloggerhostmap=
You have to manually edit the directory as follows.
+
Zimbra didn't clean the '''zmloggerhostmap''', so you need to remove the old hostname manually.
 +
Check what is the actual status of the '''zmloggerhostmap''':
 +
<pre>zmloggerhostmap
 +
Zimbra Logger Service Hostname Map
  
First figure out your DN. From ~zimbra/openldap/bin do a:
+
---------------------    ---------------------
./ldapsearch -x | grep oldservername.com
+
DNS Hostname            Zimbra Hostname
 +
---------------------    ---------------------
 +
zimbra-sn-u14-02.example.com    zimbra-sn-u14-02.example.com
 +
zimbra-sn-u14-01.example.com    zimbra-sn-u14-01.example.com
 +
zimbra-sn-u14-01    zimbra-sn-u14-02.example.com
 +
zimbra-sn-u14-02    zimbra-sn-u14-02.example.com</pre>
  
You will see a line that looks like this:
+
Remove all the references to the old hostname:
  # oldhost.domain.com, servers, zimbra
+
  zmloggerhostmap -d zimbra-sn-u14-01.example.com   zimbra-sn-u14-01.example.com
dn: cn=oldhost.domain.com,cn=servers,cn=zimbra
+
  zmloggerhostmap -d zimbra-sn-u14-01    zimbra-sn-u14-02.example.com
  [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:
+
You will see the next output per each delete:
  cn=oldhost.domain.com,cn=servers,cn=zimbra
+
  Deleted mapping for zimbra-sn-u14-01 to zimbra-sn-u14-02.example.com
cn=newhost.domain.com
 
  
Now, grab your zimbra_ldap_password from ~zimbra/conf/localconfig.xml.
+
Stop the Zimbra services:
 +
zmcontrol stop
  
Then run the following command from your ~zimbra/openldap/bin dir:
+
=Reboot and test the new hostname in the Admin Console=
./ldapmodrdn -h localhost -w password_From_above -D "uid=zimbra,cn=admins,cn=zimbra" -x -r -f changes.ldif
+
Do the final reboot and login in the Admin Console and navigate under '''Home > Monitor > Server Status'''
  
Now do a zmcontrol shutdown.  
+
[[File:Zimbra-renameserver-001.png|800px]]
  
Then do a ps -U zimbra and kill any zimbra-related processes that are still hanging around.
+
'''''Note:''' If you have a multi-server setup, be sure to change any corresponding references to the old hostname & restart services on all hosts.
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.
+
=Check the configuration using zmlocalconfig=
 +
Use zmlocalconfig and zmprov to manually double-check the global config, server configs, user settings, etc.
 +
zmprov gacf | grep oldhostname
 +
zmprov gs `zmhostname` | grep oldhostname
 +
zmlocalconfig | grep oldhostname
  
If all went well, everything should start on a zmcontrol startup.
+
Errors are usually certificates. If you are experiencing errors, you will probably need to obtain new certs to match the new hostname.  For more information on working with certificates, see [[Administration Console and CLI Certificate Tools]]. For more information on troubleshooting certificate issues, see [[:Category:Troubleshooting Certificates]].
  
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.
+
==Additional Content==
 +
This article will not be certified at the current time, please file bugs for any errors your encounter to help improve this command.
 +
* Bug 10696
 +
* Bug 23404
 +
* Bug 26411 - auto re-creation of self-signed certs
 +
* Bug 34026
  
Make sure to back everything up and cross your fingers!
 
-----
 
  
 +
{{Article Footer|Zimbra Collaboration 8.6, 8.5, 8.0|08/17/2007}}
 +
{{NeedSME|Jorge|SME2|Copyeditor}}
 
[[Category:Command Line Interface]]
 
[[Category:Command Line Interface]]

Latest revision as of 13:25, 5 September 2015

ZmSetServerName

   KB 1593        Last updated on 2015-09-5  




0.00
(0 votes)

ZmSetServerName

The following article outlines how to use zmsetservername to change the Zimbra server's hostname. Please note that the usage of this CLI command differs depending on what version of ZCS you are running.

Syntax

./zmsetservername [-h] [-d] [-f] [-s] [-o <prev servername>] [-v+] -n <servername>

Description

Changes the name of the local zimbra server.

Options

Name Description
--help Displays usage options for zmsetservername.
--force Force the rename, bypassing safety checks.
--oldServerName <oldname> Previous name for the server. Defaults to LC zimbra_server_hostname.
--newServerName <newname> New name for the server.
--deletelogger Delete the logger database for the old server. Default is to remap its data to the new hostname.
--skipusers Skips modifying the user database with the new server.
--usersonly Only updates the user database. This way, you can run once to do all the server updates, and then a second time to update the accounts. Likely

requires --force.

--verbose Set the verbosity level. Can be specified multiple times to increase the level.

Steps to change the hostname at Server level

  • 1.- The first step is take a complete Zimbra Backup, Snapshot, and VM Backup, or all of them if you have the chance.
  • 2.- Backup your actual folder /opt/zimbra/ssl/zimbra/ you will need later

Deploy a SSL Self-signed instead your commercial one

/opt/zimbra/bin/zmcertmgr createca -new
/opt/zimbra/bin/zmcertmgr createcrt -new -subjectAltNames <servername> -days 365
/opt/zimbra/bin/zmcertmgr deploycrt self
/opt/zimbra/bin/zmcertmgr deployca
/opt/zimbra/bin/zmcertmgr viewdeployedcrt
zmcontrol restart
  • 3.- Change the hostname in /etc/hosts. Note that if you are running dnsmasq in your server, you should have both hostnames in the /etc/hosts like:
127.0.0.1       localhost.localdomain   localhost
192.168.211.20  NEWHOSTNAME.example.com        NEWHOSTNAME
192.168.211.20  OLDHOSTNAME.example.com        OLDHOSTNAME

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

If not you will obtain the next error:

Unable to contact ldap://OLDHOSTNAME.example.com:389: Invalid argument
  • 4.- Change the hostname in /etc/hostname

Steps to change the hostname at DNS level

You need to create or change the DNS, A and MX entry at your DNS level.

Example using dnsmasq in Single-Server

For example, running a Single-Server using dnsmasq, you need to edit the dnsmasq.conf file and change the next files with your new values:

server=8.8.8.8
server=208.67.222.222
domain=example.com
mx-host=example.com,<servername>.example.com,5
listen-address=127.0.0.1

Restart the dnsmasq service:

service dnsmasq restart

Bind server or another DNS in other server

If you have an external DNS server, you need to create a new A entry for the new hostname, and change the MX to point to the new hostname. It is important don't delete yet the old hostname A entry or you will obtain the next error:

Unable to contact ldap://OLDHOSTNAME.example.com:389: Invalid argument

Steps to change the Zimbra server's hostname using zmsetservername

Use the following steps to change the Zimbra server's hostname using the zmsetservername command line utility.

  • 1.- Stop the flow of mail/Zimbra and back up your entire /opt/zimbra and any linked folders. For more information on creating a backup, see Category:Backup and Restore.
  • 2.- The new hostname must exist in the DNS before zmsetservername is run. If it does not already exist in the DNS, add the new hostname to the DNS now.

Note: If the box is duplicate of production server, prevent this command from affecting the production server by halting communications between test and live servers.

  • 3.- Run the following commands:
su - zimbra
/opt/zimbra/libexec/zmsetservername -n <servername>

You will obtain the next output retrieving all the data of the ldap with the old hostname:

Getting local config zimbra_server_hostname=zimbra-sn-u14-01.example.com
Getting local config zimbra_ldap_userdn=uid=zimbra,cn=admins,cn=zimbra
Getting local config zimbra_ldap_password=YOURPASS
Getting local config ldap_is_master=true
Getting local config ldap_url=ldap://zimbra-sn-u14-01.example.com:389
Getting local config ldap_master_url=ldap://zimbra-sn-u14-01.example.com:389
Getting local config ldap_starttls_supported=1
Starting ldap...already running.
Renaming zimbra-sn-u14-01.example.com to zimbra-sn-u14-02.example.com
Shutting down zimbra...done.
Setting local config ldap_master_url=ldap://zimbra-sn-u14-02.example.com:389
Setting local config ldap_url=ldap://zimbra-sn-u14-02.example.com:389
Getting local config ldap_host=zimbra-sn-u14-01.example.com
Setting local config ldap_host=zimbra-sn-u14-02.example.com
Getting local config av_notify_user=admin@example.com
Getting local config av_notify_domain=example.com
Getting local config snmp_trap_host=zimbra-sn-u14-01.example.com
Setting local config snmp_trap_host=zimbra-sn-u14-02.example.com
Getting local config smtp_source=admin@example.com
Getting local config smtp_destination=admin@example.com
Setting local config zimbra_server_hostname=zimbra-sn-u14-02.example.com
Starting ldap...done.

And then, you will see the next output with all the changes with the new hostname:

Searching for ldap server entry...done.
Renaming cn=zimbra-sn-u14-01.example.com,cn=servers,cn=zimbra...done.
Updating zimbraServiceHostname for cn=zimbra-sn-u14-02.example.com,cn=servers,cn=zimbra...done.
Updating zimbraSpellCheckURL for cn=zimbra-sn-u14-02.example.com,cn=servers,cn=zimbra...done.
Updating zimbraSmtpHostname for cn=zimbra-sn-u14-02.example.com,cn=servers,cn=zimbra...done.
Updating zimbraLogHostname for cn=config,cn=zimbra...done.
Updating zimbraMailHost for uid=admin,ou=people,dc=example,dc=com...done.
Updating zimbraMailHost for uid=spam.y8za6ogxq,ou=people,dc=example,dc=com...done.
Updating zimbraMailHost for uid=ham.unqt3dpn,ou=people,dc=example,dc=com...done.
Updating zimbraMailHost for uid=virus-quarantine.mezhhbmuys,ou=people,dc=example,dc=com...done.
Updating zimbraMailHost for uid=galsync.r9xuodn2,ou=people,dc=example,dc=com...done.
Updating zimbraMailTransport for uid=admin,ou=people,dc=example,dc=com...done.
Updating zimbraMailTransport for uid=spam.y8za6ogxq,ou=people,dc=example,dc=com...done.
Updating zimbraMailTransport for uid=ham.unqt3dpn,ou=people,dc=example,dc=com...done.
Updating zimbraMailTransport for uid=virus-quarantine.mezhhbmuys,ou=people,dc=example,dc=com...done.
Updating zimbraMailTransport for uid=galsync.r9xuodn2,ou=people,dc=example,dc=com...done.
Services: 
Getting local config ldap_port=389
Reinitializing the mta config...done.
Reinitializing the snmp config...done.
  • 4.- Delete the entry to the old hostname in /etc/hosts if you are using dnsmasq, and delete the A entry in for the old hostname in the DNS if you are running external DNS Server

Clean the zmloggerhostmap

Zimbra didn't clean the zmloggerhostmap, so you need to remove the old hostname manually. Check what is the actual status of the zmloggerhostmap:

zmloggerhostmap
 Zimbra Logger Service Hostname Map

---------------------    ---------------------
DNS Hostname             Zimbra Hostname
---------------------    ---------------------
zimbra-sn-u14-02.example.com    zimbra-sn-u14-02.example.com
zimbra-sn-u14-01.example.com    zimbra-sn-u14-01.example.com
zimbra-sn-u14-01    zimbra-sn-u14-02.example.com
zimbra-sn-u14-02    zimbra-sn-u14-02.example.com

Remove all the references to the old hostname:

zmloggerhostmap -d zimbra-sn-u14-01.example.com    zimbra-sn-u14-01.example.com
zmloggerhostmap -d zimbra-sn-u14-01    zimbra-sn-u14-02.example.com

You will see the next output per each delete:

Deleted mapping for zimbra-sn-u14-01 to zimbra-sn-u14-02.example.com

Stop the Zimbra services:

zmcontrol stop

Reboot and test the new hostname in the Admin Console

Do the final reboot and login in the Admin Console and navigate under Home > Monitor > Server Status

Zimbra-renameserver-001.png

Note: If you have a multi-server setup, be sure to change any corresponding references to the old hostname & restart services on all hosts.

Check the configuration using zmlocalconfig

Use zmlocalconfig and zmprov to manually double-check the global config, server configs, user settings, etc.

zmprov gacf | grep oldhostname
zmprov gs `zmhostname` | grep oldhostname
zmlocalconfig | grep oldhostname

Errors are usually certificates. If you are experiencing errors, you will probably need to obtain new certs to match the new hostname. For more information on working with certificates, see Administration Console and CLI Certificate Tools. For more information on troubleshooting certificate issues, see Category:Troubleshooting Certificates.

Additional Content

This article will not be certified at the current time, please file bugs for any errors your encounter to help improve this command.

  • Bug 10696
  • Bug 23404
  • Bug 26411 - auto re-creation of self-signed certs
  • Bug 34026


Verified Against: Zimbra Collaboration 8.6, 8.5, 8.0 Date Created: 08/17/2007
Article ID: https://wiki.zimbra.com/index.php?title=ZmSetServerName Date Modified: 2015-09-05



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »


Wiki/KB reviewed by Jorge SME2 Copyeditor Last edit by Jorge de la Cruz
Jump to: navigation, search