Results 1 to 3 of 3

Thread: Changing Your Hostname

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Posts
    42
    Rep Power
    9

    Default Changing Your Hostname

    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:

    # 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!

  2. #2
    Join Date
    Dec 2007
    Posts
    6
    Rep Power
    7

    Default

    To make things a little easier (but maybe more risky), you only need the following:

    1. zmcontrol shutdown
    2. cd /opt/zimbra/conf; grep -il hostname *
    3. Modify files from above step.
    4. cd /opt/zimbra
    4. sudo openldap/sbin/slapcat -f conf/slapd.conf > ~/tmp.ldif
    5. mv openldap-data old-data
    6. mkdir openldap-data
    7. chown zimbra:zimbra openldap-data
    8. cp old-data/DB_CONFIG openldap-data
    9. do a global search-and-replace on ~/tmp.ldif replacing the old hostname with the new one. Maybe something like sed -i 's,oldhostname,newhostname,g' ~/tmp.ldif
    10. sudo -u zimbra openldap/sbin/slapadd -f conf/slapd.conf -l ~/tmp.ldif
    11. fix up your ssl cert
    12. bin/zmcontrol startup

    If something goes wrong, you still have your old data that you can use to restore with.

  3. #3
    Join Date
    May 2006
    Location
    USA
    Posts
    6,242
    Rep Power
    21

    Default

    Welcome to the forums,
    This is kinda an older thread from 2005, now there's also ZmSetServerName - Zimbra :: Wiki

Similar Threads

  1. Server Statistics dont work after changing hostname
    By rnuno in forum Administrators
    Replies: 1
    Last Post: 06-08-2007, 07:54 PM
  2. Logger problems after changing hostname
    By Eric in forum Administrators
    Replies: 5
    Last Post: 06-04-2007, 04:41 AM
  3. Installation Cancelled - Zimbra-spell !
    By Ledg in forum Installation
    Replies: 4
    Last Post: 10-19-2006, 02:54 AM
  4. Error in admin interface after changing hostname
    By McPringle in forum Installation
    Replies: 6
    Last Post: 05-02-2006, 08:18 AM
  5. MTA is Dying after yum update
    By tonyawbrey in forum Administrators
    Replies: 27
    Last Post: 04-02-2006, 06:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •