SuiteCRM Server Migration "How To"

So I was setting up a migration of the CRM to a new server. I had done this a few times and I wanted to post a sort of “How To” more like what to look out for thread.

I am mainly writing this because I was stuck for 4 hours wondering what was wrong with my permissions issue on a fresh centos 7 stack….so Why not help others pulling their hairs out wondering the same thing….

First off Install Centos 7----Check
Install LAMP STACK
Refer to
https://www.howtoforge.com/apache_php_mysql_on_centos_7_lamp

For a GREAT tutorial on this if needed.

Install additional php modules
yum install php-mbstring php-mysql php-gd gd php-imap php-ldap

Update the following in /etc/php.ini

memory_limit = 512M
max_execution_time = 300
error_reporting = E_ALL & ~E_NOTICE
post_max_size = 64M
upload_max_filesize = 64M

Restart the apache server

systemctl restart httpd.service

OK this is VERY important, as I spent hours trying to fix permissions issues that would have all been avoided had I disabled SELINUX

/etc/sysconfig/selinux

Change
SELINUX=enforcing

to
SELINUX=disabled

A system reboot is needed to complete this step

# shutdown –r now

Nothing wrong with using SELINUX but it requires a whole level of security I don’t need for MY personal use. Although I wish here was a guide out there to help use the proper setting for SELINUX so the installation could be that much more secure.
ALSO I like to lock down my server by preventing direct root login through ssh

Create a user

useradd <username>

set password

passwd <username>

test you can ssh into server with those credentials
and test you can elevate priviledges with su
then alter ssh conf files to disallow root login and set any other security settings

vi  /etc/ssh/sshd_config
# Prevent root logins:
PermitRootLogin no

Restart sshd

Systemctl restart sshd.service

Test ssh login with above created user again before closing session, incase we did something wron and then we lock ourselves out of the server
All done, its always good to do this to prevent script attacks, theywill always try root, and then they have to simply guess the password. Now they have to know both a random username and password, and then have to know the root password to do ay damage, its like having 3 passwords!
They would have to guess somerandom username and then somerandom pass and then somerandom pass again for su. Pretty neat :slight_smile:

PREPARING DB MIGRATION

Now dump your DB into a file
Forget using phpmyadmin as your DB is probably too large to post

The best quickest and most effective way is to use the cli for it.

mysqldump –u dbuser -p databasename > mydatabase.sql

On the new machine simply upload to server and do

mysql –u dbuser -p databasename < mydatabase.sql

Simple :slight_smile: it will take less time and you won’t run into syntax errors.

MIGRATE SUGARCRM INSTALL ROOT DIRECTORY

Package your entire apache root directory
In my case this would be

# tar –zcf crm.tar.gz /var/www/html

Also in the /var/www directory there will be the suitecrm and suitecrmlog folders.
I don’t care about my logs so I will recreate those directories later… with the proper permissions.

The suitecrm directory stores the user sessions.
Ok now that we have that all packaged out.

Move it to new server and extract into your apache root directory in my case again it is /var/www/html

# tar –zxvf crm.tar.gz --strip=1

The strip ==1 drops that top folder and extracts all the contents into my apache root as I want
In /var/www create the needed sessions and log directories.

# mkdir suitecrm suitecrmlog

Now fix permissions

#chown –R apache:apache html suitecrm suitecrmlog

And

#chmod –R 755 html suitecrm suitecrmlog

You can adjust permissions more strict if you like but this server I have is solely dedicated to suitecrm :slight_smile: so I don’t care
Now we need to edit our config.php to accept new DB settings on new server, I’m assuming you have already set up the DB and DBUSER

# vi /var/www/html/config.php

Change

array (
    'db_host_name' => 'localhost',
    'db_host_instance' => 'SQLEXPRESS',
    'db_user_name' => 'DBUSER',
    'db_password' => 'DBPASS',
    'db_name' => 'DBNAME',
    'db_type' => 'mysql',
    'db_port' => '',
    'db_manager' => 'MysqliManager',
  ),

Also ensure

'log_dir' => '../suitecrmlog',
'session_dir' => '../suitecrm',

Are set to the proper directories and

'site_url' => 'http://mydomain.tld',

Matches your new server address
Ummm crank up and see if it loads.

If you notice an issue turn on php error reporting and see where it breaks.
Do a quick repair and rebuild and rebuild .htaccess for the crm
This should do it.
My problem was I forgot to disable selinus……but I hope this helps others out there.

Thanks!
I did this in haste as I’m stupid busy right now. I just hope it helps someone as all the docs out there I feel are slowly disapearing for the old sugarcrm stuff and I would like this new home for for such an amazing open source tool stays open.

I cant stress enough how awesome open source is. I find myself offering more and more powerful tools to people.

Who knew setting up fedora servers when i was 17 would be so beneficial 10 years later.

3 Likes

Hi Angrymob,

This is fantastic. Thank you so much for your contribution on this.

The documentation is not something we have had time to fully dedicate to, but it is clear that we need to spend time working on a collaborative wiki where the community can add and share their guides and documentation.

Thanks,

Will.

I’ll try to post more when I get the chance. Maybe I can put together a “how to” on an installation. Including OS and all. Then the community could input corrections and suggestions and we could have a nice starting point for the new user out there. I just realize the value more and more of a manage everything suite really.

Thanks.

I was following my own tutorial and noticed, with the new centos 7.1, if you follow the link to https://www.howtoforge.com/apache_php_mysql_on_centos_7_lamp
for installing lamp stack the section for phpMyAdmin will not work because the isntructions to install EPEL are now outdated.

to install epel do the following

First we import the GPG keys for software packages:

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*

Then we enable the EPEL repository on our CentOS system as lots of the packages that we are going to install in the course of this tutorial are not available in the official CentOS 7 repository:

yum -y install epel-release
yum -y install yum-priorities

Edit /etc/yum.repos.d/epel.repo…

nano /etc/yum.repos.d/epel.repo

… and add the line priority=10 to the [epel] section:

[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
priority=10
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
[...]

angrymob,
Thanks for the write-up. I did find the SELinux issue myself, but also found a few notes in your write-up helpful.
How can I get in touch with you outside of this forum?
Do you have a facebook/email/phone number I could reach you at?

I’m out in California, would like to discuss some future projects with you.

1 Like

john at fortalabs dot com

I made a export from phpmyadmin and copy www folder to another server.

But my custom fields aren’t showing :frowning:

Why?