This guide installs CiviCRM with Apache, PHP, MariaDB, and required PHP extensions.
It supports Debian 10 to latest stable, Ubuntu LTS, and RHEL 9+ compatible systems.
- name: Install CiviCRM
hosts: civicrm
become: true
vars:
civicrm_webroot: /var/www/civicrm
tasks:
- name: Install dependencies on Debian/Ubuntu
apt:
name:
- apache2
- mariadb-server
- php
- php-mysql
- php-curl
- php-xml
- php-mbstring
- php-zip
- php-intl
- php-gd
- composer
- unzip
- curl
- git
state: present
update_cache: true
when: ansible_os_family == "Debian"
- name: Install dependencies on RHEL family
dnf:
name:
- httpd
- mariadb-server
- php
- php-mysqlnd
- php-curl
- php-xml
- php-mbstring
- php-zip
- php-intl
- php-gd
- composer
- unzip
- curl
- git
state: present
when: ansible_os_family == "RedHat"
- name: Enable and start required services
service:
name: "{{ item }}"
state: started
enabled: true
loop:
- "{{ 'apache2' if ansible_os_family == 'Debian' else 'httpd' }}"
- mariadb
- name: Create CiviCRM web root
file:
path: "{{ civicrm_webroot }}"
state: directory
mode: "0755"
- name: Create CiviCRM project using Composer template
command: composer create-project civicoop/civicrm-composer-template {{ civicrm_webroot }}
args:
creates: "{{ civicrm_webroot }}/composer.json"
Any questions?
Feel free to contact us. Find all contact information on our contact page.