How to Install SugarCRM on Ubuntu 20.04

Updated on November 21, 2023
How to Install SugarCRM on Ubuntu 20.04 header image

SugarCRM is a popular customer relationship management system that offers advanced customer and business management features. It offers sales force, automation, marketing campaigns, collaboration, customer support, and other features that can be self-hosted on a private server. This article will explain how to install SugarCRM on Ubuntu 20.04.

Prerequisites

Step 1: Create the SugarCRM Database

Login to MySQL.

$ mysql -u root -p

Create a new database.

CREATE DATABASE sugardb;

Create a new database user with a strong password.

CREATE USER ‘admin’@’localhost’ IDENTIFIED BY ‘Password’;

Grant the user full rights to the SugarCRM database.

GRANT ALL PRIVILEGES ON sugardb.* TO `admin`@`localhost`;

Refresh MySQL Privileges.

FLUSH PRIVILEGES

Exit the MySQL shell.

EXIT

Step 2: Configure Apache

Create a new SugarCRM webroot directory.

$ sudo mkdir /var/www/SugarCRM

Then, create a new Apache virtual host configuration file.

$ sudo touch /etc/apache2/sites-available/sugarcrm.conf

Open and edit the file.

$ sudo nano /etc/apache2/sites-available/sugarcrm.conf

Paste the following configuration lines:

<VirtualHost *:80>
    ServerName example.com
    DocumentRoot /var/www/sugarcrm
    <Directory /var/www/sugarcrm>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>

Save and close the file.

Enable the configuration file.

$ sudo a2ensite sugarcrm.conf

Restart Apache.

$ sudo systemctl restart apache2

Step 3: Configure SSL

Install Certbot.

$ sudo apt install certbot

Request a free Let’s Encrypt SSL Certificate, replacing example.com with your active domain name.

$ certbot --apache --redirect -d example.com -d www.example.com -m admin@example.com --agree-tos

Verify that automatic certificate renewal is turned on.

$ sudo certbot renew --dry-run

Step 4: Configure Firewall

Open Port 21 to allow FTP connections on the server.

$ sudo ufw allow 21/tcp

Open Port 80 to allow HTTP traffic.

$ sudo ufw allow 80/tcp

Open Port 443 to allow HTTPS traffic.

$ sudo ufw allow 443/tcp

Reload the Firewall.

$ sudo ufw reload

Step 5: Install SugarCRM

Visit the SugarCRM Support website, log in, and click Downloads in the top right corner of your account. Depending on your SugarCRM license, select your target edition, then download the latest .zip release file to your computer.

Open your FTP client, and make a connection to your server, then upload the SugarCRM**.zip file to the FTP user home directory.

Next, through your server terminal session, unzip the uploaded SugarCRM file.

$ unzip SugarCRM-11.0.3.zip

Move all extracted files to the SugarCRM webroot directory.

$ sudo mv SugarCRM/* /var/www/sugarcrm

Now, grant Apache full ownership permissions to files in the SugarCRM directory.

$ sudo chown -R www-data:www-data /var/www/sugarcrm

Change to the directory.

$ cd /var/www/sugarcrm

Set proper directory and file permissions.

$ sudo find . -type d -exec chmod 755 {} \;
    
$ sudo find . -type f -exec chmod 644 {} \;

The above command will apply permissions mode 755 on all subdirectories, and 644 on all files in the directory.

Then, through a web browser, visit your SugarCRM domain to complete the installation and setup process.

https://example.com

On the database setup page, select MySQL (mysqli extension) as your database type, then enter the database name, username, and password created on step 1 of this article. Once validated, create an administrative user account to complete your SugarCRM Installation.

Conclusion

You have successfully installed SugarCRM on a Ubuntu 20.04 server running the Apache, MySQL, PHP (LAMP) Stack. For further information on how to set up SugarCRM, visit the official documentation page.