This guide installs a Vtiger CRM stack with Apache, PHP, and MariaDB.
It supports Debian 10 to latest stable, Ubuntu LTS, and RHEL 9+ compatible systems.
- name: Install Vtiger CRM
hosts: vtiger-crm
become: true
vars:
vtiger_webroot: /var/www/vtigercrm
vtiger_version: "9.0.0"
vtiger_db_name: vtiger
vtiger_db_user: vtiger
vtiger_db_password: "change-me-secure-password"
tasks:
- name: Install dependencies on Debian/Ubuntu
apt:
name:
- apache2
- mariadb-server
- php
- php-mysql
- php-mbstring
- php-xml
- php-curl
- php-zip
- php-gd
- php-intl
- php-cli
- unzip
- wget
- 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-mbstring
- php-xml
- php-curl
- php-zip
- php-gd
- php-intl
- php-cli
- unzip
- wget
- 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 Vtiger database
mysql_db:
name: "{{ vtiger_db_name }}"
state: present
encoding: utf8mb4
collation: utf8mb4_unicode_ci
when: ansible_os_family == "Debian"
- name: Create Vtiger database user
mysql_user:
name: "{{ vtiger_db_user }}"
password: "{{ vtiger_db_password }}"
priv: "{{ vtiger_db_name }}.*:ALL"
host: localhost
state: present
when: ansible_os_family == "Debian"
- name: Create Vtiger web root
file:
path: "{{ vtiger_webroot }}"
state: directory
mode: "0755"
- name: Download Vtiger CRM archive
get_url:
url: "https://sourceforge.net/projects/vtigercrm/files/vtiger%20CRM/{{ vtiger_version }}/vtigercrm-{{ vtiger_version }}.zip"
dest: /tmp/vtigercrm.zip
mode: "0644"
- name: Extract Vtiger CRM
unarchive:
src: /tmp/vtigercrm.zip
dest: "{{ vtiger_webroot }}"
remote_src: true
- name: Set ownership for web root
file:
path: "{{ vtiger_webroot }}"
state: directory
recurse: true
owner: "{{ 'www-data' if ansible_os_family == 'Debian' else 'apache' }}"
group: "{{ 'www-data' if ansible_os_family == 'Debian' else 'apache' }}"
- name: Set permissions for web root
file:
path: "{{ vtiger_webroot }}"
state: directory
recurse: true
mode: "0755"
- name: Create Apache virtual host
copy:
dest: /etc/apache2/sites-available/vtigercrm.conf
mode: "0644"
content: |
<VirtualHost *:80>
ServerName vtiger.example.com
DocumentRoot {{ vtiger_webroot }}
<Directory {{ vtiger_webroot }}>
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/vtigercrm_error.log
CustomLog ${APACHE_LOG_DIR}/vtigercrm_access.log combined
</VirtualHost>
when: ansible_os_family == "Debian"
notify: restart apache
- name: Enable virtual host
command: a2ensite vtigercrm
args:
creates: /etc/apache2/sites-enabled/vtigercrm.conf
when: ansible_os_family == "Debian"
notify: restart apache
handlers:
- name: restart apache
service:
name: "{{ 'apache2' if ansible_os_family == 'Debian' else 'httpd' }}"
state: restarted
vtiger_version variable to install the latest available version.Any questions?
Feel free to contact us. Find all contact information on our contact page.