{"id":4645,"date":"2024-10-18T12:00:13","date_gmt":"2024-10-18T12:00:13","guid":{"rendered":"https:\/\/blog.ssdnodes.com\/blog\/?p=4645"},"modified":"2025-05-15T15:41:22","modified_gmt":"2025-05-15T15:41:22","slug":"install-mailcow-using-mailcow-dockerized-tutorial","status":"publish","type":"post","link":"https:\/\/www.ssdnodes.com\/blog\/install-mailcow-using-mailcow-dockerized-tutorial\/","title":{"rendered":"Install Mailcow Using Docker and Docker Compose &#8211; mailcow: dockerized Tutorial"},"content":{"rendered":"<p><a href=\"https:\/\/mailcow.email\/\" target=\"_blank\" rel=\"noopener noreferrer\">Mailcow<\/a> is a user-friendly mail system for sending, receiving and managing email. In this tutorial you'll install mailcow using Docker on your VPS server.<\/p>\n<p>Mailcow's only officially-supported install method uses the consistency and ease of Docker and dockerized services, so this can be done quickly if you already have a functional Docker setup in place. That said, here are some prerequisites for Mailcow, as well as the steps to follow to get Mailcow up and running.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10860 size-full\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/Install-mailcow-using-Docker-Docker-Compose-1.jpg\" alt=\"Install mailcow using Docker and Docker Compose\" width=\"600\" height=\"400\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/Install-mailcow-using-Docker-Docker-Compose-1.jpg 600w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/Install-mailcow-using-Docker-Docker-Compose-1-300x200.jpg 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<h2>Prerequisites<\/h2>\n<ul>\n<li>Docker and docker-compose <a href=\"https:\/\/www.ssdnodes.com\/blog\/getting-started-docker-vps\/\" target=\"_blank\" rel=\"noopener noreferrer\">installed<\/a> and configured, as well as docker-compose<\/li>\n<li>A-Name record for email server address<\/li>\n<li>FQDN chosen and configured (can use the same address as above)<\/li>\n<li>MX Record for primary domain<\/li>\n<li>SSL Certificate for mail server<\/li>\n<li>Required <a href=\"https:\/\/mailcow.github.io\/mailcow-dockerized-docs\/prerequisite-system\/#default-ports\" target=\"_blank\" rel=\"noopener noreferrer\">ports<\/a> open<\/li>\n<li>At least 3GB of RAM available on your VPS<\/li>\n<\/ul>\n<h2>Installing Mailcow using Docker and Docker Compose<\/h2>\n<p>Assuming Docker is all setup and ready to go, the installation process is fairly straightforward. Docker makes things a lot simpler, as packages and dependencies are self-managed within each docker image or package. All you need is to clone the <a href=\"https:\/\/github.com\/mailcow\/mailcow-dockerized\" target=\"_blank\" rel=\"noopener\">mailcow: dockerized<\/a> repository, configure it, then launch it.<\/p>\n<h3>Step 1: Check Umask Settings<\/h3>\n<p>First, we\u2019ll need to ensure that the unmask settings for the operating system are correct. Typically, this is already the case, but it never hurts to check.<\/p>\n<pre><code class=\"language-shell\" lang=\"shell\">umask\r\n0022\r\n<\/code><\/pre>\n<p>You\u2019ll want to run the <code>umask<\/code> command, and if it isn\u2019t <code class=\"language-shell\" lang=\"shell\">0022<\/code>, modify your systems umask settings to match that.<\/p>\n<h3>Step 2: Clone the mailcow: dockerized Repository<\/h3>\n<p>Next, we\u2019ll switch to the <code>\/opt<\/code> folder and create our working directory. Git must be installed for this part, although most Linux-based operating systems have it available in their default repository, if not installed already.<\/p>\n<pre><code class=\"language-shell\" lang=\"shell\">cd \/opt\r\ngit clone https:\/\/github.com\/mailcow\/mailcow-dockerized\r\ncd mailcow-dockerized\r\n<\/code><\/pre>\n<p>Now, we will generate the configuration file that Mailcow will use. Luckily, there\u2019s a simple-to-use script that allows us to just enter a few pieces of information to get this going.<\/p>\n<pre><code class=\"language-shell\" lang=\"shell\">.\/generate_config.sh\r\n<\/code><\/pre>\n<p>At this point, the script will ask for your FQDN. Keep in mind, this is <em>different<\/em> than your mail domain. For instance, if you plan on using emails that use the domain example.com, you might use the FQDN of mail.example.com. It will also ask you for your Time Zone. It\u2019s perfectly fine to use the default (hit enter), or you can choose your local timezone as explicitly listed as the TZ database name <a href=\"https:\/\/en.wikipedia.org\/wiki\/List_of_tz_database_time_zones\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>. I chose the <code>America\/Los_Angeles<\/code> time zone as I am in the Pacific Standard time zone.<\/p>\n<p>If you are using a reverse proxy, you\u2019ll need to further modify the configuration file as necessary to accommodate for the default 80 and 443 ports to be already spoken for by your web server. Otherwise, the default configuration file that is generated is fine for a standalone server.<\/p>\n<h3><a class=\"md-header-anchor md-print-anchor\" href=\"af:\/\/n86\" name=\"header-n86\" target=\"_blank\"><\/a>Step 3: Launch the Mailcow Docker Compose<\/h3>\n<p>Now, we\u2019ve completed our setup. We just need to actually pull and launch the docker images that will run our Mailcow instance. While still in the <code>\/opt\/mailcow<span style=\"font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;\">-<\/span>dockerized<\/code> folder, we\u2019ll run the docker-compose commands.<\/p>\n<pre><code class=\"language-shell\" lang=\"shell\">docker-compose pull\r\ndocker-compose up -d\r\n<\/code><\/pre>\n<p>The <code><span style=\"font-family: 'Open Sans', 'Clear Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;\">-<\/span>d<\/code> flag causes the Mailcow docker installation to run detached from the primary window, allowing it to continue running after the current session ends. Be patient, as this step can take some time. It\u2019s pulling in and configuring all the different parts of the docker configuration that helps us run our Mailcow install.<\/p>\n<p>If you navigate to your domain name:<\/p>\n<pre>https:\/\/mail.example.com<\/pre>\n<p>You'll likely see a page informing you that the database is being initialized:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10828\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/mailcow-debugging.webp\" alt=\"initializing mailcow \" width=\"800\" height=\"637\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/mailcow-debugging.webp 987w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/mailcow-debugging-300x239.webp 300w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/mailcow-debugging-768x612.webp 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>This will take a few minutes.<\/p>\n<p>After the database is fully initialized, refresh the page, and the Mailcow user interface will appear:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10829\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/mailcow-UI-1024x617.webp\" alt=\"mailcow successfully installed with docker compose\" width=\"800\" height=\"482\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/mailcow-UI-1024x617.webp 1024w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/mailcow-UI-300x181.webp 300w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/mailcow-UI-768x463.webp 768w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/mailcow-UI.webp 1210w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p><code class=\"language-shell\" lang=\"shell\"><\/code><\/p>\n<h2>Mailcow Setup<\/h2>\n<p>We'll now complete the mailcow setup, and create an email address.<\/p>\n<p>Log into your new mailcow install by navigating to the <em>secure<\/em> url for your FQDN. Using our previous example, if your FQDN is <code>mail.example.com<\/code>, you\u2019d want to point your browser to <code><a href=\"https:\/\/mail.example.com\" target=\"_blank\" rel=\"noopener\">https:\/\/mail.example.com<\/a><\/code>. The default username and password for your new Mailcow install is <code>admin<\/code> and <code>moohoo<\/code>, respectively.<\/p>\n<h3>Adding a Domain to Mailcow<\/h3>\n<p>First, we\u2019ll need to add our domain. So after logging in, navigate to the <strong>E-Mail<\/strong> tab and click <strong>Configuration<\/strong>.<\/p>\n<p>Next, we\u2019ll click the <strong>Add domain<\/strong> button to add a domain.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10825\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/add_domain-1024x686.webp\" alt=\"mailcow add domain\" width=\"800\" height=\"536\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/add_domain-1024x686.webp 1024w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/add_domain-300x201.webp 300w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/add_domain-768x514.webp 768w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/add_domain.webp 1138w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>Fill out the domain name. That is, the root domain that we want to use for our email addresses. The defaults are fine, unless you specifically know something you need to change for your needs. To finish, click the <code>Add domain and restart SOGo<\/code> button. This adds the domain and restarts the service that manages it at the same time.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10826\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/domain-details-1024x389.webp\" alt=\"mailcow domain details\" width=\"800\" height=\"304\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/domain-details-1024x389.webp 1024w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/domain-details-300x114.webp 300w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/domain-details-768x292.webp 768w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/domain-details.webp 1502w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<h3>Adding a Mailbox to Mailcow<\/h3>\n<p>Next, you'll need to create a mail box. Click over the <code>Mailboxes<\/code> tab then click the <code>Mailboxes<\/code> button.<\/p>\n<p>Click <code>Add mailbox<\/code>, you'll be presented with a form similar to the following:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10827\" src=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/add-mailbox-1024x483.webp\" alt=\"mailcow add mailbox\" width=\"800\" height=\"377\" srcset=\"https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/add-mailbox-1024x483.webp 1024w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/add-mailbox-300x141.webp 300w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/add-mailbox-768x362.webp 768w, https:\/\/www.ssdnodes.com\/wp-content\/uploads\/2020\/04\/add-mailbox.webp 1514w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>Enter a username, select the domain (if you\u2019ve added more than one), then type in the full name for the user.<br \/>\nFor the quota, leave it as <code>0<\/code> for no size limit, and then create or generate a password.<\/p>\n<p>Finally, click <code>Add<\/code>.<\/p>\n<p>And that\u2019s it! You\u2019ve setup mailcow, created an email address, and now are ready to use your email address to send and receive emails. Log out of the Admin user and navigate to <code>https:\/\/your.mailhost.domain\/SOGo<\/code> and log in with the email address and password you created.<\/p>\n<p>Alternatively, you can log into any standard email client using POP3 or IMAP4 protocols as you normally would.<\/p>\n<h2>Conclusion<\/h2>\n<p>You've installed Mailcow with Docker and Docker Compose using the <a href=\"https:\/\/github.com\/mailcow\/mailcow-dockerized\" target=\"_blank\" rel=\"noopener\">mailcow: dockerized<\/a> repository, and you now have a fully functional emailing system on your VPS. You can send, receive and manage your email with full control over your data. For more information on Mailcow, check out the <a href=\"https:\/\/docs.mailcow.email\/\" target=\"_blank\" rel=\"noopener\">official documentation<\/a>.<\/p>\n<h2>FAQ: Questions on Mailcow<\/h2>\n<h3>Does Mailcow support SSL encryption?<\/h3>\n<p>Yes, Mailcow supports SSL encryption. It can automatically generate SSL certificates using Let's Encrypt or you can manually configure your own SSL certificates for securing email traffic.<\/p>\n<h3>How do I back up Mailcow?<\/h3>\n<p>Mailcow provides built-in backup functionality. You can use the <code>backup_and_restore.sh<\/code> script found in the Mailcow tools directory. This script allows you to back up the Mailcow Docker volumes, which include email data, user settings, and configurations.<\/p>\n<h3>Is Mailcow suitable for business use?<\/h3>\n<p>Yes, Mailcow is well-suited for business use. It offers features like user and domain management, email filtering, and security options such as DKIM, SPF, and DMARC. However, businesses may need technical expertise for setup and ongoing management.<\/p>\n<h3>How do I manage users in Mailcow?<\/h3>\n<p>User management in Mailcow is done through the web admin interface. You can create, delete, and modify users, assign email addresses to domains, and set quotas for mailbox storage. The interface makes it easy to manage users even with multiple domains.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ready to set up your own mail server? Check out our step-by-step guide on installing Mailcow using Docker and Docker Compose!<\/p>\n","protected":false},"author":20,"featured_media":10858,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[18,30],"tags":[182,241],"class_list":["post-4645","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","category-tutorials","tag-docker","tag-mailcow"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/4645","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/comments?post=4645"}],"version-history":[{"count":15,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/4645\/revisions"}],"predecessor-version":[{"id":12933,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/posts\/4645\/revisions\/12933"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/media\/10858"}],"wp:attachment":[{"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/media?parent=4645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/categories?post=4645"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ssdnodes.com\/wp-json\/wp\/v2\/tags?post=4645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}