Let the platform do the work

Moving Sugar to Another Server

Overview

You may, on occasion, need to move your sugar instance from one server to another. This can be done in just a few simple steps, but before starting any data migration project you should first make sure no one is in the system, perform a backup, and verify functionality on the new server before retiring the old system. System administrators for On-Site instances are responsible for setting up the stack and taking/restoring backups as it is not supported by SugarCRM.

Steps to Complete

1. Set up Stack on New Server

The administrator should set up the stack components (PHP, Webserver, and Database) on the new server first. The stack components must be supported and the stack must be configured to serve PHP pages correctly.

2. Extract the Database

We will outline the basic steps for taking backups of various databases. Please note that SugarCRM does not provide support for performing On-Site backups, so please consult your database documentation for more information or advanced configurations.

MySQL

Perform a sqldump of the SugarCRM SQL database or export the database from phpmyadmin.

  • If the MySQL user has a password (assuming the 'mysqldump' executable is in your path or you are running the command from the directory containing the 'mysqldump' executable):
    mysqldump -h localhost -u {MySQL User, e.g. Root} -p{Database Password} -c --add-drop-table --add-locks --all --quick --lock-tables {Name of Database} > sqldump.sql
    Please note that there is no space between -p and the password.
  • If the MySQL user has no password:
    mysqldump -h localhost -u [MySQL user, e.g. root] -c --add-drop-table --add-locks --all --quick --lock-tables [name of the database] > sqldump.sql

For more information on mysqldump, please refer to the MySQL manual on Database Backup Program.

MSSQL

To run a backup from Management Studio, please follow the steps below:

  1. Connect to the appropriate instance of the Microsoft SQL Server Database Engine.
  2. In Object Explorer, click the server name to expand the server tree.
  3. Expand "Databases" and select either a user database or expand "System Databases" to select a system database.

  4. Right-click the database, select "Tasks", then "Back Up". The Back Up Database dialog box will appear.

  5. In the Database list box, verify the database name. You can optionally select a different database from the list.

  6. You can perform a database backup for any recovery model (FULL, BULK_LOGGED, or SIMPLE).

  7. Select "Full" in the Backup type list box.

  8. Specify the destination file and click "OK".

For more information on running backups using Management Studio, please refer to the MSDN article on Creating a Full Database Backup.

Oracle

To run a backup in Oracle, the recommended solution is to use the Oracle Recovery Manager (RMAN) tool.

If you are not using the recommended RMAN tool, a simple way to backup your database in Oracle is to stop the database, then copy all the files in '\oradata\database\*.*' to another location.

DB2

To run a backup in DB2, use the BACKUP DATABASE command.

For example:

DB2 BACKUP DATABASE db_name TO device_or_directory

3. Import SugarCRM Database to New Server

After performing the database backup, you will be able to import the SugarCRM database into the new server.

MySQL

We will go over how to import the mysql database into the new server. For example, to restore a mysqldump backup file named sqldump.sql file to the new database named "SUGARCRM", you would do the following:

mysql -u sadmin -p pass21 SUGARCRM

The general format is as follows:

mysql -u {Username} -p {Password} {Database_To_Restore}

Please note that depending on the options used to create the mysqldump file, you may first need to create the target database using the "CREATE DATABASE" command from the MySQL command line.

MSSQL

To import the database from Management Studio, please follow the steps below:

  1. Connect to the appropriate instance of the Microsoft SQL Server Database Engine.
  2. In Object Explorer, click the server name to expand the server tree.
  3. Expand "Databases" and select either a user database or expand "System Databases" to select a system database.
  4. Right-click the database, select "Tasks", then "Restore", and click "Database". This will open the Restore Database dialog box.
  5. On the General page, use the Source section to specify the backup of your SugarCRM database.
  6. Complete the rest of the options in the dialog box and click "OK" to restore.

For more information, please refer to the MSDN article on Restoring a Database Backup from Management Studio.

Oracle

To import the database from Oracle, the recommended solution is to use the Oracle Recovery Manager (RMAN) tool.

If you are not using RMAN and you used the simple method to backup your database in Oracle (described under "Extract the Database"), then copy the backed up files to the new database install:

'\oradata\database\'.

DB2

To import the database from DB2, use the RESTORE DATABASE command.

For example:

RESTORE DATABASE db_name FROM backup_file INTO target_db

4. Copy Filesystem

Copy all your files to the new server by locating the Sugar application root directory on your old server and copying it to the webroot directory on the new server.

5. Check Files and Permissions

Check Config.php

Open and make sure that all settings still apply to the new server, such as:

array ( 'db_host_name' => 'localhost', 'db_user_name' => 'root', 'db_password' => 'PASSWORD', 'db_name' => 'DATABASE_NAME', 'db_type' => 'mysql', ), 'site_url' =>, etc.

Check .htaccess file

Open and ensure that the new server URLs are used correctly.

Check Permissions

Check that the permissions are correct on the new server.
The following directories, all subdirectories, and files must be writable by your web server user:

  • cache
  • custom
  • modules
  • config.php
  • config_override.php

  • sugarcrm.log

Please note that typically, there are multiple versions of the log file, such as sugarcrm.log, sugarcrm.log.1, sugarcrm.log.2, etc. The naming convention of the log files will be based on the settings in the application under Admin > System Settings.

The system user that your web server uses to access files in your webroot varies depending on your operating system configuration. Common web server users include:

  • apache (Linux/Apache)
  • nobody (Linux/Apache)

  • IUSR_computerName (Windows/IIS)

Please consult your system administrator if you are unsure of your web server user.

Linux Based Systems

For more information on Linux Based Systems, please refer to the article Required File System Permissions on Linux.

Example permission configuration:
chgrp ApacheUser.ApacheGroup -R //recursively sets ownership for root directory to Apache user and group.
chmod 755 -R //recursively sets permissions to Read/Write, Execute for the owner, and Read/Execute for everyone else.

Windows Based Systems (with IIS as Webserver)

For more information on Windows-Based Systems, please refer to the article Required File System Permissions on Windows With IIS.