This guide installs a minimal Joomla stack with Apache, PHP, and MariaDB.
It supports Debian 10 to latest stable, Ubuntu LTS, and RHEL 9+ compatible systems.
- name: Install Joomla
hosts: joomla
become: true
vars:
joomla_version: "6.0.3"
joomla_webroot: /var/www/joomla
tasks:
- name: Install dependencies on Debian/Ubuntu
apt:
name:
- apache2
- mariadb-server
- php
- php-mysql
- php-xml
- php-mbstring
- php-curl
- php-zip
- php-gd
- php-intl
- php-mysqli
- unzip
- wget
- curl
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-xml
- php-mbstring
- php-curl
- php-zip
- php-gd
- php-intl
- unzip
- wget
state: present
when: ansible_os_family == "RedHat"
- name: Ensure web and database services are enabled and started
service:
name: "{{ item }}"
state: started
enabled: true
loop:
- "{{ 'apache2' if ansible_os_family == 'Debian' else 'httpd' }}"
- mariadb
- name: Create Joomla web root
file:
path: "{{ joomla_webroot }}"
state: directory
mode: "0755"
- name: Download Joomla release archive
get_url:
url: "https://downloads.joomla.org/cms/joomla{{ joomla_version | first }}/Joomla_{{ joomla_version }}-Stable-Full_Package.zip"
dest: /tmp/joomla.zip
mode: "0644"
- name: Extract Joomla
unarchive:
src: /tmp/joomla.zip
dest: "{{ joomla_webroot }}"
remote_src: true
- name: Set ownership for web root
file:
path: "{{ joomla_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 directory permissions
find:
paths: "{{ joomla_webroot }}"
type: directory
mode: "0755"
- name: Set file permissions
find:
paths: "{{ joomla_webroot }}"
type: file
mode: "0644"
Beyond this playbook, we offer:
Contact our automation team: office@linux-server-admin.com