<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/platform.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d11356004\x26blogName\x3dxception\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttps://openrent.blogspot.com/search\x26blogLocale\x3den_US\x26v\x3d2\x26homepageUrl\x3dhttp://openrent.blogspot.com/\x26vt\x3d-4655156434419967503', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe", messageHandlersFilter: gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER, messageHandlers: { 'blogger-ping': function() {} } }); } }); </script>

SugarCRM from scratch

This will build a Sugar CRM server with both the necessary database and web server components. It assumes the reader is fluent with installing software from scratch and from source. It also assumes that a remote MySQL server is already built on another physical box, and is usable.

1) Install a CentOS 4.2 Server using the minimal package set.
Note that "minimal" is a choice during installation. Perform a "yum update" after installation to update all packages.

2) Download needed software in RPM format to the CentOS server.

Download the latest SugarSuite 4.0.1 (http://www.sugarcrm.com/crm/download/sugar-suite.html)
Download the latest MySQL 5.0 headers and libraries, server, and client. (http://dev.mysql.com/downloads/mysql/5.0.html)
Download the latest PHP 5.1.2 (http://www.php.net/downloads.php)
Download the latest Apache (http://httpd.apache.org/download.cgi)

3) Install the following dependencies.
"yum install libxml2-devel flex curl curl-devel libidn gcc openssl-devel perl-DBI"

4) Install Apache with support for PHP and the minimal amount of other modules.
./configure --prefix=/d01/httpd --enable-ssl --enable-cache --enable-deflate --enable-alias --enable-disk-cache --enable-mime --enable-dir --enable-auth --enable-access --enable-autoindex --enable-env --enable-status --disable-asis --disable-imap --disable-actions --disable-cgi --enable-userdir --enable-negotiation --disable-include --enable-so --disable-proxy-ftp --enable-headers --disable-proxy-ajp

make
make install

Note: This install Apache to the /d01 directory.

5) Add a user for apache
# groupadd www
# useradd www -g www

6) Edit the /d01/httpd/conf/httpd.conf file to reflect the www username.
user www

7) Unzip the SugarCRM file.
# unzip SugarSuite-4.0.1a.zip

8) Move the unzipped file to /d01/httpd/htdocs/sugarcrm
mv SugarSuite-Full-4.0.1a/ /d01/httpd/htdocs/sugarcrm

9) Chown the entire sugar tree by the Apache owner.
chown -R www:www /d01/httpd/htdocs/sugarcrm

10) Test your installation. Browse to your Apache server's IP address.

11) Setup Apache's httpd.conf file to access sugarcrm in the htdos directory.

Alias /sugarcrm "/d01/httpd/htdocs/sugarcrm"

Options Indexes
AllowOverride None
Order allow,deny
Allow from all


12) Install MySQL headers and libraries
# rpm -ivh MySQL-devel-standard-5.0.18-0.rhel4.i386.rpm

13) Install MySQL 5.0 server:
# rpm -ivh MySQL-server-standard-5.0.18-0.rhel4.i386.rpm

14) Build and install PHP.
# bzip2 -d php-5.1.2.tar.bz2
# tar xvf php-5.1.2.tar
# cd php-5.1.2
# ./configure --prefix=/usr/local/php5 --with-apxs2=/d01/httpd/bin/apxs --with-curl=/usr/ --with-mysql=/usr/
# make

Ensure these entries are in the /d01/httpd/conf/httpd.conf file:
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php

# make install

# cp /root/php-5.1.2/php.ini-dist /usr/local/php5/lib/php.ini
# vi /usr/local/php5/lib/php.ini

Uncomment this line:
; Log errors to syslog (Event Log on NT, not valid in Windows 95).
error_log = syslog

Set memory_limit = 20M

# /root/php-5.1.2/libtool --finish /root/php-5.1.2/libs/

15) Restart Apache.

16) Test the PHP installation.
Create a file called test.php and place it into the Apache htdocs folder. The content should be:

# vi /d01/httpd/htdocs/test.php
phpinfo();
?>

Save the file and then point your browser to http://localhost/test.php.


17) Login to the remote MySQL server, and create the sugarcrm user:

mysql> GRANT ALL PRIVILEGES ON *.* to 'sugarcrm'@'%' IDENTIFIED BY 'sugarcrm' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec)

18) Begin the SugarCRM installation process.

19) Post-install cleanup.

Remove the MySQL server from the Apache server.
Drop privledges for the sugarcrm user.

20) User SugarCRM
Login with admin/sugarcrm at http://localhost/sugarcrm

Using a remote MySQL database with SugarCRM

The Sugar installer must be "tricked" in certain ways, but it works. This setup assumes you have two separate, physical servers:

1) Web: A working Apache version 2.x server with a functional MySQL-enabled PHP library.
2) Database: A working MySQL server

This is the usual setup for n-tier architectures. It is unusual to have both a web server and database reside on the same physical server, which is what the SugarCRM installer presupposes.

The workaround:

1) Temporarily install the MySQL server RPM on the Apache server:
rpm -ivh MySQL-server-standard-5.0.18-0.rhel4.i386.rpm

The database server should install and start automatically.

2) Login to the remote MySQL server, and add a user named "sugarcrm" and grant it full privileges.

mysql> GRANT ALL PRIVILEGES ON *.* to 'sugarcrm'@'%' IDENTIFIED BY 'sugarcrm' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec)

3) Start the SugarCRM installer.

4) At Step 3: Database Configuration, enter the following information:

Host Name: The FQDN of the remote MySQL server.
Database Name: sugarcrm
Create database: CHECKED
User Name for SugarCRM: sugarcrm
Create user: UNCHECKED
Password for SugarCRM: sugarcrm
Database account above is a privleged user? CHECKED

5) Continue through the rest of the SugarCRM installation.

6) After the installation succeeds, some cleanup is necessary.

a) MySQL priviledge reduction.
Login to the remote MySQL server and drop the privileges of the sugarcrm account. You will likely want to restrict it to the sugarcrm database, and only allow logins from the Apache server IP address.

mysql> GRANT ALL PRIVILEGES ON sugarcrm to 'sugarcrm'@'192.168.1.100' IDENTIFIED BY 'sugarcrm' WITH GRANT OPTION;

b) Remove the temporary installation of MySQL on the Apache server.
# rpm -e mysql-server