Skip to content
Follow
CMS

How to Install Mautic with Apache on Ubuntu 24.04

Richard
Written by
Richard
Feb 15, 2025 Updated Sep 15, 2026 6 min read
How to Install Mautic with Apache on Ubuntu 24.04
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.

Advertisement

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.

⚡ Quick Answer

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`.

Advertisement

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.

🐧Bash / Shell
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.

🐧Bash / Shell
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.

Advertisement

http://localhost

Apache2 default landing page confirming successful web server installation on Ubuntu
Apache2 default landing page confirming successful web server installation on Ubuntu

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.

How to install Apache on Ubuntu

Advertisement

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.

🐧Bash / Shell
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.

Advertisement
🐧Bash / Shell
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.

🐧Bash / Shell
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.

💻Code
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.

Advertisement

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.

⚠️WarningAs part of the setup, we will create a mauticdb database and a user account called mauticdbuser.

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:

Advertisement

But first, log on to the MariaDB database server:

🐧Bash / Shell
sudo mariadb

Then run the commands below to complete the steps:

💻Code
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
⚠️WarningEnsure to replace ‘type_your_password_here ‘with your password.

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.

Advertisement

Then, run the commands below to install the latest PHP version.

🐧Bash / Shell
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

How to install PHP on Ubuntu Linux

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.

🐧Bash / Shell
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.

⬛Command Prompt
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.

🐧Bash / Shell
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.

🐧Bash / Shell
sudo nano /etc/apache2/sites-available/mautic.conf

Then, copy and paste the content block below into the Apache server block.

💻Code
<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.

🐧Bash / Shell
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.

💻Code
http://mautic.example.com

The Mautic installation wizard should appear.

Click Next to begin the installation.

Mautic installer wizard
Mautic installer wizard

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

Mautic installer wizard database info
Mautic installer wizard database info

Create an admin account and continue.

Mautic installer wizard admin
Mautic installer wizard admin

Mautic should be ready to use.

Mautic installer wizard complete
Mautic installer wizard complete

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?

Was this helpful?
Richard

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.

Advertisement

📚 Related Tutorials

How to Install Apache on Ubuntu Linux
Ubuntu Linux How to Install Apache on Ubuntu Linux
How to Install BoxBilling with Apache on Ubuntu Linux
Ubuntu Linux How to Install BoxBilling with Apache on Ubuntu Linux
How to Install KDE Desktop on Ubuntu 24.04
Ubuntu Linux How to Install KDE Desktop on Ubuntu 24.04
How to Install I-Doit on Ubuntu with Apache (Free IT Asset)
CMS How to Install I-Doit on Ubuntu with Apache (Free IT Asset)

2 Comments

  • Daniel Rold

    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

    Reply
  • Daniel Rold

    BTW doesnt work

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *