How to Install Mailu on Ubuntu 22.04

Mailu is an open-source mail server solution that offers a comprehensive and user-friendly interface for managing email services. Built on reliable mail server components such as Postfix, Dovecot, and Roundcube, Mailu simplifies the process of setting up and managing a mail server with its intuitive web-based administration panel.

With Mailu, you can establish a robust mail server supporting SMTP, IMAP, and POP3 protocols, along with webmail access via Roundcube. It provides essential features like spam filtering, antivirus scanning, and the capability to handle multiple domains and mailboxes, ensuring a secure and efficient email experience.

Mailu is designed for ease of installation and configuration, making it an excellent choice for individuals and organizations aiming to deploy their own mail servers without requiring extensive technical knowledge.

>>How to Install iRedMail on Ubuntu 20.04

Benefits of Building Mailu Mail Server

Building a Mailu mail server offers several significant benefits. One of the primary advantages is its simplicity and ease of use. Mailu provides a user-friendly web interface that streamlines the management of the mail server, making it accessible even to users with limited technical expertise. This allows for easy configuration and management of email services, domains, and mailboxes.

Another substantial benefit is the comprehensive feature set that Mailu offers. It includes all the essential components for a robust mail server, such as SMTP, IMAP, and POP3 protocols, spam filtering, antivirus scanning, and support for multiple domains. Additionally, Mailu integrates Roundcube, a full-featured webmail client, providing users with a seamless and efficient email experience.

Security is also a key focus of Mailu. The suite comes with built-in security features such as SSL/TLS encryption for email transmission, ensuring that your email communication remains private and secure. Furthermore, Mailu regularly receives updates and patches, helping to protect your mail server against the latest security vulnerabilities.

Scalability is another advantage of using Mailu. Whether you’re a small business or a large organization, Mailu can accommodate your needs. It supports the creation of multiple mailboxes and domains, allowing you to expand your email infrastructure as your organization grows.

Overall, Mailu offers a powerful, secure, and scalable mail server solution that simplifies the management of email services, making it an excellent choice for both individuals and organizations.

>>How to Install MailCow on Ubuntu 22.04

Requirements for Setting Up Mailu Server

To set up a Mailu server, you need the following prerequisites:

  1. Domain Name: A domain name to configure DNS records for your mail server and enable email sending.
  2. Server: A dedicated server or virtual private server (VPS) with a fresh, minimal installation of Ubuntu or any other Linux distribution that is compatible with Mailu. The server should have at least 4GB of RAM and sufficient storage capacity based on your anticipated email usage, considering the volume of emails, size of attachments, and retention duration.
  3. Port 25: Port 25 must be open, and the server should have an IP address with a good reputation to ensure that emails are delivered directly to the recipient’s primary inbox.

Choosing the right server for your Mailu installation is crucial for optimal email deliverability and server performance. Here are my recommendations that not only meet the necessary requirements but also come with exciting offers to make your journey more budget-friendly:

  • Contabo: Known for their excellent VPS and dedicated server offerings, Contabo is a great choice for hosting your Mailu server. With their current offer, you can save on the setup fee, making it an economical choice for getting started. Their servers are well-reputed for good IP reputation, which can enhance your email deliverability. Sign up for Contabo and save the setup fee.
  • OVH: A global, hyper-scale cloud provider, OVH offers a wide range of robust and secure server options. Their current deal lets you get up to 50% off on selected services, making it a cost-effective choice for small to medium-sized businesses. OVH’s servers are known for their reliability and solid IP reputation. [https://bit.ly/ovh50off]Get started with OVH and enjoy up to 50% off.
  • OpenPort25: Specializing in email infrastructure, OpenPort25 provides servers optimized for SMTP with excellent deliverability and support for bulk email sending. Their current promotion offers a discount on their SMTP-optimized servers, making it a great choice for your Mailu setup. Sign up for OpenPort25 and take advantage of the discount.

Each of these providers offers a solid foundation for your Mailu server. Remember, a good server provider with a reputable IP is key to ensuring your emails land straight in the primary inbox. So, take advantage of these offers and set up your Mailu server today!

The above are affiliate links. If you click through and make a purchase, I may receive a commission at no additional cost to you. I only recommend products I trust and would use myself.

>>How to Install Postal Mail Server on Ubuntu 20.04

Manage Reverse DNS

To update your Reverse DNS (rDNS), begin by accessing your server provider’s control panel with your login credentials. Locate the server for which you wish to configure the Reverse DNS. Navigate to the section labeled ‘Network’ or ‘DNS’ settings. Here, you should find an option to modify your Reverse DNS. Enter the desired hostname that corresponds to your server’s IP address, making sure that this hostname resolves back to the server’s IP address in your DNS records. After inputting the hostname, save your modifications. Keep in mind that the propagation of these changes across the internet might take some time.

Add DNS Records

To update your DNS records, first, log into your account with your domain registrar. From the sidebar, select ‘Domain List’ and then click on the ‘Manage’ button next to your domain name. Proceed to the ‘Advanced DNS’ tab, where you’ll find options to manage DNS records. To add a new A record, click on the ‘Add New Record’ button. Choose ‘A Record’ from the dropdown menu, and enter your hostname in the ‘Host’ field and your server’s IP address in the ‘Value’ field. After completing these steps, click on the green checkmark to confirm your changes. Keep in mind that it may take some time for DNS changes to propagate globally.

Type Host Value
A mail Your Server’s IP address

Update MX Record

To update your MX record, start by logging into your domain registrar’s account. Navigate to the ‘Domain List’ from the sidebar and click on the ‘Manage’ button next to your domain name. Then, head over to the ‘Advanced DNS’ tab, where you will see options for managing DNS records. To add a new MX record, click on the ‘Add New Record’ button. Select ‘MX Record’ from the dropdown menu, and enter ‘@’ in the ‘Host’ field and ‘mail.yourdomain.extension’ in the ‘Value’ field. Set the priority to ’10’ in the ‘Priority’ field. Once you’ve completed these steps, click on the green checkmark to save your changes. Remember, DNS changes may take some time to propagate worldwide.

Type Host Value Priority
MX @ mail.yourdomain.extension 10

Change Hostname

To ensure that your server is properly identified on the network, it’s important to set its hostname to a Fully Qualified Domain Name (FQDN) that accurately reflects your domain structure. You can check the current hostname of your server using the following command:

hostname -f

This command displays the current FQDN of your server. If the displayed hostname does not match your desired domain name, you need to update it using the following syntax:

hostnamectl set-hostname yourhostname.yourdomain.extension

Replace ‘yourhostname.yourdomain.extension’ with the desired FQDN for your server. For example, in my setup, I used the following command to set the hostname to mail.technicalsahil.com:

hostnamectl set-hostname mail.technicalsahil.live

Administrative rights (typically root access) are required to modify the hostname. If your server does not have root access by default (e.g., servers from OVHcloud, AWS, etc.), you will need to enable root access before proceeding.

>>How to Enable Root Access on Ubuntu?

After updating the hostname, you can run the ‘hostname -f’ command again to verify that your changes have been successfully applied.

Update System Packages

To keep your system secure and up-to-date, it’s essential to update the package list and upgrade the installed packages. Execute the following command in your terminal to update your system packages:

apt-get update -y

This command refreshes the list of available packages and their versions from the configured repositories. The ‘-y’ option automatically confirms the action, streamlining the update process. This step is crucial for ensuring that your system has the latest information about package updates before proceeding with any installations or upgrades.

Install and Configure Firewall

To secure your server, it is crucial to enable and configure the firewall. Start by enabling the Uncomplicated Firewall (UFW) and verify its status with these commands:

sudo ufw enable
sudo ufw status

Next, ensure that all necessary ports for Mailu services are open. These include ports for various email protocols and web access:

sudo ufw allow 25,80,443,110,143,465,587,993,995/tcp

This setup ensures that your Mailu server can handle incoming and outgoing email traffic, as well as secure web access.

Update System Packages AGAIN

Before proceeding, update your system’s package list to ensure all packages are up-to-date. This step is crucial for system security and stability:

apt-get update -y

Install Required Packages

Install necessary packages that Mailu depends on, including tools for secure communication and data transfer:

sudo apt-get install \
   apt-transport-https \
   ca-certificates \
   curl \
   gnupg \
   lsb-release -y

Set Up Docker Repository

To install Docker, which Mailu uses to run its containers, add the Docker repository GPG key and repository to your system:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Update your package list once more after adding the Docker repository:

sudo apt-get update -y

Install Docker Engine

Install Docker Engine, CLI, and container runtime with the following command. This will set up the core Docker environment on your server:

sudo apt-get install docker-ce docker-ce-cli containerd.io -y

Test Docker Installation

Verify that Docker is installed correctly by running a simple test container:

sudo docker run hello-world

This command should produce a message indicating that Docker is installed and running correctly.

Install Docker Compose

Download and install Docker Compose, which Mailu uses to manage multi-container Docker applications:

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Prepare Mailu Configuration

Visit the official Mailu setup wizard to generate configuration files tailored to your setup. Download the generated docker-compose.yml and mailu.env files into a new directory:

mkdir /mailu
cd /mailu
wget https://setup.mailu.io/2024.06/file/de710f81-e582-4268-9640-c41e76ce4564/docker-compose.yml
wget https://setup.mailu.io/2024.06/file/de710f81-e582-4268-9640-c41e76ce4564/mailu.env

Start Mailu Services

With the configuration files in place, start the Mailu services using Docker Compose:

docker compose -p mailu up -d

Set Up Initial Mailu Admin Account

Create the initial admin user for accessing the Mailu administration panel:

docker compose -p mailu exec admin flask mailu admin admin YOUR_DOMAIN_HERE SET_PASSWORD_HERE

Replace ‘YOUR_DOMAIN_HERE’ and ‘SET_PASSWORD_HERE’ with your mail domain and a strong password of your choosing.

Mailu now installed and configured on your Ubuntu 22.04 server, you can access the administration interface to further configure and manage your mail server according to your needs. Be sure to secure your Mailu installation by regularly updating the system and Mailu components, and monitoring system logs for any unusual activity.

 

About the author

Technical Sahil

Sahil Dhamija is a visionary entrepreneur and tech enthusiast, proudly owning multiple companies across India, the US, the UK, and the UAE. As the founder of AInventions Technologies LLC, DigitalMarkethink Solutions LLC, WebReinvent Technologies LLC, BusinessMate Software Solutions LLC, and co-founder of Hostyaga FZE LLC, Sahil is a dynamic leader shaping the future of technology and digital marketing.

Apart from leading his businesses, Sahil is a passionate tech YouTuber, sharing insights and tutorials on various technological topics. He also serves as the CTO at Vayuna Corporate Travels Pvt Ltd and as Product Head at Vayuna Voicetech Pvt Ltd, where he oversees cutting-edge solutions in corporate travel and voice technology. Additionally, Sahil is a creative force in the film industry, producing films through Gentle Breeze Films Pvt Ltd.

Driven by innovation and creativity, Sahil continues to push boundaries in technology, media, and business.

View all posts

Leave a Reply

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