Creating an AWS EC2 server for a SugarCRM professional installation

This can be used for any Linux server, but I am running this up in AWS.

Setup the environment with Apache and php and some prerequisites for APC etc…

Note that this install does not include the MySQL element as I am using AWS RDS backend

These are very important or the installation will fail

yum -y install httpd php php-mysql php-mbstring php-devel gcc  pcre-devel
mkdir -p /opt/software/apc
cd /opt/software/apc

We need to install a cache engine, Sugar recommend APC so who is to argue

wget http://pecl.php.net/get/APC-3.1.9.tgz
tar -xvzf  APC-*.tgz
cd APC-*
phpize

To configure APC you need to know where the php-config file was installed

whereis php-config

This should return something like

/usr/bin/php-config

./configure --enable-apc --enable-apc-mmap --with-php-config=/usr/bin/php-config
make
make install

This has now installed apc, you need to tell php about this now.

There are two ways to do this depending on the version of php I believe, this is what I have surmised from the php.ini file from the following

;;;;
; Note: packaged extension modules are now loaded via the .ini files
; found in the directory /etc/php.d; these are loaded by default.
;;;;

If you do not have this note then just add the following to the file.

extension=apc.so

If you do have reference to the php.d directory then

echo "; Enable apc extension module"  > /etc/php.d/apc.ini
echo "extension=apc.so"  >> /etc/php.d/apc.ini

You have to restart the Apache server  if it is started

service httpd restart

From the Sugar installation documents, the php.ini file should have the following changed

  • memory_limit – Recommended setting: 512M or higher. The memory_limit parameter mainly comes into play when executing large transactions such as mass update, export and import. If this setting is too low when trying to perform one of these actions, the end user will encounter a fatal error and the process will not complete.
  • upload_max_filesize and post_max_size – Recommended setting: 30M or higher. Both of these settings work in conjunction with each other when uploading files through SugarCRM which includes future upgrades as well as document and note attachments. Please note that there is also a setting in the application which can limit file upload file size for end users so the settings in PHP should be high enough to allow any future upgrade files to be loaded without error.
  • max_execution_time = Recommended setting: 300. This setting controls how long a PHP process will remain active. It is important to set this parameter to a value that will allow for large requests to complete if necessary but also will not hamper performance of the server if running too long.

You can do this by hand by editing the /ect/php.ini file or you can run the scripts below

mkdir /opt/software/backphp/
cp /etc/php.ini /opt/software/backphp/
sed -i 's/memory_limit = 128M/memory_limit = 512M/g' /etc/php.ini
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 30M/g' /etc/php.ini
sed -i 's/post_max_size = 8M/post_max_size = 30M/g' /etc/php.ini
sed -i 's/max_execution_time = 30/max_execution_time = 30/g' /etc/php.ini

To check everything is OK

echo "<?php" > /var/www/html/phpinfo.php 
echo "// Show all information, defaults to INFO_ALL" >> /var/www/html/phpinfo.php
echo "phpinfo();" >> /var/www/html/phpinfo.php
echo "// Show just the module information." >> /var/www/html/phpinfo.php
echo "// phpinfo(8) yields identical results." >> /var/www/html/phpinfo.php
echo "phpinfo(INFO_MODULES);" >> /var/www/html/phpinfo.php
echo "?>" >> /var/www/html/phpinfo.php

chown apache:apache /var/www/html/phpinfo.php
chmod 755 /var/www/html/phpinfo.php

 

Start the HTTP server if not all ready done so

service httpd start

Web browse to http://x.x.x.x/phpinfo.php. If you see the information page then all is well :).

rm -r /var/html/www/phpinfo.php

We now need to configure the web server to allow / not allow a few things

echo "<VirtualHost *:80>"  >> /etc/httpd/conf/httpd.conf
echo "ServerName crm.xxxxxxx.com" >> /etc/httpd/conf/httpd.conf
echo "DocumentRoot /var/www/html/crm" >> /etc/httpd/conf/httpd.conf
echo "<Directory "/var/www/html/crm">" >> /etc/httpd/conf/httpd.conf
echo "allow from all" >> /etc/httpd/conf/httpd.conf
echo "Options +Indexes" >> /etc/httpd/conf/httpd.conf
echo "</Directory>" >> /etc/httpd/conf/httpd.conf
echo "</VirtualHost>" >> /etc/httpd/conf/httpd.conf

A manual edit of the the httpd.conf file is also required

vi  /etc/httpd/conf/httpd.conf
/Directory /

Replace the following line

AllowOverride None with AllowOverride All

Find the following

# If your host doesn’t have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make
# redirections work in a sensible way.
#
#ServerName http://www.example.com:80

and change the ServerName to match your set-up

vi /etc/hosts

add the DNS of the server to this file

You should now be able to download and install Sugar CRM

Please call back as I will be turning my attention to the mounting an S3 bucket to hold all of the upload data that is required for the server to be scaled sideways.

The complete script with out any comments, please note that the file edit of httpd.conf is not included yet, need to learn sed,awk and grep a bit more 🙂

yum -y install httpd php php-mysql php-mbstring php-devel gcc  pcre-devel
mkdir -p /opt/software/apc
cd /opt/software/apc
wget http://pecl.php.net/get/APC-3.1.9.tgz
tar -xvzf  APC-*.tgz
cd APC-*
phpize
./configure --enable-apc --enable-apc-mmap --with-php-config=/usr/bin/php-config
make
make install
echo "; Enable apc extension module"  > /etc/php.d/apc.ini
echo "extension=apc.so"  >> /etc/php.d/apc.ini
mkdir /opt/software/backphp/
cp /etc/php.ini /opt/software/backphp/
sed -i 's/memory_limit = 128M/memory_limit = 512M/g' /etc/php.ini
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 30M/g' /etc/php.ini
sed -i 's/post_max_size = 8M/post_max_size = 30M/g' /etc/php.ini
sed -i 's/max_execution_time = 30/max_execution_time = 30/g' /etc/php.ini
echo "<VirtualHost *:80>"  >> /etc/httpd/conf/httpd.conf
echo "ServerName crm.xxxxxxx.com" >> /etc/httpd/conf/httpd.conf
echo "DocumentRoot /var/www/html/crm" >> /etc/httpd/conf/httpd.conf
echo "<Directory "/var/www/html/crm">" >> /etc/httpd/conf/httpd.conf
echo "allow from all" >> /etc/httpd/conf/httpd.conf
echo "Options +Indexes" >> /etc/httpd/conf/httpd.conf
echo "</Directory>" >> /etc/httpd/conf/httpd.conf
echo "</VirtualHost>" >> /etc/httpd/conf/httpd.conf

 

     

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

ifssoftware.wordpress.com/

Helping you achieve more

The Survival Guides's Blog

How to Survive IT and Holidays

WordPress.com

WordPress.com is the best place for your personal blog or business site.

%d bloggers like this: