Tutorial: How to Install SugarCRM on Ubuntu
So, some of you guys may not use SugarCRM on Linode, but I've decided to do some tutorials and installing SugarCRM just happens to be one of the ones I want to do. If nothing else, this tutorial may lead you into using SugarCRM, seeing as it's a free software anyways (Community Edition).
Anyways, if you guys have any questions just reply to this post :)
So, first off, this tutorial will probably work for most Linux distributions, but the commands may need to be modified for certain distributions. That being said, this tutorial is primarily meant to be used for Ubuntu, but will likely work (with some modification) in most distributions.
You will need to set up a web server before you can attempt to install SugarCRM. For in-depth assistance with setting up a web server you can refer to the following:
LEMP Stack (NGINX):
LAMP Stack (Apache):
In this tutorial, I've used Apache, but the install is the same for SugarCRM either way.
For those of you who do not know what SugarCRM is, SugarCRM is a Customer Relationship Management system (CRM) that is run in your browser using a simple web server, MySQL, and PHP combination.
You can get the latest version of SugarCRM from their website:
In this tutorial, we'll be using the command line, and not FTP. However, you're free to send these files via FTP.
Let's get down to it then!
At this point, you should have your web server set up properly by following one of those two guides above.
1) *NOTE: This is the latest version as of right now, you will need to find the latest version if it has changed from 6.5.17
We need to grab the SugarCE download. Now, I prefer to do this via "wget." Let's make sure you're in the directory that you want SugarCRM installed in. For me, I want it installed into /var/www/crm, so I'm going to use this command first:
Next, run the following command:
2) Now, we have SugarCE-6.5.17.zip (or another file, depending on your version of the Community Edition of SugarCRM) in our directory. We now want to unzip this file.
Run the following command to unzip the file:
3) Now it's time we move this SugarCRM into the current directory we're in (seeing you should be running this from the directory you wish to install SugarCRM into). Right now, your file structure would look similar to mine: /var/www/crm/SugarCE-*, but I want SugarCRM in /var/www/crm. This command will fix that, as long as you're in /var/www/crm (cd /var/www/crm)
Run the following command:
mv SugarCE-*/* . && rm -rfv SugarCE-*
4) Now, because SugarCRM is completely complicated, we need to make a few changes to the permissions of these files in order for SugarCRM to work.
Let's go ahead and run the following commands for this (each line is a new command):
chgrp -R www-data *
chmod 664 config.php
chmod 664 config_override.php
chmod 775 custom
chmod 775 cache/images
chmod 775 cache/pdf
chmod 775 cache/xml
chmod 775 cache/layout
chmod 775 cache
chmod -R 775 modules
chmod 775 upload
5) You should now be able to install SugarCRM. Go ahead and hit "Re-Check."
6) Let's go ahead and make a MySQL user and database.
You will need to enter the MySQL command line, to do so execute the following command:
*Note: When prompted for your password, use your root password you set up when setting up your MySQL in the LAMP/LEMP stack (it's probably the same as your server root password)
mysql -u root -p
Now that we're on the MySQL command line, let's make the user, database and grant privileges on the database for that user:
*Note: Change 'changeme123password' to what you want your user's password to be.
CREATE DATABASE sugarcrm;
CREATE USER 'sugarcrm'@'localhost' IDENTIFIED BY 'changeme123password';
GRANT ALL ON sugarcrm.* TO 'sugarcrm'@'localhost';
We're now out of the MySQL command line and we've created our username, password, database, and granted all privileges on it for that user. Let's go ahead and put that all in SugarCRM's install.
7) Let's take a look at what SugarCRM is requesting:
*Note: I've filled it in based on what we have configured above. You may need to change it as per what you ran.
* Database Name: sugarcrm
Database Admin Username: sugarcrm
Database Admin Password: changeme123password
Sugar Database User: Same as Database Admin</list>
You can then decide whether or not you want their demo content. This is entirely up to you.
8) Make your admin username/password.
9) Now you'll most likely see a few more errors:
> IMAP Module Not found: InboundEmail and Campaigns (Email) require the IMAP libraries. Neither will be functional.
cURL Module Not found: Sugar Scheduler will run with limited functionality.
Upload File Size Warning: Your PHP configuration should be changed to allow files of at least 6MB to be uploaded.
Sprite Support Currently we are not able to locate the GD library, as a result you will not be able to use the CSS Sprite functionality.
Here's how we'll resolve them.
First, we need to install an IMAP server. This can be tedious, but luckily, there's iRedMail and we can just run that :)
iRedMail will install a fully functional mail server for us.
Run the following commands to get iRedMail and execute:
tar jxvf iRedMail-0.8.7.tar.bz2
rm -rfv iRedMail-0.8.7.tar.bz2
You will now need to follow the steps on the mail server. This is going to be your configuration, and that's not something we can decide for you, so just go ahead and configure that yourself.
But, when asked, make sure you select "MySQL" for the storing of your e-mail accounts, as you already have MySQL installed.
The installation process will finish itself, and may take a few moments :)
You will need to execute the following command to reboot the system once it has installed:
Additionally, it may ask you to change your Firewall rules. That's up to you, but you probably can just follow their firewall rules.
The great part of this script – it fixes all four of those errors :) Refresh the page and confirm to resending the contact form information (if you don't, you'll need to redo filling out the i
10) You'll also need to add the cron they're asking for:
Scroll to the bottom of that file and paste in the cron.
The message isn't an "error" message, so it won't disappear.
11) Hit Install!
12) If, for whatever reason, .htaccess can't be created/written into, go ahead and execute this command to add that htaccess line they want on the next page:
*Note: You will need to change the contents of the echo (in quotes) to what they want you to add, you can do this by pasting it in the quotes and deleting the markup I've put below. You will also need to change /var/www/crm/.htaccess to where you're installing the CRM.
echo "# BEGIN SUGARCRM RESTRICTIONS RedirectMatch 403 .*\.log$ RedirectMatch 403 /+not_imported_.*\.txt RedirectMatch 403 /+(soap|cache|xtemplate|data|examples|include|log4php|metadata|modules)/+.*\.(php|tpl) RedirectMatch 403 /+emailmandelivery\.php RedirectMatch 403 /+upload RedirectMatch 403 /+custom/+blowfish RedirectMatch 403 /+cache/+diagnostic RedirectMatch 403 /+files\.md5$ # END SUGARCRM RESTRICTIONS" > /var/www/crm/.htaccess
13) You can register the CRM if you want (I didn't).
14) That's it! Set 'er up! You're done!
If you have any questions, just comment below and I will do my best to address them :)