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
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 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 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.