UbuntuUbuntu Based

How To Install OroCRM on Ubuntu 24.04 LTS

Install OroCRM on Ubuntu 24.04

This guide provides a detailed, step-by-step approach to installing and configuring OroCRM on Ubuntu 24.04 LTS. OroCRM is a powerful open-source customer relationship management platform that offers robust features for businesses of all sizes. By following this comprehensive tutorial, you’ll establish a fully functional OroCRM environment on the latest Ubuntu LTS release.

Understanding OroCRM and Its Capabilities

What is OroCRM and Why Choose It

OroCRM is an enterprise-ready open-source Customer Relationship Management (CRM) platform that provides comprehensive tools for managing customer interactions and data. Built on the PHP Symfony framework, it’s specifically designed for businesses seeking powerful e-commerce and marketing capabilities with a multichannel perspective. The platform allows organizations to streamline management of large amounts of data while providing accurate insights for improved decision-making.

Community vs. Enterprise Editions

OroCRM comes in two distinct editions: Community Edition (CE) and Enterprise Edition (EE). The Community Edition offers a robust set of features at no cost, making it ideal for small to medium businesses and startups looking for an affordable CRM solution. The Enterprise Edition includes additional capabilities and support options designed for larger organizations with more complex requirements.

Key Features and Benefits

What sets OroCRM apart is its flexibility and customization options. The software offers integration capabilities with other e-commerce platforms like Magento. It provides marketing automation, live chat functionality, and comprehensive tools for creating, managing, measuring, and optimizing customer journeys. The platform’s architecture makes it accessible for beginners while providing advanced features for expert users.

Installation Prerequisites

Hardware Requirements

For optimal performance, your server should have at minimum 4GB of RAM and multiple CPU cores. Based on testing environments, a recommended configuration includes 4 virtual CPUs and SSD storage for improved performance. OroCRM is resource-intensive, so adequate system specifications are crucial for smooth operation.

Domain Configuration

Before beginning installation, you’ll need to configure DNS records for your server. Create an A record pointing your chosen domain (e.g., crm.example.com) to your server’s IP address. Ensure that DNS changes are fully propagated before proceeding with installation. Proper domain configuration is essential for accessing your OroCRM installation via a web browser.

Software Prerequisites

You’ll need a fresh installation of Ubuntu 24.04 LTS with a non-root user having sudo privileges. While earlier guides focused on Ubuntu 20.04, the process is adaptable to 24.04 with minor adjustments to package versions. A basic understanding of Linux command line operations, web servers, and database management will be beneficial throughout the installation process.

System Preparation

Updating the Ubuntu System

Begin by ensuring your Ubuntu 24.04 system is fully updated with the latest packages and security patches. This critical first step creates a stable foundation for your OroCRM installation. Open a terminal and execute the following commands:

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y --fix-missing
sudo apt-get autoremove -y
sudo apt-get clean

After completing the update process, it’s advisable to restart your system to ensure all updates are properly applied.

Setting Up System User Accounts

While working with the non-root user with sudo privileges, you may want to set a root password for administrative tasks that require direct root access. This can be done using the command sudo passwd. However, for best security practices, continue using sudo for most operations rather than logging in directly as root.

Configuring Time Synchronization

Accurate time keeping is crucial for e-commerce applications like OroCRM. Install Chrony, a Network Time Protocol (NTP) daemon, to ensure your server maintains precise time synchronization:

sudo apt install -y chrony

Verify the synchronization status with chronyc sources. Properly synchronized time prevents authentication issues and ensures accurate timestamps on transactions and customer interactions.

Installing Supporting Software

Installing Essential Packages

Start by installing several utility packages that will be required during the OroCRM installation process:

sudo apt install -y zip npm wget curl gcc g++ make jpegoptim pngquant dirmngr apt-transport-https lsb-release ca-certificates

These packages provide essential functionality for downloading, extracting, and processing files during installation.

Setting Up Web Server Options

Option 1: LAMP Stack (Apache, MySQL, PHP)

The LAMP stack is a traditional and well-supported environment for PHP applications like OroCRM. Install Apache using:

sudo apt install -y apache2
sudo systemctl start apache2
sudo systemctl enable apache2

Apache offers excellent documentation and widespread community support, making it an excellent choice for those new to web servers.

Option 2: LEMP Stack (Nginx, MySQL, PHP)

Alternatively, you can use the LEMP stack, which replaces Apache with Nginx for potentially better performance with high-traffic sites:

sudo apt install -y nginx
sudo systemctl start nginx
sudo systemctl enable nginx

Nginx is often preferred for its performance characteristics with PHP applications and more straightforward configuration for complex setups.

Installing PHP and Required Extensions

OroCRM requires PHP 8.0 or newer for the latest versions. Install PHP and the required extensions:

sudo apt install -y php php-cli php-fpm php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath php-intl php-soap php-imap

These PHP extensions are essential for OroCRM’s core functionality. For optimal performance, adjust your PHP configuration by editing php.ini to increase memory limits and execution time.

Installing Node.js

OroCRM requires Node.js for certain frontend components. Install Node.js 16 or later:

curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt install -y nodejs

Verify the installation with node -v to ensure you have the correct version.

Database Configuration

Installing MySQL/MariaDB

OroCRM requires a database server to store its data. You can choose between MySQL and MariaDB:

# For MySQL
sudo apt install -y mysql-server

# For MariaDB
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64] http://mirrors.accretive-networks.net/mariadb/repo/10.6/ubuntu jammy main'
sudo apt update
sudo apt install -y mariadb-server

After installation, secure your database server by running the security script:

sudo mysql_secure_installation

Follow the prompts to set a root password and remove unnecessary default settings.

Creating the OroCRM Database and User

Log into MySQL/MariaDB and create a dedicated database and user for OroCRM:

sudo mysql -u root -p

Inside the MySQL shell, execute:

CREATE DATABASE orocrm CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'orocrmuser'@'localhost' IDENTIFIED BY 'your_secure_password';
GRANT ALL PRIVILEGES ON orocrm.* TO 'orocrmuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Replace ‘your_secure_password’ with a strong password. This dedicated database provides better security and easier management than using the root account or sharing a database with other applications.

Downloading and Preparing OroCRM

Obtaining OroCRM Source Code

Download the latest stable version of OroCRM from the official website:

cd /tmp
wget https://github.com/oroinc/crm-application/archive/refs/tags/4.2.8.zip -O orocrm.zip

Note that version 4.2.8 is used as an example; you should check for the latest available version compatible with your PHP version.

Extracting the OroCRM Files

Extract the downloaded archive and move it to your web server’s document root:

unzip orocrm.zip
sudo mv crm-application-4.2.8 /var/www/orocrm

For Apache, the default document root is typically /var/www/html, while for Nginx, it’s often /var/www.

Setting Correct Permissions

OroCRM requires specific permissions to operate correctly. Set the appropriate ownership and permissions:

sudo chown -R www-data:www-data /var/www/orocrm
sudo chmod -R 775 /var/www/orocrm/var
sudo chmod -R 775 /var/www/orocrm/public/uploads

This ensures that the web server can write to essential directories while maintaining security. Proper permissions are crucial to prevent common installation errors and security vulnerabilities.

Web Server Configuration

Configuring Apache (If Using LAMP)

If you chose Apache, create a virtual host configuration file:

sudo nano /etc/apache2/sites-available/orocrm.conf

Add the following content, adjusting the domain to match your setup:

<VirtualHost *:80>
    ServerName crm.example.com
    ServerAlias www.crm.example.com
    DocumentRoot /var/www/orocrm/public
    
    <Directory /var/www/orocrm/public>
        AllowOverride All
        Require all granted
    </Directory>
    
    ErrorLog ${APACHE_LOG_DIR}/orocrm_error.log
    CustomLog ${APACHE_LOG_DIR}/orocrm_access.log combined
</VirtualHost>

Enable the site, rewrite module, and restart Apache:

sudo a2ensite orocrm.conf
sudo a2enmod rewrite
sudo systemctl restart apache2

This configuration allows Apache to serve the OroCRM application and handle URL rewrites required by the application.

Configuring Nginx (If Using LEMP)

If you chose Nginx, create a server block configuration:

sudo nano /etc/nginx/sites-available/orocrm

Add the following content, customizing as needed:

server {
    listen 80;
    server_name crm.example.com www.crm.example.com;
    root /var/www/orocrm/public;
    
    location / {
        try_files $uri /index.php$is_args$args;
    }
    
    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
    
    error_log /var/log/nginx/orocrm_error.log;
    access_log /var/log/nginx/orocrm_access.log;
}

Enable the site and restart Nginx:

sudo ln -s /etc/nginx/sites-available/orocrm /etc/nginx/sites-enabled/
sudo systemctl restart nginx

This configuration handles the appropriate routing of requests to the PHP-FPM processor, essential for OroCRM’s operation.

OroCRM Installation Process

Installing Composer

OroCRM requires Composer to manage PHP dependencies. Install Composer globally:

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

This places the Composer executable in a directory that’s in your system’s PATH, making it easily accessible.

Installing OroCRM Dependencies

Navigate to the OroCRM directory and install the required dependencies:

cd /var/www/orocrm
sudo -u www-data composer install --prefer-dist --no-dev

This process may take some time as Composer downloads and installs all required packages. The --no-dev flag skips development dependencies, which aren’t needed in a production environment.

Running the Installation Command

OroCRM includes a command-line installer to set up the application:

cd /var/www/orocrm
sudo -u www-data php bin/console oro:install --env=prod \
    --application-url=http://crm.example.com \
    --organization-name="Your Organization" \
    --user-name=admin \
    --user-email=admin@example.com \
    --user-firstname=Admin \
    --user-lastname=User \
    --user-password=YourSecurePassword \
    --database-driver=pdo_mysql \
    --database-host=localhost \
    --database-port=3306 \
    --database-name=orocrm \
    --database-user=orocrmuser \
    --database-password=YourDatabasePassword

This command configures OroCRM with your specific details. The installer will create the database schema, load initial data, and set up the admin user. The process may take several minutes to complete.

Post-Installation Configuration

Setting Up Cron Jobs

OroCRM requires several scheduled tasks to run properly. Set up the necessary cron jobs by adding the following to the www-data user’s crontab:

sudo -u www-data crontab -e

Add these lines:

*/5 * * * * php /var/www/orocrm/bin/console oro:cron --env=prod > /dev/null
*/1 * * * * php /var/www/orocrm/bin/console oro:message-queue:consume --env=prod > /dev/null

The first job runs the scheduled commands every 5 minutes, while the second processes the message queue every minute, both essential for OroCRM’s background processes.

Configuring Email

Configure email settings through the OroCRM administration interface or by editing the configuration file:

sudo nano /var/www/orocrm/config/parameters.yml

Update the mailer settings according to your email provider’s requirements. Proper email configuration is critical for notifications, password resets, and communication with customers.

Creating Assets and Clearing Cache

Finalize the installation by generating assets and clearing the application cache:

cd /var/www/orocrm
sudo -u www-data php bin/console oro:assets:install --env=prod
sudo -u www-data php bin/console cache:clear --env=prod

These commands ensure all frontend assets are properly installed and the application cache is fresh, resulting in optimal performance.

Troubleshooting Common Issues

Resolving Permission Problems

Many installation issues stem from incorrect file permissions. If you encounter “Permission denied” errors, verify and correct the ownership and permissions:

sudo chown -R www-data:www-data /var/www/orocrm
sudo find /var/www/orocrm -type f -exec chmod 644 {} \;
sudo find /var/www/orocrm -type d -exec chmod 755 {} \;
sudo chmod -R 775 /var/www/orocrm/var
sudo chmod -R 775 /var/www/orocrm/public/uploads

These commands reset permissions to the recommended values for web applications on Ubuntu systems.

Addressing PHP Configuration Issues

If you encounter PHP-related errors, verify your PHP configuration meets OroCRM requirements:

php -i | grep memory_limit
php -i | grep max_execution_time

Edit the PHP configuration file if adjustments are needed:

sudo nano /etc/php/8.1/fpm/php.ini

Common required changes include increasing memory_limit to at least 1G and max_execution_time to 300 or higher.

Database Connection Problems

If the application cannot connect to the database, verify your database credentials and configuration:

sudo nano /var/www/orocrm/config/parameters.yml

Ensure the database settings match those you created earlier. You can also test the connection manually:

mysql -u orocrmuser -p -h localhost orocrm

This helps identify whether the issue is with the credentials or the database server configuration.

Security Considerations

Implementing SSL/TLS Encryption

For production environments, securing your OroCRM installation with SSL/TLS encryption is essential. Install Certbot to obtain free Let’s Encrypt certificates:

sudo apt install -y certbot

For Apache:

sudo apt install python3-certbot-apache
sudo certbot --apache -d crm.example.com

For Nginx:

sudo apt install python3-certbot-nginx
sudo certbot --nginx -d crm.example.com

Follow the prompts to complete the certificate installation. This encrypts all traffic between users and your OroCRM instance, protecting sensitive information like customer data and login credentials.

Regular Updates and Maintenance

Establish a routine maintenance schedule to keep your OroCRM installation secure:

# Update Ubuntu packages
sudo apt update && sudo apt upgrade -y

# Update OroCRM (within the same major version)
cd /var/www/orocrm
sudo -u www-data composer update --prefer-dist --no-dev
sudo -u www-data php bin/console oro:platform:update --env=prod

Regular updates help protect against security vulnerabilities in both the operating system and OroCRM itself. Always back up your system before performing updates to prevent data loss in case of issues.

Performance Optimization

PHP-FPM Optimization

Optimize PHP-FPM for better performance with OroCRM by editing the configuration:

sudo nano /etc/php/8.1/fpm/pool.d/www.conf

Adjust settings based on your server’s capabilities:

pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 10
pm.max_spare_servers = 30
pm.max_requests = 500

Restart PHP-FPM after making changes:

sudo systemctl restart php8.1-fpm

These adjustments help PHP handle multiple concurrent requests efficiently, improving response times for users.

Implementing Redis for Caching

Install and configure Redis to improve OroCRM’s performance:

sudo apt install -y redis-server
sudo systemctl enable redis-server

Update OroCRM’s configuration to use Redis:

sudo nano /var/www/orocrm/config/parameters.yml

Add or modify these parameters:

parameters:
    cache_driver: redis
    redis_dsn: 'redis://localhost/0'
    message_queue_transport: 'redis'
    message_queue_transport_config: 'redis://localhost/1'

Clear the cache to apply changes:

sudo -u www-data php bin/console cache:clear --env=prod

Redis caching significantly improves page load times and overall application responsiveness, especially with larger datasets and higher user loads.

Congratulations! You have successfully installed OroCRM. Thanks for using this tutorial for installing OroCRM open-source and simple to utilize CRM on your Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the official OroCRM website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button