ZmSetServerName: Difference between revisions

mNo edit summary
 
(28 intermediate revisions by 8 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.


1. Stop the flow of mail & MAKE A VERY GOOD BACKUP (your entire /opt/zimbra and any linked folders) [[Backup_and_Restore_Articles]]
==Syntax==
./zmsetservername [-h] [-d] [-f] [-s] [-o <prev servername>] [-v+] -n
<servername>


2. For good measure make sure you don't violate [[logical hostname]] principles.
===Description===
Changes the name of the local zimbra server.


3. The commands:
===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.
|}


4. In versions of ZCS before 4.5.7 (now handled automatically), some additional conf files will need to be modified manually to reflect the new hostname. You can run ''/opt/zimbra/libexec/zmmtainit'' to update these files to use the host(s) listed in the ldap_url localconfig parameter:
=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
That will still leave perdition.conf and swatchrc with the old hostname..
/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


You can fix all the files and back them up at the same time like this - carefully:
# The following lines are desirable for IPv6 capable hosts
<pre>
::1    localhost ip6-localhost ip6-loopback
for f in `grep -l OLD_HOSTNAME /opt/zimbra/conf/*`; do
ff02::1 ip6-allnodes
  echo "fixing $f";
ff02::2 ip6-allrouters
  perl -pi.bak -e 's/OLD_HOSTNAME/NEW_HOSTNAME/g' $f;
done
</pre>
</pre>
When in doubt go with manual changes.
If not you will obtain the next error:
 
Unable to contact ldap://OLDHOSTNAME.example.com:389: Invalid argument
 
Now update the ip address(es) and host name(s) for the server(s) in the following places.
 
5. Update DNS server
 
6. Edit /etc/sysconfig/network
 
7. Edit /etc/hosts file with new hostname
 
8. Reboot
 
(Those in multi-server setups: Be sure to change any corresponding references to the old hostname & restart services on all hosts)
 
9. Manual double-check of attributes:
 
Use zmlocalconfig and zmprov to check the global config, server configs, user settings, etc.
zmprov gacf | grep oldhostname
zmprov gs `zmhostname` | grep oldhostname
zmlocalconfig | grep oldhostname
 
10. Errors are usually certificates / you will probably need to obtain new certs to match the new hostname.
 
(bug 26411 might address auto re-creation of self-signed certs)


*4.- Change the hostname in '''/etc/hostname'''


4.5.x:
=Steps to change the hostname at DNS level=
You need to create or change the DNS, A and MX entry at your DNS level.  


-[[SSL_Certificate_Problems]]
==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


-[[4.x_Commercial_Certificates_Guide]]
Restart the dnsmasq service:
service dnsmasq restart


5.0.x:
==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


- [Administration Console and CLI Certificate Tools]
=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.


-New admin console gui.
*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.


-[[How_to_manually_install_your_commercial_certificate_in_5.x]]
'''''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>


Notes in http://bugzilla.zimbra.com/show_bug.cgi?id=23294#c9
*3.- Run the following commands:
 
11. zmprov gacf | grep SpamAccount
 
(as often it's account@server.domain.com depending on your original domain during setup)
 
As needed:
 
zmprov -l mcf zimbraSpamIsSpamAccount spam.#@newserver.domain.com
 
zmprov -l mcf zimbraSpamIsNotSpamAccount ham.#@newserver.domain.com
 
 
------
==If errors - additional things to check==
 
If getting errors/funny quirks afterwards double check a few of the below comments & suggestions:
 
Notes on what people had to change manually after zmsetservername:
 
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:
Files in which I found the old host name after making all the above changes - edited them as root:
 
Under /opt/zimbra/conf:
amavisd.conf
perdition.conf
swatchrc
Entry in /opt/zimbra/postfix/conf/main.cf (myhostname)
 
------
 
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 can confirm the previous note.  The following are files that I had to change:
 
on 4.5.7 under Linux, I also had to manually change
<pre>
postfix/conf/main.cf
conf/amavisd.cf
cyrus-sasl.../etc/saslauthd.conf
ssl/ssl/zmssl.cnf
</pre>
 
Note: I didn't run zmmtainit, which may have fixed those.  Also the ssl file is probably mentioned in [[SSL_Certificate_Problems|regenerate self-signed certificates]]
 
-----
===Notes in need of cleanup/validity check===
 
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:
You will obtain the next output retrieving all the data of the ldap with the old hostname:
1. the old ones with the old servername
<pre>Getting local config zimbra_server_hostname=zimbra-sn-u14-01.example.com
2. a new - empty - set with the new servername.
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>


at this point dnsdomainname still gave me the old domain !
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>


I changed the content of the filename /etc/hostname (containing the old hostname ) and did a reboot.
*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


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.
=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''':
<pre>zmloggerhostmap
Zimbra Logger Service Hostname Map


Beware:
---------------------    ---------------------
Before going the way described above, I had tried to solve the logging problem with:
DNS Hostname            Zimbra Hostname
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.
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>


------
Remove all the references to the old hostname:
===Pre-zmsetservername methods===
zmloggerhostmap -d zimbra-sn-u14-01.example.com    zimbra-sn-u14-01.example.com
(ie: If you're still running an old server)
zmloggerhostmap -d zimbra-sn-u14-01    zimbra-sn-u14-02.example.com


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):
You will see the next output per each delete:
Deleted mapping for zimbra-sn-u14-01 to zimbra-sn-u14-02.example.com


Change your hostname using hostname. Change your hosts file and your /etc/sysconfig/network
Stop the Zimbra services:
zmcontrol stop


use zmprov to change the following fields to your new hostname
=Reboot and test the new hostname in the Admin Console=
zimbraLmtpAdvertisedName
Do the final reboot and login in the Admin Console and navigate under '''Home > Monitor > Server Status'''
zimbraServiceHostname
zimbraSmtpHostname


for example:
[[File:Zimbra-renameserver-001.png|800px]]


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


Then, for every single user in your sytem (that's right), you have to do this:
=Check the configuration using zmlocalconfig=
 
Use zmlocalconfig and zmprov to manually double-check the global config, server configs, user settings, etc.
zmprov ma user@domain.com zimbraMailHost new.domain.com
  zmprov gacf | grep oldhostname
 
  zmprov gs `zmhostname` | grep oldhostname
I suggest writing a shell script.
  zmlocalconfig | grep oldhostname
 
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/stop)
 
Start it back up (zmcontrol startup/start)
 
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:
# 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.
 
------
 
==Old Logger Data==
Issue: Server is creating new data in the graphs of the server statistics admin page, but all of the old data that was generated as the old host name is not showing.


Solution: Update all the tables manually in the zimbra_logger database to reflect the name change.
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]].


<pre>
==Additional Content==
+-------------------------+
| Tables_in_zimbra_logger |
+-------------------------+
| amavis                  |
| amavis_aggregate        |
| config                  |
| disk_aggregate          |
| disk_status            |
| mta                    |
| mta_aggregate          |
| processing_history      |
| raw_logs                |
| service_status          |
+-------------------------+
</pre>
 
You should probably do something like:
<pre>
mysql> select * from `amavis` limit 1\G
</pre>
To find out what the old hostname is set to so that you set the new hostname similarly.  Likely the hostname will be just the name, without the domain, of your system. So if your system is mail.domain.com the host field will have mail.
 
 
So you'll need to do something like:
<pre>
zimbra@mail:~> logmysql zimbra_logger
mysql> update `amavis` set host='newhostname' where host='oldhostname';
</pre>
for each of the tables. 
 
==Bugs being tracked==
This article will not be certified at the current time, please file bugs for any errors your encounter to help improve this command.
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


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


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