UbuntuUbuntu Based

How To Install CiviCRM on Ubuntu 24.04 LTS

Install CiviCRM on Ubuntu 24.04

CiviCRM stands as a powerful open-source constituent relationship management system designed specifically for non-profit organizations, advocacy groups, and NGOs seeking robust tools to manage their contacts, donations, memberships, and events. Installing CiviCRM on Ubuntu 24.04 LTS provides a solid foundation for organizations to streamline their operations and enhance constituent engagement. This comprehensive guide walks through the complete installation process, from setting up the necessary prerequisites to configuring and optimizing your CiviCRM implementation for peak performance.

Understanding CiviCRM and Its Benefits for Organizations

CiviCRM represents a specialized solution tailored to the unique needs of mission-driven organizations. Understanding what CiviCRM offers helps contextualize why proper installation is crucial for leveraging its full potential. CiviCRM provides integrated tools for contact management, contribution tracking, event management, and mass communication that seamlessly work together within a single platform. Unlike general-purpose CRM systems, CiviCRM focuses specifically on the workflows and requirements common to non-profit and civic sector organizations.

What is CiviCRM?

CiviCRM functions as an open-source constituent relationship management system that integrates directly with content management systems like WordPress, Drupal, or Joomla. This integration provides organizations with a comprehensive solution for managing relationships with donors, members, volunteers, and other stakeholders. CiviCRM’s open-source nature means organizations avoid recurring licensing fees while maintaining full control over their data and customization options. The system’s modular architecture allows organizations to implement only the components they need, making it adaptable to diverse organizational requirements regardless of size or mission focus.

Key Features and Advantages for Non-Profits

Non-profit organizations benefit tremendously from CiviCRM’s purpose-built features. The platform offers robust contact management capabilities that allow organizations to track detailed constituent information, including communication history, relationships, and engagement levels. The contribution management module handles online donations, membership dues, and event registrations with integrated payment processing. For event coordination, CiviCRM provides comprehensive tools for registration, participant tracking, and automated communications. Additionally, the email marketing features enable organizations to create targeted campaigns based on constituent segments and track engagement metrics to improve outreach effectiveness.

Prerequisites for Installing CiviCRM on Ubuntu 24.04 LTS

Before beginning the CiviCRM installation process, ensuring your system meets all necessary requirements helps prevent common installation issues. Proper preparation includes verifying hardware specifications, understanding software dependencies, and preparing your Ubuntu environment for a smooth installation experience.

System Requirements

CiviCRM requires sufficient server resources to function efficiently, particularly when managing large constituent databases or handling multiple simultaneous users. For small to medium organizations, allocate a minimum of 4GB RAM to ensure smooth operation. Larger organizations or those with extensive data requirements should consider 8GB RAM or more for optimal performance. Storage requirements depend on your expected database size, but allocate at least 20GB for the initial installation, with room for database growth as your constituent records expand. A modern multi-core processor further enhances system responsiveness, particularly during resource-intensive operations like report generation or bulk email sending.

Required Software Components

CiviCRM operates within a specific software ecosystem, requiring several key components for proper functionality. The system runs on the LAMP stack (Linux, Apache, MySQL/MariaDB, PHP), with Ubuntu 24.04 LTS providing the Linux foundation. For optimal compatibility with the latest CiviCRM release, install PHP 8.2 or 8.3 with essential extensions including Curl, DOM XML, GD, JSON, mbstring, MySQL, XML, and Zip. The database system should be either MySQL 5.7.5+ or MariaDB 10.2+ to ensure compatibility with CiviCRM’s database structure and queries. Additionally, Apache web server 2.0 or higher with mod_rewrite module enabled provides the necessary web service functionality for CiviCRM’s interface and API operations.

Setting Up the LAMP Stack on Ubuntu 24.04 LTS

The LAMP stack (Linux, Apache, MySQL, PHP) forms the foundation for your CiviCRM installation. Properly configuring each component ensures optimal performance and security for your CiviCRM implementation. This section guides you through setting up each element of the LAMP stack on your Ubuntu 24.04 LTS system.

Installing Apache Web Server

Apache serves as the web server component of the LAMP stack, handling HTTP requests and serving web pages to users. Begin by updating your system’s package lists to ensure you’re installing the latest available versions:

sudo apt update
sudo apt upgrade -y

Next, install Apache with a simple command:

sudo apt install apache2 -y

After installation completes, enable the required Apache modules, particularly mod_rewrite which CiviCRM depends on for proper URL handling:

sudo a2enmod rewrite
sudo systemctl restart apache2

Verify Apache’s installation by accessing your server’s IP address in a web browser. You should see the default Apache welcome page if the installation succeeded. Check Apache’s status using the systemctl command to ensure it’s running correctly:

sudo systemctl status apache2

Installing and Configuring MySQL/MariaDB

CiviCRM stores all constituent data, configurations, and operational records in a relational database. Install MariaDB, a compatible MySQL fork, using the following command:

sudo apt install mariadb-server -y

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

sudo mysql_secure_installation

Follow the prompts to:

  • Set a strong root password
  • Remove anonymous users
  • Disallow root login remotely
  • Remove test database
  • Reload privilege tables

These security measures protect your constituent data from unauthorized access. Verify MariaDB’s status to ensure it’s running properly:

sudo systemctl status mariadb

Installing PHP and Required Extensions

PHP processes the application logic for CiviCRM, with several specific extensions required for full functionality. Install PHP and the necessary extensions:

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

After installation, optimize PHP’s configuration for CiviCRM by editing the php.ini file:

sudo nano /etc/php/8.2/apache2/php.ini

Locate and modify these key settings for optimal CiviCRM performance:

memory_limit = 256M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
open_basedir = 
safe_mode = Off

Save the file and restart Apache to apply the changes:

sudo systemctl restart apache2

These configurations provide sufficient resources for CiviCRM to process complex operations efficiently.

Creating Databases for CiviCRM and WordPress

CiviCRM requires dedicated databases for both the CMS platform (WordPress in this guide) and CiviCRM itself. These separate databases enhance performance and simplify maintenance operations. This section guides you through creating and configuring the necessary databases.

Setting Up MySQL User and Database for WordPress

Access the MySQL command line interface using the root account:

sudo mysql -u root -p

Create a database for WordPress and a dedicated user with appropriate privileges:

CREATE DATABASE wordpressdb;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'secure_password';
GRANT ALL PRIVILEGES ON wordpressdb.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;

Replace ‘secure_password‘ with a strong, unique password. This database stores WordPress core data, including posts, pages, users, and plugin configurations not specific to CiviCRM.

Creating a Dedicated CiviCRM Database

While still in the MySQL command line, create a separate database specifically for CiviCRM:

CREATE DATABASE civicrmdb;
GRANT ALL PRIVILEGES ON civicrmdb.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

This dedicated database stores all CiviCRM-specific data, including contacts, contributions, events, and system settings. Separating CiviCRM data from WordPress data simplifies backups, updates, and troubleshooting procedures, particularly for large organizations with extensive constituent records.

Installing WordPress as the CMS Platform for CiviCRM

CiviCRM operates as a plugin within a content management system, with WordPress being one of the most popular choices due to its user-friendly interface and extensive ecosystem. This section covers downloading, configuring, and optimizing WordPress as the foundation for your CiviCRM installation.

Downloading and Extracting WordPress

Download the latest WordPress release to your server and extract it to the appropriate web directory:

cd /tmp
wget https://wordpress.org/latest.tar.gz
tar -xvzf latest.tar.gz
sudo mv wordpress /var/www/html/
sudo chown -R www-data:www-data /var/www/html/wordpress
sudo chmod -R 755 /var/www/html/wordpress

This process places WordPress files in the default Apache document root directory with appropriate permissions for web server access.

Setting Up WordPress Configuration

Create and configure the WordPress configuration file with the database details established earlier:

cd /var/www/html/wordpress
sudo cp wp-config-sample.php wp-config.php
sudo nano wp-config.php

Update the following database connection parameters:

define('DB_NAME', 'wordpressdb');
define('DB_USER', 'wpuser');
define('DB_PASSWORD', 'secure_password');
define('DB_HOST', 'localhost');

Also add these lines to enhance security:

define('AUTH_KEY',         'unique_value_here');
define('SECURE_AUTH_KEY',  'unique_value_here');
define('LOGGED_IN_KEY',    'unique_value_here');
define('NONCE_KEY',        'unique_value_here');
define('AUTH_SALT',        'unique_value_here');
define('SECURE_AUTH_SALT', 'unique_value_here');
define('LOGGED_IN_SALT',   'unique_value_here');
define('NONCE_SALT',       'unique_value_here');

Generate unique values for these security keys using the WordPress.org key generator to enhance your site’s security.

Configuring Apache Virtual Host for WordPress

Create an Apache virtual host configuration to serve your WordPress installation:

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

Add the following configuration, adjusting the ServerName to match your domain:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/wordpress
    ServerName your-domain.com
    ServerAlias www.your-domain.com

    <Directory /var/www/html/wordpress>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Enable the virtual host configuration and restart Apache:

sudo a2ensite wordpress.conf
sudo systemctl restart apache2

Complete the WordPress installation by accessing your server through a web browser and following the on-screen setup wizard to create an administrator account and configure basic site settings.

Installing CiviCRM on Ubuntu 24.04 LTS

With WordPress and the necessary database components in place, you can now proceed with the actual CiviCRM installation. This section covers downloading the CiviCRM files, placing them in the correct location, and running the installation process through the WordPress interface.

Downloading the Latest CiviCRM Release

Obtain the WordPress-compatible version of CiviCRM from the official repository:

cd /tmp
wget 

Always verify you have the most recent version by checking the official CiviCRM download page before proceeding. CiviCRM regularly releases updates that include security patches and new features essential for optimal system performance.

Extracting and Moving CiviCRM Files

Extract the downloaded CiviCRM archive and move it to the WordPress plugins directory:

unzip civicrm-5.41.2-wordpress.zip
sudo mv civicrm-5.41.2 /var/www/html/wordpress/wp-content/plugins/
sudo chown -R www-data:www-data /var/www/html/wordpress/wp-content/plugins/civicrm
sudo chmod -R 755 /var/www/html/wordpress/wp-content/plugins/civicrm

These commands ensure the CiviCRM files have the correct ownership and permissions for the web server to access and execute them properly during the installation process and subsequent operations.

Installing CiviCRM Through the WordPress Interface

Access your WordPress admin dashboard by navigating to http://your-domain.com/wp-admin/ and logging in with the administrator credentials you created during WordPress setup. Navigate to the Plugins section in the left sidebar and locate CiviCRM in the list of available plugins. Click “Activate” to enable CiviCRM within WordPress.

Install CiviCRM on Ubuntu 24.04

After activation, you’ll see a new “CiviCRM Installer” link in the WordPress admin menu. Click this link to begin the CiviCRM installation process. On the installer page, you’ll need to provide the CiviCRM database information:

  • Database Server: localhost
  • Database Name: civicrmdb
  • Database User: wpuser
  • Database Password: your_secure_password

Verify that all system requirements are met (indicated by green checkmarks), then click “Check Requirements and Install CiviCRM” to complete the installation. The installer creates the necessary database tables and configures CiviCRM to work with your WordPress installation.

Configuring Apache for Optimal CiviCRM Performance

Proper Apache configuration enhances CiviCRM’s performance, security, and reliability. This section covers essential Apache configurations tailored specifically for CiviCRM operations on Ubuntu 24.04 LTS.

Adjusting Apache Settings for CiviCRM

Create or modify the .htaccess file in your WordPress root directory to optimize Apache’s handling of CiviCRM requests:

sudo nano /var/www/html/wordpress/.htaccess

Add these configurations to improve performance and security:

# Increase PHP memory limit for CiviCRM operations
<IfModule mod_php.c>
    php_value memory_limit 256M
    php_value upload_max_filesize 64M
    php_value post_max_size 64M
    php_value max_execution_time 300
</IfModule>

# Enable URL rewriting
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
</IfModule>

# Protect sensitive CiviCRM files
<FilesMatch "(^\..*|\.log|\.po|\.sh|\.tpl|\.sql)$">
    Order allow,deny
    Deny from all
</FilesMatch>

These settings enhance CiviCRM’s performance by allocating sufficient resources for complex operations while also protecting sensitive files from unauthorized access.

Implementing SSL/TLS for Secure CiviCRM Access

Secure constituent data by implementing HTTPS for your CiviCRM installation. First, install Certbot to obtain and configure a free Let’s Encrypt SSL certificate:

sudo apt install certbot python3-certbot-apache -y
sudo certbot --apache -d your-domain.com -d www.your-domain.com

Follow the Certbot prompts to complete the SSL certificate setup process. Certbot automatically modifies your Apache configuration to redirect HTTP traffic to HTTPS and applies best-practice security settings for the SSL connection. This critical security measure ensures all data transmitted between users and your CiviCRM system remains encrypted and protected from interception.

Initial CiviCRM Configuration and Customization

After successful installation, configuring CiviCRM to match your organization’s specific needs is essential. This section covers navigating the CiviCRM interface, essential post-installation settings, and user permission configuration.

Navigating the CiviCRM Dashboard

Access the CiviCRM dashboard through your WordPress admin interface by clicking on the CiviCRM menu item in the WordPress admin bar. The dashboard provides a central location for managing all CiviCRM functions and accessing various modules. Take time to explore the primary sections, including:

  • Contacts: For managing individuals, organizations, and households
  • Contributions: For tracking donations and financial transactions
  • Events: For managing registration and participation
  • Mailings: For creating and tracking email communications
  • Reports: For generating insights on constituent engagement

Familiarizing yourself with the dashboard layout helps streamline your organization’s daily CRM operations by providing quick access to frequently used functions.

Essential Post-Installation Configuration Steps

Complete these critical configuration tasks to customize CiviCRM for your organization:

  1. Navigate to Administer > Administration Console > Configuration Checklist for a guided setup process.
  2. Configure Organization Information:
    – Set your organization’s name, address, and contact details
    – Upload your organization’s logo for branded communications
  3. Configure Localization Settings:
    – Set default country, language, and currency
    – Configure date and time formats appropriate for your region
  4. Set up Payment Processors:
    – Configure payment methods for donations and event registrations
    – Connect with services like PayPal, Stripe, or Authorize.net
  5. Configure Email Settings:
    – Set up outbound email for communications
    – Configure email templates for automated messages

These configurations establish the foundation for your organization’s CiviCRM implementation, enabling efficient constituent management aligned with your specific operational needs.

Setting Up User Permissions and Roles

Configure appropriate access controls to manage who can view and modify CiviCRM data. Navigate to Administer > Users and Permissions to configure role-based access:

  1. 1. Assess your organization’s workflow and identify distinct user roles (e.g., administrators, staff members, volunteers)
  2. Create custom permission sets for each role that align with their responsibilities
  3. Apply the principle of least privilege, granting users only the permissions necessary for their specific functions
  4. Implement specific permissions for sensitive operations like:
  • Accessing constituent financial information
  • Managing donation records
  • Viewing confidential contact notes
  • Sending mass communications

Properly configured permissions enhance both security and usability by providing users with access to the tools they need while protecting sensitive constituent data from unauthorized access or modification.

Advanced CiviCRM Configuration and Optimization

Beyond basic setup, several advanced configurations enhance CiviCRM’s functionality and security. This section covers email configuration, payment processing, and essential backup procedures to protect your constituent data.

Configuring Email Communication Settings

Configure CiviCRM’s email capabilities to enable effective constituent communications:

Navigate to Administer > System Settings > Outbound Email to set up your email delivery method. CiviCRM offers several options:

  1. Default mail: Uses the server’s built-in mail service
  2. SMTP: Connects to an external SMTP server for reliable delivery
  3. Sendmail: Uses the local sendmail program
  4. Disable Outbound Email: For testing environments

For production systems, SMTP generally provides the most reliable delivery. Configure your SMTP settings:

SMTP Server: mail.your-domain.com
SMTP Port: 587 (or as specified by your provider)
Authentication: Yes
Username: your-email-username
Password: your-email-password

Test the configuration by sending a test email before implementing mass communications. Proper email configuration ensures reliable delivery of newsletters, event notifications, and automated acknowledgments to your constituents.

Setting Up Payment Processors for Donations

Enable online donations and event payments by configuring payment processors:

Navigate to Administer > System Settings > Payment Processors to add and configure payment services compatible with your organization’s needs. For each payment processor:

  1. Select the payment processor type (e.g., PayPal, Stripe, Authorize.net)
  2. Enter your account credentials for that service
  3. Configure test mode settings for initial testing
  4. Set up appropriate transaction fees to ensure accurate accounting

After configuration, create a contribution page to test the payment process thoroughly before making it available to constituents. Properly configured payment processing streamlines donation collection and provides a professional experience for your supporters.

Implementing Regular Backup Procedures

Protect your valuable constituent data by establishing automated backup procedures:

Create a backup script that exports both your CiviCRM database and files:

#!/bin/bash
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
BACKUP_DIR="/path/to/backup/directory"

# Backup CiviCRM database
mysqldump -u wpuser -p'secure_password' civicrmdb > $BACKUP_DIR/civicrm_db_$TIMESTAMP.sql

# Backup WordPress database
mysqldump -u wpuser -p'secure_password' wordpressdb > $BACKUP_DIR/wordpress_db_$TIMESTAMP.sql

# Backup files
tar -czf $BACKUP_DIR/civicrm_files_$TIMESTAMP.tar.gz /var/www/html/wordpress

# Remove backups older than 30 days
find $BACKUP_DIR -type f -name "*.sql" -mtime +30 -delete
find $BACKUP_DIR -type f -name "*.tar.gz" -mtime +30 -delete

Save this script as /usr/local/bin/backup-civicrm.sh and make it executable:

sudo chmod +x /usr/local/bin/backup-civicrm.sh

Schedule automatic execution using cron:

sudo crontab -e

Add a line to run the backup daily at 2 AM:

0 2 * * * /usr/local/bin/backup-civicrm.sh

Regular backups protect against data loss due to system failures, accidental deletions, or other unforeseen events, ensuring your organization’s constituent data remains secure and recoverable.

Congratulations! You have successfully installed CiviCRM. Thanks for using this tutorial for installing CiviCRM constituent relationship management (CRM) on Ubuntu 24.04 LTS. For additional help or useful information, we recommend you check the official CiviCRM 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