OroCRM is a free and open source Customer Relationship Manager (CRM) application built on OroPlatform. OroPlatform is fully customizable open source business application platform software. OroPlatform provides you with all the features that are required to create a customized application. OroCRM is built using PHP Symfony framework and stores its data into the MySQL/MariaDB database server. It is an enterprise-ready CRM application providing tons of features. It also integrates with many 3rd party applications such as Magento Store, MailChimp, Zendesk and many more. It is multilingual and has a fully responsive user interface, which provides you with the capability to manage it using mobile devices also.
In this tutorial, we will use
crm.example.com as the domain name pointed to the server. Replace all occurrences of
crm.example.com with your actual domain name.
Update your base system using the guide How to Update Ubuntu 16.04. Once your system has been updated, proceed to install the required dependencies.
OroCRM can be installed on any production web server supporting PHP. OroCRM supports all versions of PHP greater than 7.0. In this tutorial, we will use Nginx with PHP-FPM and PHP 7.1.
sudo apt -y install nginx
Start Nginx and enable it to automatically start at boot.
sudo systemctl start nginx sudo systemctl enable nginx
PHP 7.1 is not available in the default
apt repository. First, add the PPA repository for PHP.
sudo apt install software-properties-common sudo add-apt-repository ppa:ondrej/php
Install PHP 7.1 along with the PHP modules required by OroCRM.
sudo apt update sudo apt -y install php7.1 php7.1-fpm php7.1-common php7.1-curl php7.1-gd php7.1-intl php7.1-json php7.1-mbstring php7.1-mcrypt php7.1-mysql php7.1-xml php7.1-xml php7.1-zip php7.1-tidy php7.1-soap php7.1-opcache
Edit the loaded PHP configuration file.
sudo nano /etc/php/7.1/cli/php.ini
Find the following lines. Uncomment and make changes as shown.
date.timezone = Asia/Kolkata ;Replace "Asia/Kolkata" with your appropriate timezone cgi.fix_pathinfo=0
Start PHP-FPM and enable it to start at boot.
sudo systemctl start php7.1-fpm sudo systemctl enable php7.1-fpm
MariaDB is an open source fork of MySQL. Add MariaDB 10.2 repository.
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://kartolo.sby.datautama.net.id/mariadb/repo/10.2/ubuntu xenial main'
sudo apt -y update sudo apt -y install mariadb-server
Start MariaDB and enable it to automatically start at boot.
sudo systemctl start mariadb sudo systemctl enable mariadb
Log in to the MySQL shell as the root user by running.
mysql -u root -p
Provide the password for the MariaDB root user to log in.
Run the following queries to create a database and a database user for OroCRM installation.
CREATE DATABASE oro_data; CREATE USER 'oro_user'@'localhost' IDENTIFIED BY 'StrongPassword'; GRANT ALL PRIVILEGES ON oro_data.* TO 'oro_user'@'localhost'; FLUSH PRIVILEGES; EXIT;
You can replace the database name
oro_data and username
oro_user according to your choice. Be sure to change
StrongPassword to a very strong password.
sudo curl --silent --location https://deb.nodesource.com/setup_8.x | sudo bash -
Install Node.js and Git.
sudo apt -y install nodejs git
Git will be used to clone the OroCRM repository from the internet. You will also need to install Composer. Composer is a dependency manager tool for PHP applications. Because OroCRM is written in Symfony framework, you will need Composer to install the dependencies and application.
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php composer-setup.php
Move Composer to the
/usr/bin directory so that it can be executed from anywhere in the system.
sudo mv composer.phar /usr/bin/composer
Provide execution permission to the Composer.
sudo chmod +x /usr/bin/composer
There are many ways to download OroCRM on your server. The most appropriate way to get the most updated version is to clone the repository through Git.
Clone the OroCRM repository.
cd /usr/share/nginx/ sudo git clone -b 2.4 https://github.com/oroinc/crm-application.git orocrm
Copy the example
parameters file to the default
parameters file used by OroCRM.
cd orocrm sudo cp app/config/parameters.yml.dist app/config/parameters.yml
Before you can proceed further, you will need to update the
parameters.yml file to provide database and email information.
sudo nano app/config/parameters.yml
Find the following lines.
database_driver: pdo_mysql database_host: 127.0.0.1 database_port: ~ database_name: oro_crm database_user: root database_password: ~
Update the above configuration according to the database you have created to store OroCRM data. In our case, it should look like this.
database_driver: pdo_mysql database_host: 127.0.0.1 database_port: 3306 database_name: oro_data database_user: oro_user database_password: StrongPassword
If you have an SMTP server ready and you wish to use email sending features immediately, you can update the mailer settings as shown.
mailer_transport: smtp mailer_host: mail.example.com mailer_port: 456 mailer_encryption: ssl mailer_user: email@example.com mailer_password: EMailPassword
If you do not have a mail server ready, you can skip it for now by leaving the existing values. You can always change email configuration through the dashboard.
Set a random string in
secret by replacing
ThisTokenIsNotSoSecretChangeIt. A random string is required to encode the session data. An example string will look like this.
You can generate a random string using the
pwgen utility. Install
pwgen by running
sudo apt -y install pwgen. To generate a random string, run
pwgen -s 64 1.
Save the file and exit from the editor. Install the required PHP dependencies through composer.
sudo composer install --prefer-dist --no-dev
--no-dev will ensure that Composer only installs the dependencies required to run the web server in production mode. The script will take a few minutes to download and install the required PHP dependencies.
Install the application.
sudo php app/console oro:install --env=prod
This will build the web cache and write the database. The
--env=prod parameter is provided to install the application in production mode. The installation will only proceed if all the required dependencies are installed and configured.
During the installation, you will be asked a few questions for setting up the administrator account. The questions are as follows.
Administration setup. Application URL (http://localhost): http://crm.example.com Organization name (OroCRM): My Org Username (admin): admin Email: firstname.lastname@example.org First name: John Last name: Doe Password: Load sample data (y/n): y
Provide the information. Load the sample data to evaluate the product before using it for production.
Warm up the API documentation cache:
sudo php app/console oro:api:doc:cache:clear
Create an Nginx server block file to serve the application to the users.
sudo nano /etc/nginx/sites-available/orocrm
Populate the file.
Make sure that you change the
crm.example.com to your actual domain name. The above configuration also includes the configuration required for GZip compression and browser caching. Gzip compression compresses the data before sending it to the browser. Enabling browser caching stores the static resources to the web cache of the client computer. The next time the user accesses the site, most of the static content is loaded from the user's own web cache. These two methods increase the speed of the application dramatically.
Enable the site.
sudo ln -s /etc/nginx/sites-available/orocrm /etc/nginx/sites-enabled/orocrm
Check the Nginx configuration file for any errors.
sudo nginx -t
The output should look like the following.
user@vultr:/usr/share/nginx/orocrm$ sudo nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
Provide the ownership of the OroCRM files to the Nginx user.
sudo chown -R www-data:www-data /usr/share/nginx/orocrm
Restart Nginx to apply the new configuration.
sudo systemctl restart nginx
You can now access the application at
http://crm.example.com. Log in using the administrator
password you have set during installation.
To automatically run the scheduled tasks you can add a Cron job entry. Open
sudo crontab -e
Add the following line to the file.
*/1 * * * * /usr/bin/php /usr/share/nginx/orocrm/app/console oro:cron --env=prod > /dev/null
This will run the cron job every minute so that the scheduled tasks such as email queues are processed earliest.
You will also need to setup Supervisor to run the Message Queue service. It is required that at least one process is running at all times for a consumer to process the messages. A consumer can normally interrupt the message process through many ways. To ensure that the service is running continuously, we will use the Supervisor service. We will configure Supervisor to run four processes in parallel. If any of the four processes is stopped for any reason, Supervisor will try to start it again.
sudo apt -y install supervisor
Create a new Supervisor configuration file.
sudo nano /etc/supervisor/conf.d/orocrm.conf
Add the following lines to the file.
[program:oro_message_consumer] command=/usr/bin/php /usr/share/nginx/orocrm/app/console --env=prod --no-debug oro:message-queue:consume process_name=%(program_name)s_%(process_num)02d numprocs=4 autostart=true autorestart=true startsecs=0 user=www-data redirect_stderr=true
Start and enable Supervisor to automatically start at boot time.
sudo systemctl restart supervisor sudo systemctl enable supervisor
You can view the status of the processes by running the following.
sudo supervisorctl status
You should see that the processes are running.
user@vultr:/usr/share/nginx/orocrm$ sudo supervisorctl status oro_message_consumer:oro_message_consumer_00 RUNNING pid 20809, uptime 0:00:01 oro_message_consumer:oro_message_consumer_01 RUNNING pid 20808, uptime 0:00:01 oro_message_consumer:oro_message_consumer_02 RUNNING pid 20807, uptime 0:00:01 oro_message_consumer:oro_message_consumer_03 RUNNING pid 20806, uptime 0:00:01
OroCRM is now installed on your server. You can now use the application to manage the routine tasks of your organization. To learn more about OroCRM, you can visit its official website.