HowTos/ChangeFQDN

From Scalix Wiki
Revision as of 04:01, 18 January 2007 by Trevor benson (Talk | contribs)

Jump to: navigation, search

Scalix Wiki -> How-Tos -> Change FQDN/Hostname

Changing the Hostname of a Scalix Server

Don't change the hostname of your server. Changing a server's hostname is a bad idea. If it's a Scalix Server, then it's a really bad idea.

If for some reason you absolutely need to change the name of a Scalix server please follow these steps.

For this example we will change the hostname from old.scalix.demo to new.scalix.demo.

Change the server's name

The procedure for doing this will vary based on your linux distribution, the basic idea is to change /etc/hosts so that your server can resolve its own IP, as well as changing whichever file your distribution uses to store the hostname, such as /etc/default/hostname, /etc/sysconfig/network or similar.

When you are done the command hostname --fqdn should output the new hostname correctly.

Use sxmodfqdn to correct user settings

Output of sxmodfqdn

[root@new ~]# sxmodfqdn 
usage:/opt/scalix/bin/sxmodfqdn -o oldfqdn -n newfqdn

The syntax in our example would then be sxmodfqdn -o old.scalix.demo -n new.scalix.demo

This command will rewrite the relevant parts of the user configuration to tell Scalix where to look for existing users' directory entries.

Change the configuration in /opt/scalix/

The file /opt/scalix/global/config contains the lines:

OMNAME=old
OMHOSTNAME=old.scalix.demo

These can be changed by hand to read:

OMNAME=new
OMHOSTNAME=new.scalix.demo

Change the configuration in /etc/opt/scalix

There are several files to be changed in /etc/opt/scalix.

Grepping over the directory reveals that the following files currently contain the old fully qualified hostname:

[root@new ~]# grep -iRl old.scalix.demo /etc/opt/scalix
/etc/opt/scalix/caa/scalix.res/config/ubermanager.properties
/etc/opt/scalix/platform/platform.properties
/etc/opt/scalix/webmail/swa.properties
/etc/opt/scalix/webmail/swa.properties.bak
/etc/opt/scalix/res/config/res.properties

Each of these files needs to have the fully qualified hostname changed in one or more places. You can either do this by hand, or, if you're lazy like me, with a quick macro.

Use the following command:

grep -iRl old.scalix.demo /etc/opt/scalix | while read line; do sed -i -e 's/old.scalix.demo/new.scalix.demo/g'; done

Replace both instances of old.scalix.demo with your old FQDN and the single instance of new.scalix.demo with your new FQDN.

What this does, is find each file with the old FQDN, globally replace each instance of the old FQDN with the new FQDN and save the file.

Reboot and enjoy your server

After you have finished this procedure please reboot. Everything should be working just like before.

Do remember, however, that this discussion only covered Scalix. Things like apache VirtualHost declarations or other parts of the server which depend on the hostname will still need to be changed. And remember, what you just did was a bad idea.