Install a mail server on Linux in 10 minutes - docker, docker-compose, mailcow

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
do you want to know how to install a mail server on Linux in just 10 minutes only using free and open source software keep watching hi everybody welcome to the digital life my name is Christian and I'm always teaching you how to become an IT professional so if you are interested in Linux - networking cloud web and all those stuff don't forget to subscribe to my channel if you are watching this video and you already know how it made server works you know what docker is postfix dovecote and all those stuff keep watching I will show you an easy deployment and management process and for those of you who don't even know what I'm talking about don't worry I will explain it to you and I first will explain a few basics about maid service [Music] so when somebody wants to send you an email the other mail server or client will first need to know where to deliver that email to the other mate server will look up your Amex record on your public domain servers and find out the IP where it will connect to so your mate server will need to listen on that IP for any incoming connection accepted and then we decide which mailbox the image should be delivered to that is what we call a mail transfer agent so once the mail transfer agent has delivered the email you want to somehow read it so you will need a client on a computer or a smartphone that will need to connect to your email server we are various protocols they are called IMAP or pop free now both different protocols I don't want to step too much into death you just need to know you need to run a service on your email server where clients can connect to in order to read and write emails you also probably want to have a web server where you can connect and enter your credentials and just log into a web interface where you can read your emails or send new emails as well and yes you need to set up a web server for this as well so you can see an image server is not just a single application it is a collection of various protocols and services that are needed to achieve a fully featured email experience in the past you would have to configure every single application like mail transfer agent IMAP or pop free server web server or yourself and the configuration was done in static config files I remember these days but fortunately today there's an easy solution where you can set up all the stuff straightforward and trust me you can do it in 10 minutes for sure so how can we do that we will use docker and docker compose to easily manage all those single applications don't worry if you don't know what docker is I will make more videos about docker and also docker compose but for this video you just need to know how to install it the management of all the single applications that are isolated in docker containers is done by a fully featured and pre figured image solution called male cow so you don't need to touch any docker compose config file or any other static config files for these applications male co will all do that for you okay so don't waste time anymore let's step right into the installation process [Music] before we can install male cow to set up our image server we first need to install docker and docker compose on all Linux server I'm using Ubuntu 18.04 LTS but you can setup docker on almost every other Linux distribution as well make sure that you probably need to check the official docker homepage for an installation guide on other distributions and when you want to use the same commands like me and you just want to copy paste them check out the link in the description below on my blog you'll find a written article where you can just copy paste our commands so we first should update all software packages in ubuntu this is done via this command here then we will need to install a few software packages before we can install docker I'm using the same commands from the official docker home page to install it on Ubuntu servers this will add the official docker GPG key and add the docker repository in our muralist to be able to install docker via the package manager after doing that you will need to update the list and then install dr. C dr. C is CLI and container D these are the essential packages that will be needed to run applications in containers to check if docker is successfully installed just execute the command docker run HelloWorld it will automatically download a test container image and run it if you see a screen like this everything is working fine now you need to install docker compose this is simply done via this command I just copied it from the official docker home page note that you will need to check if a newer version is released and replace the version number with the latest stable release number check the link of the official docker home page in the description below after that you need to add the execute permissions to the docker compose fire to check if everything is working fine just execute this command and it should tell you the docker compose version you have just installed okay we will now switch into the OPD folder and check if we have super user permissions the umass command should give us a value of zero zero zero two this means we don't have any super user permissions you can now proceed and just use the sudo command or you switch to the root user which is recommended by the mail Co installation guide when we now execute you must it shows as I correct permissions zero zero two true okay now we need to clone the mail call repository from github using this command you note that it's requirement to put it into the opt folder when we now switch to the mail code authorized folder we should see all the files okay time to configure our meds oh we can use the generate underscore config SH file that will easily generate a basic config file for you you will just need to enter your fqdn of your mail server and your selected time zone so fqdn stands for fully qualified domain name and is the name of your mail server that should resolve to the public IP address so in my case i'm using a virtual test lab on my local computer therefore i can't use an fqdn that is resolved Abell on the internet I will enter mail dot a bundle dot local I know local is a top-level domain but it's just fine for my test setup because I don't have any intention to make the server available to the Internet in your case please make sure that you use the correct fqdn name instead the shell script has now created a mail code con file in the folder you can now open that file and do some customizations in your setup by default mail call will try to generate a validated SSL certificate we are the free let's encrypt servers for every domain that you configure in your email server so you don't need to worry about it but be careful because your domain should also be resolvable on the internet because let's encrypt servers will send a challenge request to verify that you actually owned the domain in my case I used a dot local domain that is not resolved to my mail server in this case or if you want to use custom SSL Certificates you can configure to skip the generation of these certificates in the mail counter code file it's done via this entry here okay so everything is now configured there's not really much to do else right now I will exit the superuser shell and simply start all services via docker to run your mate server execute the command docker - compose up - d the parameter will tell docker compose to run the containers in the background when this is the first time you start the services it can now take some time because docker will now need to download all image files of the containers from the docker hub when the download has finished it will try to start all containers and you should see a done right after all containers in green color if you want to check the status of the containers simply execute this command here and you should see an up in the state row after every container let's do a simple check if our mate server listens on port 25 when someone will send us an email he will try to connect with this port via a soon request when our mail server should respond to it you can see the TCP connection was successfully established but our email server has just closed the connection because it didn't get any useful input anyway it should work fine you can also check all listening ports on your server with this command and you can see that malko has successfully started an SMTP server a webserver and also a database server on our local computer these ports are used by all the different containers and applications that are just started via docker compose and that's pretty much it you have installed your mates over it's up and running note that it can take longer if you want to set up your own HTTPS certificates and so on and you now can start to set up your domains your mailboxes and adjust any settings on the main server to configure your mate server just open the web admin of Mako you just type in the IP address or fqdn of your mail server in your favorite web browser note that in my case I skip the creation of let's encrypt certificates if you get an error like this and yes I know this is in German then there is something wrong with your certificates but that's probably a topic for another video so I just will use the HTTP version of the weapon in please don't do this in production mode because it will send all data completely unencrypted in a test lab like this that's totally fine so I just continue well the default admin and password you can check in the official documentation link in the description below the first thing you should do is changing the default admin password you can also use the password generator of Malcomb or just type in something note make all also supports two-factor authentication which is really nice in the configuration tab you can enter your keys at forwarding hosts and set up some general settings for example the spend settings map and so on I will not go through all of these settings because they are almost different based on your requirements and your infrastructure so this would be definitely too much for this video when you click on configuration system setup you can monitor the status of the containers restart and stop them and also inspect any log files that are generated by the system to configure your domains go to configuration email setup and then you can just edit domain you in my example I will use a test domain you do two dot local as a simple test entry note that you will need to restart the Sogo container after you have added a new domain so let's do that [Music] okay so the domain is now added successfully let's add a new mailbox I use just a test email and I would also note down the password which is automatically generated because we will test the login was a simple web maid service later okay so we now have just created a new mailbox you also can add aliases to dis mailbox if you want to but let's have a look how the web maid service looks like and try to send a simple test mail you can see the webmail based on Sogo looks very nice and smooth you can do almost everything you would expect from mail service you can read send emails you have a calendar an address book and it looks very nice so go by the way is a fully featured group resolution that is completely free and open-source you can also find it within smaller companies or even by poster that are using it so it is also very well established solution you can just set up with a few simple commands okay time to do a summary and we're done I know this took me a bit longer than 10 minutes please don't judge me for that because I wanted to explain everything and wanted to be always accurate with my explanations I think it doesn't make sense to just rush through a tutorial without understanding what you're actually doing so my goal is to always explain what I do explain every single command I'm typing in the command line so that you can really follow and understand what I'm doing here so there are also probably a few things you might do afterwards so probably you will need to set up and a mix record on your public domain servers that will point to the IP address of your new mail server you also probably will need to set up an SPF record or Deacon keys because otherwise other email servers will just reject your emails because they don't trust your email server yet so if you enjoyed this video then please hit the like button and also don't forget to subscribe to my channel I always want to teach you how to become a real IT professional and I'm pushing out a new video every Monday so also ring the bell to get a notification when my new video comes online well thanks everybody for watching I hope you could learn something enjoy the rest of your day take care of yourself and see you soon [Music] you [Music]
Info
Channel: Christian Lempa
Views: 192,660
Rating: undefined out of 5
Keywords: linux, docker, docker-compose, mailcow
Id: 4rzc0hWRSPg
Channel Id: undefined
Length: 16min 30sec (990 seconds)
Published: Mon Apr 27 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.