Difference between revisions of "HowTos/ChangeFQDN"

From Scalix Wiki
Jump to: navigation, search
m (Changing the FQDN of a Scalix Server)
m (Changing the FQDN of a Scalix Server)
Line 5: Line 5:
 
For this example we will change the hostname from old.scalix.demo to new.scalix.demo.
 
For this example we will change the hostname from old.scalix.demo to new.scalix.demo.
  
1. '''Change the server's name'''
+
==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.
 
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.
Line 11: Line 11:
 
When you are done the command '''hostname --fqdn''' should output the new hostname correctly.
 
When you are done the command '''hostname --fqdn''' should output the new hostname correctly.
  
2. '''Use sxmodfqdn to correct user settings'''
+
==Use sxmodfqdn to correct user settings==
  
 
Output of '''sxmodfqdn'''
 
Output of '''sxmodfqdn'''
Line 22: Line 22:
 
This command will rewrite the relevant parts of the user configuration to tell Scalix where to look for existing users' directory entries.
 
This command will rewrite the relevant parts of the user configuration to tell Scalix where to look for existing users' directory entries.
  
3. '''Change the configuration in /opt/scalix/'''
+
==Change the configuration in /opt/scalix/==
  
 
The file /opt/scalix/global/config contains the lines:
 
The file /opt/scalix/global/config contains the lines:
Line 34: Line 34:
 
OMHOSTNAME=new.scalix.demo</pre>
 
OMHOSTNAME=new.scalix.demo</pre>
  
4. '''Change the configuration in /etc/opt/scalix'''
+
==Change the configuration in /etc/opt/scalix==
  
 
There are several files to be changed in /etc/opt/scalix.
 
There are several files to be changed in /etc/opt/scalix.
Line 57: Line 57:
 
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. The reset on the end is necessary, as your terminal will more than likely be fubared after vi is done.
 
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. The reset on the end is necessary, as your terminal will more than likely be fubared after vi is done.
  
5. '''Reboot and enjoy your server'''
+
==Reboot and enjoy your server==
  
 
After you have finished this procedure please reboot. Everything should be working just like before.
 
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.
 
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.

Revision as of 14:51, 17 October 2006

Changing the FQDN of a Scalix Server

If for some reason you absolutely need to change the fully qualified domain 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 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 domain name changed. You can either do this by hand, or, if you're lazy like me, with a vi macro.

Use the following command:

grep -iRl old.scalix.demo /etc/opt/scalix | while read line; do vim $line -c ':% s/old.scalix.demo/new.scalix.demo/g' -c ':wq'; done; reset

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. The reset on the end is necessary, as your terminal will more than likely be fubared after vi is done.

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.