Sugar Crm from Linux to Windows
Porting Sugar CRM from LAMP
(Linux, Apache, MySQL, php) to WIMP (Windows, IIS, MySQL, php)
Technical Level: Beginner to Medium
- Warm up
- Begin Backup of Sugar CRM on Linux
- Setup the Windows Server
- Setup the IIS site
- Setup the ftp sever
- ftp site
- adding windows ftp user
- Configuring IIS patches. Few important patches
- installing php and mysql
- ini file editing
- Transfer Data from Linux to Windows
- Install sugar crm on windows
- Restore the database
- Copy the front end files to IIS
- Change the config.php files.
I don’t know why anyone would want to do this but I did. I had a few challenges which I have decided to document. We decided to do it for an organization that was more proficient with Windows Server administration than Linux. Windows 2008 Server does seem to be a more stable environment and we do have server been on for more than 400 days without a reboot. I consider this a big step up since the ‘Windold’ days.
Anyway, back to the subject and my white paper.
This whitepaper is specific to migrating CRM (sugar crm) application from Linux to Microsoft windows however you can use parts of it to figure out how to: backup sugarcrm ; restore sugar crm; backup MYsql and php applications ; modify config.php of sugar crm ; install sugar crm on linux and windows. We will be writing specific whitepapers on these and more subjects on sugar crm upgrading and maintenance which will be available on www.bluent.net .
The source system is:
Linux: Centos 5.6 Linux 2.6.18-164.el5 on i686
Php: PHP Version 5.2.17
Mysql: MySQL version 5.0.77
Apache: Apache version 2.2.3
Windows 2008 Sever
PHP: PHP version(5.3.5)
Mysql: mysql version(5.5.8)
IIS: IIS version 7
A Sledge hammer
A chainsaw and a screwdriver — Just kidding. Technology challenges do make some of us technocrats loose it a bit sometimes. However, still if you can manage a screwdriver before you begin I would highly recommend drinking one, just double up the vodka.
Back to tools, utilities and accesses needed:
- Root login (or SUDO access) for your centos box
- Windows 2008 administrator password
- Putty or a ssh client it can be got from
- ftp client or a way to transfer files from Linux to Windows. This is not covered in this whitepaper. (Please contact us if you need any help here)
- Remote Desktop Client (comes with Windows) to access your windows 2008 server. Or if you are sitting on it physically then you don’t need the remote client.
Warm up and begin:
I am writing most of the commands here without SUDO assuming that you have logged in with root. Although I don’t want to advocate a wrong practice and you should never login as root. The good guys always SUDO and as most Linux distributions will remind you anyways, do remember – “With great power comes great responsibility. — Your friendly Technocrat.” I just noticed that I don’t have a very good attention-focus span to stick to the topic. But you know in these bad economic days when even Obama’s “change is good” kind of campaigns are not working a little bit of humor is …. u know … like therapy. ………..…. WHATEVER ! ….
Begin: Backup Sugar CRM, Linux Centos .
Assumptions: let us assume your sugacrm is installed in the typical html directory “/var/www/html/sugarcrm”. Also let us assume the sugar crm database name is sugarcrm. If you are not sure of your database name then open the file “/var/www/html/sugarcrm/config.php” and look for the line db_name’ => ‘sugarcrm’ and see what is written there instead of sugarcrm as the database name.
Linux Centos steps:
- Login using ssh from putty or any ssh client
- Go the html directory
- Backup your sugar crm mysql database
mysqldump -h localhost -u root -pMYPASSWD sugarcrm > sugarcrm.sql
- The data base in now backed up in the file sugarcrm.sql
- Zip the sugarcrm directory
zip -r sugar.zip sugarcrm
- The file sugar.zip will be created.
- Your sugar crm is now backed up and between the two files sugarcrm.sql and sugar.zip you have all that you need.
Getting the Windows Server ready
Let’s switch over to the windows server and setup things there. We will return to the linux server to pick up these 2 files later.
IIS configuration steps: New Website
- Start IIS Manager from Start-> administrative tools -> Internet Information Services Manager
- Let us assume the new sugarcrm name on windows will be emailer.bluent.com. So, we need to create the site on IIS for emailer.bluent.com domain. We assume that emailer.bluent.com is already pointing (DNS) to the IP of the windows server that we plan to use for this site.
- Create a new folder in wwwroot as c:\inetpub\wwwroot\emailer
- Create a new website (emailer) with a new application pool (emailer)
- In IIS Manager Click on sites. Right click -> New Website
- Give a path to the new website as c:\inetpub\wwwwroot\emailer
- Give it a name as emailer (you can use your own names and folder names)
- set the ip of this website as xxx.xxx.xxx.xxx (binding) host name emailer.bluent.com (your own name) on the default port:80
IIS Configuration: New FTP site to this website
- If you have a way to transfer the files sugar.zip and sugarcrm.sql from the linux to this windows server, you may skip this step. If not, use these steps to create an FTP site and then transfer files using FTP.
- Start IIS Manager 6 from Start-> administrative tools -> Internet Information Services Manager 6. You need to use the IIS Manager 6 to setup an FTP site.
- In case you cannot find an FTP site/ server in your server, you need to install the FTP component in IIS.
- Click on FTP sites, then right click new FTP site.
- Give a description name to the site. Example, emailer. Let the port be default 21. Set the IP of the site.
- Click on the next tab. Security Accounts and uncheck anonymous connections.
- Go to the home directory tab and set c:\inetpub\wwwroot\emailer (or your directory) as the local path.
- Create a new windows user to access this website.
- Create a local user called emailer (or you can pick name of your choice) remove it from user group and rdc. Click on administrative tools and go to Computer Management.
- Go to Local Users and group -> Users -> click -> right click -> new user
- Give access to the emailer user to the ‘c:\ inetpub\wwroot\emailer’ directory.
Install other IIS components
- Install: URL Rewrite 2.0 for IIS 7 http://www.microsoft.com/web/gallery/install.aspx?appid=urlrewrite2
- This is needed for sugar crm in iis or the web.config file needs to be deleted from the sugar crm iis folder. The web.config file settings otherwise causes problems in sugar crm and you get a page not found error.
Install PHP and MySQL.
- Download the latest php version and install it.
- Download the latest mysql version msi installer and install it. Give a root password.
- (Optional)phpmyadmin installation: download phpmyadmin and unzip it in the folder inetpub/wwwroot/emailer
- C:\Program Files (x86)\PHP\php.ini changes. Make the following changes to your php.ini lines. Only the lines that need to be changed /checked and few more supporting lines of php.ini are shown below.
upload_max_filesize = 15M (this is 2M in a new installation)
post_max_size = 15M (change this from 8M. It is 8M in a new installation)
; Module Settings ;
; Defines the default timezone used by the date functions
date.timezone = “America/New_York”
Transferring data from Linux to Windows
- Let’s get back to our linux server
- And ssh using putty or a ssh client into the server
- Go the html directory
- FTP into the windows server
- Put the two files sugarcrm.sql and sugar.zip to windows.
- You are done with linux. You can logout now. Exit.
Installing Sugar CRM on windows
Restore the Mysql database:
- Go to the start run -> cmd or the command prompt
- Go to the mysql directory.
cd C:\Program Files\MySQL\MySQL Server 5.5\bin
- Enter the mysql prompt use the root password you set on windows for mysql.
mysql -u root –pPASSWORD
- You will get the mysql prompt. We are assuming the name of the new database will be emailer (change to the name of your choice)
mysql> create database emailer ;
- You will get a message 1 row affected and back to the command prompt.
- Restore the database
mysql -u root -pPASSWORD emailer < c:\inetpub\wwwroot\emailer\sugarcrm.sql
Restore the sugar crm front end
- Unzip the zip file c:\inetpub\wwwroot\emailer\sugar.zip in the emailer folder itself. Such that index.php file is in the c:\inetpub\wwwroot\emailer folder after the unzip is done. You can copy the sugar.zip file to the desktop and then extract the files and folders in the sugarcrm zipped folder into the emailer folder.
- Edit the config.php file in c:\inetpub\wwwroot\emailer\config.php
- You will need the change the following lines:
- db_name’ => ‘sugarcrm’
db_name’ => ’emailer’
- Change the password to the new mysql root password.
- Change site url from your old crm name to your new crm name. Keep the same name if you will retain the same url. The names used below are for illustrative purposes only.
site_url’ => ‘http://oldcrm.bluent.com’
site_url’ => ‘http://emailer.bluent.com’
- Change the hostname using the same logic as above.
- host_name’ => ‘oldcrm.bluent.com’
host_name’ => ’emailer.bluent.com’
- Save the changes and you should be ready to go.
All the best with the sugar crm migration. Should you face any trouble, please feel free to contact one of our crm consultants at firstname.lastname@example.org and we would be happy to help you out. To know more, visit the crm section of our website www.bluent.net.
Microsoft Windows, Windows, Centos are registered trademarks of the respective companies and have been referred to in this article.