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 through the step by step installation CiviCRM on a Ubuntu 18.04 (Bionic Beaver) server.
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 these following apt commands in the terminal.
1 2 | sudoaptupdate sudoaptupgrade |
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:
1 | aptinstallphp7.2libapache2-mod-php7.2php7.2-commonphp7.2-mbstringphp7.2-xmlrpcphp7.2-soapphp7.2-gdphp7.2-xmlphp7.2-intlphp7.2-mysqlphp7.2-cliphp7.2-zipphp7.2-curl |
Also, install PHP Module “mcrypt”:
1 2 3 | sudoaptinstallphp-devlibmcrypt-dev sudopeclchannel-updatepecl.php.net sudopeclinstallmcrypt-1.0.1 |
Download and extract the latest WordPress installation files in the document root directory of your WordPress website ( /var/www/html/yours-domain.com):
1 2 3 4 5 6 7 | cd/opt/ wgethttps://wordpress.org/latest.zip unziplatest.zip mkdir-p/var/www/html/yours-domain.com mv/opt/wordpress/*/var/www/html/yours-domain.com/ chown-Rwww-data:www-data/var/www/html/yours-domain.com rmlatest.zip |
Then, create a Database for WordPress:
1 | mysql-uroot-p |
1 2 3 4 | MariaDB[(none)]>CREATEDATABASEwpdb; MariaDB[(none)]>GRANTALLPRIVILEGESONwpdb.*TO'wpuser'@'localhost'IDENTIFIEDBY'Str0ngPa55w0rd'; MariaDB[(none)]>FLUSHPRIVILEGES; MariaDB[(none)]>exit; |
Create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘wordpress.conf’ on your virtual server:
1 2 3 | 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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <VirtualHost *:80> ServerAdminadmin@your_domain_name.com DocumentRoot/var/www/html/yours-domain.com/ ServerNameyour_domain_name.com <Directory/var/www/html/yours-domain.com/> OptionsFollowSymlinks AllowOverrideAll Requireallgranted </Directory> ErrorLog${APACHE_LOG_DIR}/error.log CustomLog${APACHE_LOG_DIR}/access.logcombined </VirtualHost> |
Save and close the file. Restart the Apache service for the changes to take effect:
1 2 3 | sudoa2ensitewordpress.conf sudoa2enmodrewrite sudosystemctlrestartapache2 |
Download the latest version of CiviCRM from https://civicrm.org/download and extract it in the /var/www/html/yours-domain.com/wp-content/plugins/ directory on your server:
1 2 3 4 5 | cd/opt wgethttps://download.civicrm.org/civicrm-5.10.4-wordpress.zip unzipcivicrm-5.10.4-wordpress.zip chownwww-data:www-data-R/opt/civicrm/ mv/opt/civicrm//var/www/html/yours-domain.com/wp-content/plugins/ |
Then, create a Database for CiviCRM:
1 | mysql-uroot-p |
1 2 3 4 | MariaDB[(none)]>CREATEDATABASEcivicrmdb; MariaDB[(none)]>GRANTALLPRIVILEGESONcivicrmdb.*TO'wpuser'@'localhost'IDENTIFIEDBY'civicrmStr0ngPa55w0rd'; MariaDB[(none)]>FLUSHPRIVILEGES; 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:
That is it. CiviCRM has been installed on your server. You can now configure and extend CiviCRM according to your needs.
Congratulation’s! 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 to check the official CiviCRM website.