How to Install Mautic with Apache on Ubuntu 24.04
Hosting Mautic version 5.x on Ubuntu 24.04 with the Apache web server gives you a free platform to run marketing campaigns, send automated emails, and manage customer contacts on your own hardware. Mautic is open-source marketing automation software that tracks leads and builds landing pages, while Apache acts as the program that serves those pages to visitors over the internet.
Setting up this server stack requires root access, PHP version 8.1 or newer, and a database like MySQL. Running the software yourself keeps your marketing data entirely private and under your control without monthly subscription fees.
Install Apache using `sudo apt install apache2`, then install MariaDB with `sudo apt install mariadb-server`. Create a Mautic database and user in MariaDB, and finally install PHP with `sudo apt install php libapache2-mod-php php-mysql`.
Install Apache HTTP server on Ubuntu
To install Apache on Ubuntu 24.04 for your Mautic setup, open your terminal and update your package list. Run the command sudo apt install apache2 to download and set up the Apache HTTP server software. This web server makes your Mautic application available online so visitors can load your pages.
To do that, open the Ubuntu terminal and run the commands below to install the Apache web server.
sudo apt update
sudo apt install apache2
Once Apache is installed, the commands below can start, stop, and enable the Apache web server to start automatically when your server boots up.
sudo systemctl stop apache2
sudo systemctl start apache2
sudo systemctl enable apache2
You can test that the Apache web server is running by opening your web browser and browsing to the server’s localhost or IP address.
http://localhost

When you see the Apache2 Default Page, it means the Apache HTTP server is successfully installed.
Additional help on installing Apache on Ubuntu is in the link below.
Install the MariaDB database server on Ubuntu
To install the MariaDB database server on Ubuntu 24.04, open your terminal and run the standard package installation commands. MariaDB securely stores all your Mautic contact lists, campaign details, and application data in a dedicated database on your server.
To install and use the MariaDB database server, use the instructions below.
Open the Ubuntu terminal and run the commands below to install the MariaDB database server.
sudo apt update sudo apt install mariadb-server
Once the MariaDB database server is installed, use the commands below to stop, start, and enable the MariaDB server to start automatically when the server boots.
sudo systemctl stop mariadb sudo systemctl start mariadb sudo systemctl enable mariadb
Run the following commands to validate and test if the MariaDB database server is installed successfully.
sudo mariadb
Once you run the commands above, it will log you onto the MariaDB console and display a message similar to the one below.
Welcome to the MariaDB monitor. Commands end with ; or g. Your MariaDB connection id is 32 Server version: 10.11.2-MariaDB-1 Ubuntu 23.04 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. MariaDB [(none)]>
The message tells you that the server is installed successfully.
Additional help on installing MariaDB.
- How to install MariaDB on Ubuntu Linux
- MariaDB without password prompt
Create a Mautic database
To create a Mautic database and user, log into your MariaDB prompt and run SQL commands to set up a dedicated database named mauticdb along with a user called mauticdbuser. Giving this user full permissions ensures Mautic can read and write its data correctly.
The `mauticdbuser` account receives full access to the `mauticdb` database, which allows Mautic to manage its data. This specific database access is crucial for Mautic's operational functions after Mautic installation on Ubuntu 24.04.
All the database steps above can be done using the commands below:
But first, log on to the MariaDB database server:
sudo mariadb
Then run the commands below to complete the steps:
CREATE DATABASE mauticdb CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER mauticdbuser@localhost IDENTIFIED BY 'type_your_password_here';
GRANT ALL ON mauticdb.* TO mauticdbuser@localhost WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit
Install PHP on Ubuntu Linux
To install PHP on Ubuntu 24.04 for your Mautic installation, run the package manager command in your terminal to get PHP and all required extensions. Mautic relies on PHP and these specific modules to run its code and process your marketing campaigns properly.
Then, run the commands below to install the latest PHP version.
sudo apt install php libapache2-mod-php php-intl php-mysql php-curl php-cli php-zip php-xml php-gd php-common php-mbstring php-xmlrpc php-bcmath php-json php-sqlite3 php-soap php-zip php-ldap php-imap php-redis
Additional help on installing PHP
Download Mautic files
To download Mautic files onto your Ubuntu 24.04 server, use Git and Composer to fetch the official source code package. Installing these developer tools and running their download commands places the application files in your web directory, ready for the web installer.
First, install Composer, git, and curl packages by running the command below.
sudo apt install git curl
sudo curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/bin --filename=composer
Then, run the commands below to install Composer and use it to download Mautic content.
cd /var/www/
sudo git clone https://github.com/mautic/mautic.git
sudo chown -R www-data:www-data /var/www/mautic/
cd mautic
sudo -u www-data composer install
If the steps above fail because npm is missing, run the command below to install it, then rerun the Composer install command.
sudo apt-get install npm
sudo mkdir /var/www/.npm
sudo chown -R 33:33 /var/www/.npm
Once you have completed all the above steps, continue configuring the Apache web server below to serve the Mautic content.
Run the commands below to create an Apache virtual host file for Mautic.
sudo nano /etc/apache2/sites-available/mautic.conf
Then, copy and paste the content block below into the Apache server block.
<VirtualHost *:80>
ServerName mautic.example.com
ServerAdmin admin@example.com
DocumentRoot /var/www/mautic
<Directory /var/www/mautic/>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Save the file.
You can enable the Apache virtual host by running `sudo a2ensite mautic.conf` and restart the Apache server with `sudo systemctl restart apache2`. This action makes Mautic accessible on your server.
sudo a2ensite mautic.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
Setup Let’s Encrypt SSL/TLS for Mautic
To set up Let's Encrypt SSL/TLS for Mautic on Ubuntu 24.04, install Certbot and configure your Apache web server to force secure HTTPS connections. This encrypts traffic between your visitors and your server, protecting sensitive contact and campaign data.
Please read the post below for additional resources on installing and creating Let’s Encrypt SSL certificates for Apache.
How to set up Let’s Encrypt SSL certificate for Apache on Ubuntu Linux
Once you have restarted the Apache web server, open your browser and browse to the server hostname or IP address defined in the Apache server block.
http://mautic.example.com
The Mautic installation wizard should appear.
Click Next to begin the installation.

Type in the database name and password, then click Next.

Create an admin account and continue.

Mautic should be ready to use.

That should do it!
Conclusion:
- Installing Mautic with Apache on Ubuntu 24.04 gives businesses a powerful open-source marketing automation tool.
- Integrating Apache, MariaDB, and PHP creates a robust marketing campaign management environment.
- Key steps include:
- Setting up the Apache web server and configuring it to serve Mautic.
- Installing the MariaDB database and creating a designated database for Mautic.
- Installing PHP and its necessary extensions to support Mautic's functionalities.
- Downloading Mautic files and configuring virtual host settings for seamless operation.
- Securing your installation with SSL/TLS using Let’s Encrypt for enhanced security.
- Following the installation wizard ensures you can set up your Mautic account quickly and efficiently.
- With Mautic up and running, you can engage with your audience more effectively and manage your marketing strategies in a more controlled environment.
Was this guide helpful?
About the Author
Richard
Tech Writer, IT Professional
Richard is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.
I dont think computer programmers are actual real people. You are NPC the simulation runs you. you are the ONLY profession in the world who gets paid well to do NOTHING that ever works.
On the other page ur autheticator doesn’t even work. U are computer programmers cant make your own website work
Mautic isn’t designed to work. its NPC candy for dummies
BTW doesnt work