LinuxTutorialsUbuntu

How To Install CiviCRM on Ubuntu 18.04 LTS

Install CiviCRM on Ubuntu 18.04 LTS

In this tutorial, we will show you how to install CiviCRM on Ubuntu 18.04 LTS. For those of you who didn’t know, CiviCRM is an open-source constituent relationship management (CRM) specifically designed for the needs of non-profit, non-governmental, and advocacy groups. It is developed and maintained by a growing community of contributors and is designed to manage information about an organization’s members, event registrants, donors, subscribers, grant application seekers, funders, and case contacts. CiviCRM can be deployed in conjunction with either WordPress, Drupal, or Joomla to track contacts and their relationships to projects and initiatives.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of CiviCRM on a Ubuntu 18.04 (Bionic Beaver) server.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 18.04 (Bionic Beaver).
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install CiviCRM on Ubuntu 18.04 LTS Bionic Beaver

Step 1. First, make sure that all your system packages are up-to-date by running the following apt commands in the terminal.

sudo apt update
sudo apt upgrade

Step 2. Install LAMP (Linux, Apache, MariaDB, and PHP) server.

An Ubuntu 18.04 LAMP server is required. If you do not have LAMP installed, you can follow our guide here. Also, install all required PHP modules:

apt install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-mbstring php7.2-xmlrpc php7.2-soap php7.2-gd php7.2-xml php7.2-intl php7.2-mysql php7.2-cli php7.2-zip php7.2-curl

Also, install PHP Module “mcrypt”:

sudo apt install php-dev libmcrypt-dev
sudo pecl channel-update pecl.php.net
sudo pecl install mcrypt-1.0.1

Step 2. Installing WordPress on Ubuntu.

Download and extract the latest WordPress installation files in the document root directory of your WordPress website ( /var/www/html/yours-domain.com):

cd /opt/
wget https://wordpress.org/latest.zip
unzip latest.zip
mkdir -p /var/www/html/yours-domain.com
mv /opt/wordpress/* /var/www/html/yours-domain.com/
chown -R www-data:www-data /var/www/html/yours-domain.com
rm latest.zip

Then, create a Database for WordPress:

mysql -u root -p
MariaDB [(none)]> CREATE DATABASE wpdb;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON wpdb.* TO 'wpuser'@'localhost' IDENTIFIED BY 'Str0ngPa55w0rd';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit;

Step 5. Configuring Apache for WordPress.

Create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘wordpress.conf’ on your virtual server:

touch /etc/apache2/sites-available/wordpress.conf
ln -s /etc/apache2/sites-available/wordpress.conf /etc/apache2/sites-enabled/wordpress.conf
nano /etc/apache2/sites-available/wordpress.conf

Add the following lines:

<VirtualHost *:80>
ServerAdmin admin@your_domain_name.com
DocumentRoot /var/www/html/yours-domain.com/
ServerName your_domain_name.com

<Directory /var/www/html/yours-domain.com/>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>

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

Save and close the file. Restart the Apache service for the changes to take effect:

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

Step 4. Installing CiviCRM on Ubuntu.

Download the latest version of CiviCRM from the official page and extract it in the /var/www/html/yours-domain.com/wp-content/plugins/ directory on your server:

cd /opt
wget https://download.civicrm.org/civicrm-5.10.4-wordpress.zip
unzip civicrm-5.10.4-wordpress.zip
chown www-data:www-data -R /opt/civicrm/
mv /opt/civicrm/ /var/www/html/yours-domain.com/wp-content/plugins/

Then, create a Database for CiviCRM:

mysql -u root -p
MariaDB [(none)]> CREATE DATABASE civicrmdb;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON civicrmdb.* TO 'wpuser'@'localhost' IDENTIFIED BY 'civicrmStr0ngPa55w0rd';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit;

Next, go to the WordPress dashboard and click on the ‘CiviCRM Installer’ link at the top of the page. From there, change the database name, verify that all requirements are met, and install CiviCRM:

Install CiviCRM on Ubuntu 18.04 LTS

That is it. CiviCRM has been installed on your server. You can now configure and extend CiviCRM according to your needs.

Congratulations! You have successfully installed CiviCRM. Thanks for using this tutorial for installing CiviCRM constituent relationship management (CRM) on Ubuntu 18.04. 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