Migrate the SugarCRM to AWS(Amazon Web Service) server (Part II)

Migrate the SugarCRM to AWS(Amazon Web Service) server (Part II)

In Part I of Migrate the SugarCRM to AWS server, we have seen how to create an instance of the production server

and a database server instance. Continuing the process, now we will see Apache configuration and migrate the

SugarCRM database from the old database server to the new database server, which we have created in Part I.

So let’s continue the process.

Logging Into AWS EC2 instance using WinSCP/Putty

We have to gain access to files and folders on the server. So here we are using WinSCP and Putty editor.

Generating .ppk file

1. Install WinSCP

2. Install Putty

3. Run WinSCP and Click on New Session.

4. Run WinSCP->Tools->PuttyGen

puttyKeyGen

5. Load .pem file created in Part I.

Note: We had created a .pem file in Part I at the end of launching the production server instance.
The same file we are using and converting .pem to .ppk file.

loadpem

6. Set Key Passphrase

7. Confirm Key Passphrase

8. Save private key as .ppk file

Logging in Using .ppk file

Run WinSCP and select New Session.

Select New Site

newsite

Note: The hostname is the IP address of production server instance, which we created in Part I. 

Enter Hostname(host IP) and Username (Ubuntu or see AWS AMI documentation)

Click Advanced->Authentication and select private key (.ppk file generated in above steps.)

authentication

OK->Login

Basic setup using Putty

Start Putty from WinSCP. Press Ctrl+p to start Putty.

Enter key phrase.

Fire the following commands on Putty.

sudo apt-get update //to update ubuntu to latest

sudo apt-get upgrade //to upgrade ubuntu to latest

sudo apt-get install tasksel

sudo tasksel //install LAMP

sudo apt-get install php5.6-curl

Upgrade to PHP 5.6

Fire the following commands as per the sequence. When we installed LAMP it provides PHP 5 but if anyone wants to use the latest version of PHP, say PHP5.6, so we add PHP 5.6.

sudo apt-get install python-software-properties

sudo add-apt-repository ppa:ondrej/php

sudo apt-get update

sudo apt-get install -y php5.6 // Install PHP 5.6

php -v

sudo a2dismod php5 //Disable PHP 5

sudo a2enmod php5.6 //Enable PHP 5.6

sudo apt-get install php5.6-mbstring php5.6-mysql

sudo service apache2 restart

Copying files from Old Server To AWS

We have to compress project folder on the old server using zip command.

Go to the old server console and enter the root path of the project (eg. /var/www/html/blogs/techaroha_wordpress/project) and execute the following command.

cd /var/www/html/blogs/techaroha_wordpress/project                    //root directory

sudo zip -r project.zip project              //make zip file of project folder

Now go to the putty console of the new server instance.

Here go to the root directory, execute the following commands.

cd /var/www/html               //root directory

sudo wget http://old_server_ip_address/project.zip         //to download the project.zip from the old server

sudo apt install zip               //install zip software on ubuntu

sudo unzip project.zip          //unzip project.zip folder

Copying Database from Old MySQL server to new MySQL server

Dumping Mysql DB on the old server:

sudo mysqldump -h MY_SQLHOST_IP -u root -p DBNAME>DBNAME.sql

Restoring Mysql DB on the new server:

mysql -h MYSQL_HOST -u root -p      //login to MySQL

CREATE DATABASE DBNAME;          //create database

sudo mysql -h MYSQL_HOST_IP -u root -p DBNAME<DBNAME.sql     //restoring

database

Note: MYSQL_HOST in above command is the database server instance address

which was created in Part I.

Configuring Apache

Use the following command to create a file.

vim /etc/apache2/sites-available/project.conf

Add the following configuration in the above file.

<VirtualHost *:80>
ServerAdmin webmaster@crm.techaroha.com //email id of the admin of respective SugarCRM
ServerName crm.techaroha.com //crm web address
ServerAlias crm.techaroha.com //crm web address
DocumentRoot &nbsp;/var/www/html/blogs/techaroha_wordpress/techaroha/Application/crm //path to crm project folder
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Restart the Apache server

Sudo service apache2 restart

Server set up is done with above steps.

The last thing to do is domain pointing.

Check the IP address of AWS server instance, which was created in Part I of this process.

Enter that IP address in domain pointing IP address.

If you need more help contact us here.

Facebook Comments
Author:
PHP and SugarCRM Developer @ Techaroha Solutions Private Limited, always ready to learn and explore new possibilities in technology.
Comments

Leave a Reply

Show Buttons
Hide Buttons