How To Install Mautic on AlmaLinux 9
In today’s digital marketing landscape, having a robust marketing automation platform is essential for businesses looking to streamline their marketing efforts. Mautic stands out as a powerful open-source alternative to costly proprietary solutions, offering features like email marketing, lead management, campaign automation, and detailed analytics. When paired with AlmaLinux 9, a stable and reliable RHEL fork, you get a cost-effective and high-performance marketing automation setup.
This comprehensive guide will walk you through the entire process of installing Mautic on AlmaLinux 9, from preparing your server environment to post-installation configuration and troubleshooting. By the end, you’ll have a fully functional Mautic installation ready to power your marketing campaigns.
Prerequisites
Before diving into the installation process, ensure your system meets the following requirements:
System Requirements:
- A server with AlmaLinux 9 installed
- Minimum 10GB of disk space (15GB+ recommended)
- At least 4GB RAM (8GB+ recommended for optimal performance)
- A registered domain name pointing to your server
- Root or sudo access to your server
Knowledge Requirements:
- Basic Linux command line skills
- Fundamental understanding of web servers and databases
- Basic networking concepts
Installation time will vary depending on your system specifications and internet connection speed, but typically takes 30-45 minutes to complete.
Installing AlmaLinux 9
If you already have AlmaLinux 9 installed, you can skip this section. Otherwise, follow these steps to install AlmaLinux 9.
Downloading AlmaLinux 9 ISO
- Visit the official AlmaLinux website and download the appropriate ISO file.
- AlmaLinux offers several ISO types:
- Boot ISO: For minimal network-based installations
- Minimal ISO: For basic server setups
- DVD ISO: For complete installation options
- Download the ISO that best suits your needs using a direct download or torrent.
Creating Bootable Media
- For USB installation:
sudo dd if=AlmaLinux-9.0-x86_64-dvd.iso of=/dev/sdX bs=8M status=progress
(Replace /dev/sdX with your actual USB device path)
- For virtual environments, simply mount the ISO file as a virtual DVD drive.
Installation Process
- Boot your system from the installation media.
- Select “Install AlmaLinux 9” from the boot menu.
- Choose your language and keyboard layout.
- Configure installation destination:
- Select your storage device
- Choose automatic partitioning or customize it
- Configure network and hostname:
Hostname: mautic.yourdomain.com
- Create a root password and admin user.
- Complete the installation and reboot.
- After reboot, log in with your credentials.
Preparing the Server Environment
With AlmaLinux 9 installed, we need to prepare the environment for Mautic installation by setting up the necessary components.
System Updates
First, ensure your system is up to date:
sudo dnf update -y
Installing Required Packages
Mautic 5.x requires PHP 8.1 or newer, MariaDB/MySQL, and a web server like Apache. Let’s install these components.
- Install EPEL and Remi Repositories:
sudo dnf install epel-release -y sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm -y
- Install Apache Web Server:
sudo dnf install httpd -y sudo systemctl enable httpd sudo systemctl start httpd
- Install PHP 8.2 and Extensions:
sudo dnf module reset php -y sudo dnf module enable php:remi-8.2 -y sudo dnf install php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mbstring php-curl php-xml php-pear php-bcmath php-json php-intl php-opcache -y
- Install MariaDB:
sudo dnf install mariadb-server -y sudo systemctl enable mariadb sudo systemctl start mariadb
- Install Additional Utilities:
sudo dnf install unzip wget git -y
These packages provide the foundation for running Mautic efficiently on AlmaLinux 9.
Firewall Configuration
Configure the firewall to allow HTTP, HTTPS, and SSH connections:
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --reload
This ensures your Mautic installation will be accessible via web browsers while maintaining basic security.
Database Setup
A properly configured database is critical for Mautic’s performance and security.
Installing and Securing MariaDB
If you haven’t already secured your MariaDB installation:
sudo mysql_secure_installation
Follow the prompts to:
- Set a root password
- Remove anonymous users
- Disallow root login remotely
- Remove the test database
- Reload privileges
Creating Mautic Database
- Log in to MariaDB:
sudo mysql -u root -p
- Create a database and user for Mautic:
CREATE DATABASE mautic CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'mauticuser'@'localhost' IDENTIFIED BY 'secure_password'; GRANT ALL PRIVILEGES ON mautic.* TO 'mauticuser'@'localhost'; FLUSH PRIVILEGES; EXIT;
Replace ‘secure_password’ with a strong password. This configuration ensures proper character set support for international content.
Optimizing MariaDB for Mautic
For optimal performance, edit the MariaDB configuration:
sudo nano /etc/my.cnf.d/server.cnf
Add these settings under the [mysqld] section:
innodb_buffer_pool_size = 1G
max_allowed_packet = 64M
join_buffer_size = 2M
Save and restart MariaDB:
sudo systemctl restart mariadb
These settings improve performance for Mautic’s database operations with large datasets.
Web Server Configuration
Apache needs to be properly configured to serve Mautic efficiently and securely.
Apache Setup and Optimization
- Create a virtual host configuration for Mautic:
sudo nano /etc/httpd/conf.d/mautic.conf
- Add the following configuration:
<VirtualHost *:80> ServerAdmin webmaster@yourdomain.com DocumentRoot /var/www/html/mautic ServerName mautic.yourdomain.com <Directory /var/www/html/mautic> Options -Indexes +FollowSymLinks AllowOverride All Require all granted </Directory> ErrorLog /var/log/httpd/mautic_error.log CustomLog /var/log/httpd/mautic_access.log combined </VirtualHost>
- Save and check the configuration:
sudo apachectl configtest
- If the test passes, restart Apache:
sudo systemctl restart httpd
HTTPS Setup with Let’s Encrypt
Secure your Mautic installation with HTTPS:
- Install Certbot:
sudo dnf install certbot python3-certbot-apache -y
- Obtain and configure SSL certificate:
sudo certbot --apache -d mautic.yourdomain.com
- Follow the prompts to complete the certificate installation and configure automatic renewal.
This setup ensures secure communications between users and your Mautic installation.
PHP Configuration
Optimize PHP for Mautic:
- Edit the PHP configuration:
sudo nano /etc/php.ini
- Update the following values:
memory_limit = 512M upload_max_filesize = 100M post_max_size = 100M max_execution_time = 300 max_input_time = 300
- Save and restart PHP-FPM:
sudo systemctl restart php-fpm
These settings ensure PHP can handle Mautic’s resource requirements efficiently.
Installing Mautic
Now let’s install Mautic itself.
Downloading Mautic
- Change to the web directory:
cd /var/www/html
- Download the latest Mautic release:
sudo wget https://github.com/mautic/mautic/releases/download/6.0.1/6.0.1.zip
- Extract the files:
sudo unzip 6.0.1.zip sudo mv mautic-6.0.1 mautic
- Remove the zip file:
sudo rm 6.0.1.zip
Setting Correct File Permissions
Proper file permissions are essential for security and functionality:
sudo chown -R apache:apache /var/www/html/mautic
sudo chmod -R 755 /var/www/html/mautic
This ensures the web server can read and write to the necessary files while maintaining security.
Running the Mautic Installer
With all components in place, you can now run the Mautic web installer.
Accessing the Web Installer
- Open your web browser and navigate to your domain (
https://mautic.yourdomain.com
). - The Mautic installer will automatically start and check your system requirements.
- If any requirements are not met, you’ll need to address them before continuing.
Database Configuration
- On the database setup screen, enter your database details:
- Database Driver: MySQL PDO
- Database Host: localhost
- Database Name: mautic
- Database User: mauticuser
- Database Password: your_secure_password
- Database Port: 3306 (default)
- Choose whether to backup existing tables (not necessary for new installations).
- Click “Next Step” to proceed.
Creating Admin Account
- Create your administrator account:
- Username: Choose a username
- Password: Create a strong password
- Email: Enter your email address
- First Name: Enter your first name
- Last Name: Enter your last name
- Click “Next Step” to continue.
Initial Configuration
- Configure your email settings:
- From Name: Your organization name
- From Email: A valid email address
- Email Transport: Choose based on your email setup
- Set your site URL and locale settings.
- Complete the installation process.
You should now see the Mautic login screen where you can access your new installation.
Post-Installation Configuration
After installing Mautic, several additional configurations are necessary for optimal performance.
Setting Up Cron Jobs
Mautic requires scheduled tasks to function properly:
sudo crontab -e
Add these cron jobs:
# Mautic cron jobs
10,40 * * * * php /var/www/html/mautic/bin/console mautic:segments:update
15,45 * * * * php /var/www/html/mautic/bin/console mautic:campaigns:update
20,50 * * * * php /var/www/html/mautic/bin/console mautic:campaigns:trigger
*/5 * * * * php /var/www/html/mautic/bin/console mautic:emails:send
*/5 * * * * php /var/www/html/mautic/bin/console mautic:import:process
These jobs ensure that segments are updated, campaigns are processed, and emails are sent automatically.
Email Configuration
Configure email sending for your Mautic installation:
- Log in to Mautic admin panel
- Navigate to Configuration → Email Settings
- Configure your preferred mail transport:
- SMTP for reliable delivery
- Mail for simple setups
- API-based services like SendGrid or Mailgun
- Test email delivery to ensure proper configuration
Proper email configuration is essential for marketing campaigns and system notifications.
Performance Optimization
To improve Mautic’s performance:
- Enable cache:
php /var/www/html/mautic/bin/console cache:clear php /var/www/html/mautic/bin/console mautic:assets:generate
- Optimize database queries:
php /var/www/html/mautic/bin/console doctrine:schema:update --dump-sql
- Consider implementing a Redis cache for larger installations:
sudo dnf install redis -y sudo systemctl enable redis sudo systemctl start redis
These optimizations will help maintain good performance as your contact database grows.
Troubleshooting Common Installation Issues
Even with careful installation, issues may arise. Here are solutions to common problems.
Permission Problems
If you encounter permission errors:
sudo find /var/www/html/mautic -type d -exec chmod 755 {} \;
sudo find /var/www/html/mautic -type f -exec chmod 644 {} \;
sudo chown -R apache:apache /var/www/html/mautic
This ensures proper ownership and permissions for all Mautic files.
Database Connection Issues
For database connection problems:
- Verify your database credentials in
/var/www/html/mautic/app/config/local.php
- Test the connection manually:
mysql -u mauticuser -p -h localhost mautic
- Check MariaDB status:
sudo systemctl status mariadb
Database connection issues are often related to incorrect credentials or database server problems.
Web Server Configuration Problems
For Apache configuration issues:
- Check Apache error logs:
sudo tail -f /var/log/httpd/error_log
- Verify that mod_rewrite is enabled:
sudo apachectl -M | grep rewrite
- Test Apache configuration:
sudo apachectl configtest
Most web server issues are related to incorrect virtual host configuration or missing Apache modules.
Mautic-Specific Errors
For 500 Internal Server errors or other Mautic-specific issues:
- Check Mautic logs:
tail -f /var/www/html/mautic/var/logs/mautic_prod.log
- Clear Mautic cache:
rm -rf /var/www/html/mautic/var/cache/*
- Update database schema:
php /var/www/html/mautic/bin/console doctrine:schema:update --force
These steps resolve many common Mautic errors related to caching and database structure.
Security Hardening
Protecting your Mautic installation is crucial for data security and compliance.
Basic Security Measures
- Implement strong file permissions:
sudo find /var/www/html/mautic -type f -exec chmod 644 {} \; sudo find /var/www/html/mautic -type d -exec chmod 755 {} \; sudo chmod -R 775 /var/www/html/mautic/var/cache sudo chmod -R 775 /var/www/html/mautic/var/logs
- Protect sensitive directories:
sudo nano /var/www/html/mautic/.htaccess
Add:
# Deny access to sensitive directories RedirectMatch 403 ^/app/ RedirectMatch 403 ^/vendor/
- Restrict admin access using IP-based rules in your virtual host configuration.
Regular Updates Process
Keep your system secure with regular updates:
- Create a backup before updating:
sudo cp -r /var/www/html/mautic /var/www/html/mautic_backup mysqldump -u mauticuser -p mautic > mautic_backup.sql
- Update AlmaLinux:
sudo dnf update -y
- Update Mautic following the official documentation for your specific version.
Regular updates ensure you have the latest security patches and features.
Alternative Installation Methods
Besides the manual installation method described above, there are other options for installing Mautic.
Using Pre-configured Images
Several cloud providers offer pre-configured Mautic images:
- AWS Marketplace has Mautic images from providers like Elyxia Global
- Digital Ocean offers one-click Mautic applications
- Bitnami provides Mautic stacks for various cloud platforms
These options simplify deployment but may limit customization options.
Command Line Installation
For advanced users, Mautic can be installed via command line:
php /var/www/html/mautic/bin/console mautic:install \
--db_driver="pdo_mysql" \
--db_host="localhost" \
--db_port="3306" \
--db_name="mautic" \
--db_user="mauticuser" \
--db_password="secure_password" \
--db_backup_tables="false" \
--admin_email="admin@example.com" \
--admin_password="secure_admin_password" \
--mailer_from_name="Your Company" \
--mailer_from_email="marketing@example.com"
This approach is ideal for automated deployments and scripted installations.
Congratulations! You have successfully installed Mautic. Thanks for using this tutorial for installing Mautic digital marketing tool on AlmaLinux 9 system. For additional help or useful information, we recommend you check the official Mautic website.