First of all Thanks to bobby. His instructions were very helpful.
Here is what I did step-by-step to successfully change the Hostname.
(I do not guarantee the process and did not repeat it since once I finally got it I did not want to touch it anymore...)
1. su - zimbra
2. I ran the following commands:
zmprov mcf zimbraLogHostname my-host.my-company.com
zmlocalconfig -e zimbra_server_hostname=my-host.my-company.com
zmlocalconfig -e ldap_master_url=ldap://my-host.my-company.com:389
zmlocalconfig -e ldap_url=ldap://my-host.my-company.com
zmlocalconfig -e snmp_trap_host=my-host.my-company.com
zmlocalconfig -e av_notify_user=admin@my-company.com
zmlocalconfig -e smtp_destination=admin@my-company.com
zmlocalconfig -e smtp_source=admin@my-company.com
zmlocalconfig -e ldap_host=my-host.my-company.com
3. I edited /etc/hosts file and change the old host with my-host.my-company.com. Without this LDAP will not start!
4. Added my host to a DNS server that my zimbra server can read. tested with
nslookup my-host.my-company.com.
If you do not get your server's IP then change DNS settings so you do.
5. Next I carfully followed instructions for
regenerating the certs.
Note that "keytool" is located under: zimbra/java/jre/bin. I had to specify the full path or cd there to run the command.
6. 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)
7. I now stopped Zimbra and started only ldap with the following command:
sh -x bin/ldap start (zimbra user)
8. Now I ran
zmsetservername my-host.my-company.com. You should see a long output of entries being updated that look like the following:
replace zimbraMailHost:
mail.my-company.com
replace zimbraMailTransport:
lmtp:mail.my-company.com:7025
modifying entry "uid=
a_user,ou=people,dc=
a domain,dc=com"
modify complete
9. Now restart Zimbra. Everything should work as before only with the Hostname you really want.
It would be nice to have one short command to do it all...
Good luck!