How to Run an Email Server with Mail-in-a-Box (on a VPS)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone this is tony teaches tech i'm tony and in this video i'm going to show you how to host your own email server with mail in a box now i'm going to be using vulture it's a vps service provider to host my email server but you can use vulture contabo lino and digitalocean any one of those will work for this or something else where you have ssh access to the server and where you do have the email ports unblocked that's ports like 25 specifically for outgoing email messages now i'll show you in this tutorial how to check to see if those ports are open and if they're not you'll probably have to submit a ticket with your server provider to have them unblock those ports so the only other thing you'll need is a domain name i'm going to be using google domains for my domain name but you can use pretty much any domain name registrar that you want as long as you have access to the dns settings so there's a lot of steps to this tutorial but i'll walk you through each step so don't worry if you don't have a lot of background in this area i'll do my best to communicate the steps to you so with that said let's go ahead and get on into the tutorial here all right like i said i'm going to be using vulture to host my email server so let's create a server instance so click on deploy instance and these steps will be different if you're not going to use vulture but that's just what i'm using in this tutorial all right let's do a server in la we're going to pick ubuntu version 18.04 at the time of this video this is the latest version that mail on a box supports i believe the next version that they'll be supporting is 22.04 so we have to wait a little bit for that to happen we're going to do the 2 gigabyte per month plan if you have a lot of traffic you might want to bump that up but this is sufficient for what i'm anticipating we can only scale up if we need to later on um now everything else looks good here if you have an ssh key go ahead and select that i have a couple videos on how to set this up this just allows you to log into your server without a password and now for the server host name and label make sure you do something similar to this so mail in a box you want to start your host name your server host name with box dot your domain name so in this case i'm going to be using the domain name netwits.io so if you have a domain name that is example.com you'll want to do box.example.com but okay in this case i'm going to do box.netwits.io and just to prove that's the case here is my google domains dashboard and this is the domain name that we'll be working with today and we'll be in here working with some of these dns settings later on in the tutorial okay so let's go ahead and deploy that instance this will take about a minute so let's just fast forward through this okay our server has been spun up it's at this ip address so let's go ahead and copy that and open up a terminal window or putty if you're on windows and we'll do ssh root at your ip address and this will log us into the server first time you connect you'll see a message like this do you want to continue connecting go ahead and type yes hit enter and now we are sitting in the server in los angeles as the root user okay so now that we're in here let's just make sure that we're running the version of ubuntu that we selected so lsb underscore release dash a that's going to show us that we are indeed running ubuntu 18.04 and that is important again you can't go above that at this point to 20.04 or anything else this is the latest stable version that mail inbox supports now the other big thing here that i want to check is to make sure that our outgoing email port is um enabled it is allowed it's not blocked and we can do that really easily with the telnet command so i'm just going to copy and paste this here so what you're going to want to do is type telnet portquiz.net and then the port that we're going to test is 25. so hit enter and if you see something similar to this connected to portquiz.net then you're good to go you shouldn't have any problem sending or receiving email specifically sending email so that passes that test let's go ahead and get out of here and like i said uh i forget you have to do command now control close bracket hit enter and then type quit to get out of there like i was saying if if that fails that test for you you're gonna have to submit a ticket with your service provider your whoever you got your hosting from and ask them to unblock the email ports specifically 25 in this case there's a couple other ports that you might have to look into um but we're good to go with that so let's go ahead and update our system so app to get update and apt get oops app to get uh we'll say yes upgrade and this will just go ahead and get the latest version of the packages on our system uh and update them so we will skip forward through this all right our system is up to date so let's go ahead and install mail in a box and you can do that uh with this command right here curl dash s and then the url to mail in a box.email setup.sh for the shell script and then we're going to pipe that to sudo dash capital e bash and that'll go ahead download that script and start to execute it so go ahead and type that in hit enter and it is installing the packages necessary for setup so when this will take a few minutes but when something comes up that we need to address i'll go ahead and walk you through what you have to do okay the first prompt here is just acknowledging that you should only install this on a brand new ubuntu installation so you shouldn't have any other things like websites or services running on this this should be a fresh installation of ubuntu so that's the case for us so we'll go ahead and hit enter uh what email address do you want so for me i'm going to do instead of me at networks.i i'm going to do tony at networts.io and hit enter and now for this like i said in the beginning of the video you want a host name that has a box sub domain name so for us box.networks.io we already did that from the beginning so we're good to go with this hit okay okay and here we're going to pick our time zone so my server is in the united states and it is on the west coast so pacific ocean and one of the last steps that we have to do here in the installation process is set a password for our user account tony at edwards.io so i'm going to go ahead and paste my password in here hit enter and then verify that by pasting it again hit enter and we should be pretty much good to go okay so we are done with the installation now this is the fun part the part that a lot of people uh struggle with and this is the dns settings that we have to configure in order for email to be properly delivered and not marked as spam and all that good stuff so what we're going to do is go to your domain name registrar we'll go ahead and log into the admin panel in a little bit but i want you to go to your domain name registrar now that we have the ip set up everything running on the server let's copy the ip address uh and go to the dns settings for your domain name again networts.io here's the the dns settings and this is google domains but the user interface will be different for you but it'll be similar concepts right so the goal here is to set glue records and our name server so up here in the upper right hand corner if you're using google domains go to global dns settings and we don't have any glue records set up right now so let's click on manage glue records what we want to do is to add two glue records one is going to be at ns1 name server one dot box and you'll see it's auto completing that which is going to be ns1.box.networks.io and we're going to add the ip address of our server and then we'll add another one called ns2.box dot networks dot io and we'll add that same ip address so go ahead and save those changes and what we're basically going to do is make these our name servers so if we go back out of here and by default we're using google's name servers but we're going to add instead our own custom name servers and um i think i was in here before that i might already have these in here but yeah what you want to do in here is click on manage name servers and go ahead this this won't be here for you but you might have to type in ns1.box.yourdomainname.whatever and ns2.box.net.io and then go ahead and click on save and as it says up here your domain isn't using these settings so instead of using the default name servers which are currently active we want to switch to the custom name server so click on the switch to these settings button and that will do its thing so down here custom dns config is activated so now we're using those name servers which are actually running on our server at this point let's do our reverse dns setting another important thing to do so in your server wherever that is vulture for me we want to go to our server click on our server and then we want to find our settings and right here reverse dns so by default it's just ipaddress.vulture.com we want to change that and make it box dot net wits dot io so we'll save that and we can this might yeah it says changes may take 6 to 12 hours to propagate but let's see if that happens any quicker i'm going to open up a new terminal window here on my local machine and try to see with the dig command if that is configured at this point so if we do something like dig dash x and then the ip address of your server which mine is this one right here so copy that paste let's see what kind of result we get back and as you can see here we do have that already configured so the ip address is reporting that the reverse dns setting ptr record is box.networks.eo so we're good to go in that case if for some reason you don't have the dig command on your computer you can use another tool like this one right here the mx toolbox let me copy that link and paste it in here so yeah mxtoolbox.com reverse so we'll uh we'll put the ip address in here and see if that reports a similar host name and it does so box.netwits.io so we're good to go with reverse dns i think at this point we can go ahead and log into the admin panel so use their url link here your ip address slash admin we'll open up a new tab and go there and you'll get this connection it's not private um if you can't bypass this and you're using chrome you can type in this is unsafe and you'll be you'll bypass that that page and now we can log in to our server so email address for me tony netwicks dot io and let me copy my password over here and we'll paste that and go ahead and sign on in so this uh system status checks page is super helpful this will tell you if there's anything wrong like like talking about the ports being blocked so our outbound mail port smtp is not blocked there's a whole bunch of other checks that it's doing here this one about the ssh server permitting password-based login that's okay we can fix that later system updates have been installed and reboot is necessary we can do that later but some of the things that we have to look into are these mta sts policy missing that's just for me it might be different for you and some of these other domain settings down here so what we basically want to do is come over into the system tab and go to the tls ssl certificate section and in here we want to provision uh our certificates because we don't have any certificates installed for any of these domain names so click on provision and this will take a little while so we'll just fast forward through this okay and most of those were installed but for some reason this one wasn't i found that if you do this twice it might work on the second time so let's go ahead and provision again okay and as you can see those last two domain names have been an ssl certificate has been installed for those last two domain names so we're good to go with that and what that means is now we can use instead of going to our ip address we can go to box box.netwits.io and then the admin page and we won't get that uh that warning about it being unsecured and you'll see that we do have a secure connection with an ssl certificate installed so go ahead and log back in all right we're logged back into our server and as we scroll down here we can see that a lot of those messages have been taken care of uh one specifically this domains dns sec ds record is not set so it kind of gives you what you have to do here basically we have to take this information and put it into our dns settings for our domain name so let's go ahead and do that in my domain name dns settings there's this dns sec section so let's manage those and it wants a key tag algorithm digest type and digest so let's go ahead and give it that information back over here the key tag is this so we'll just go ahead copy paste algorithm is k s k oh no that's the key flag sorry algorithm 13. okay so let's go to algorithm 13 digest type that would be two sha-256 and then the digest itself is this right here so we'll paste that in and save okay again it says ds records are being published and should be active by august 13th at 8 00 a.m it is august 11 so that's two full days let's refresh the page and see if that goes away if not we might have to wait a little bit for that to disappear so let's go ahead and just wait a few minutes to see if that goes away okay guys and while we're waiting um actually for these mta sts policies if this is happening for you this one here and this one here um what i found that you can do is open up your terminal window and just go through the mail in a box command setup again so you can just type on your command line mail in a box hit enter and this won't overwrite anything it'll just go ahead and reapply some of the files through the installation so i found that that got rid of that error let's see if that happens again so i'll go through this process and see what happens so the setup is a whole heck of a lot quicker the second time through and as you can see it's already picking up the fact that our hostname is selected and configured so let's go back here to the admin page and miner might not kick us out let's see what happens it does we'll have to log back in but when we do we scroll back down here and we'll see that we don't see those mta sds policy errors anymore so we're good to go the only thing is this uh dds record this miner might not be okay i'm not sure uh we'll go ahead and do some tests though uh for sending and receiving email so how do we do that if we go to mail and users and go to the instructions you'll see that we can access our webmail at this url so let's go ahead and open that up in a new tab and while it's opening if you want to connect to outlook or gmail or another external third-party email client this is what you would use to do that this is all the information that you need okay so let's log into our account so our inbox so tony at networts dot io and then the password all right and here is your inbox so let's do a test let's send an email compose to uh tony teaches tech gmail.com and we'll say hey bud not bug hey bud what's up did you get this uh what i'm going to do to see this happening hopefully in near real time is to open up these two inboxes side by side so we're logged in here as tonytubestack gmail.com on the right and then obviously tony networth.io in the left so we'll go ahead and send that message the message was sent and over here let's help it along and there it is so that email shows up it's not in the spam folder we don't see any warnings about it being spam from tonyannowitz.io to tonyteachestech gmail.com let's respond and say yes i got it send that message back over and same thing as before let's uh where's the refresh button help it along refresh refresh make this a little bit bigger so we can see this is we're in the compose here's our inbox uh refresh and there it is so just uh 30 seconds later uh yes i got it so we're able to send and receive mail that's really good even though that one dds record is not properly configured but with time that will happen a couple other things i want to show you in here if you want to add users to your uh add multiple email accounts you can do that under mail and users users and then you can add them here so let's say we want to do hello at netwits.io and we'll pick a password for them they're a normal user you can make them an administrator as well so we'll add that and there we go so now we have two users on our system um and the last thing i want to show you is i think under this web tab you can host a small website by default out of here so networks.io if we go to that this is what that looks like this is just a simple static html website i'm sure you can do a little bit more than that but at this point this is all i looked into so if we go to that url let me double check what that was home user data www and then default in that directory we just have a simple index.html file and what does that say right now that says this is a male in a box okay and you can see that in the code over here this is a male in the box let's have it say like comment subscribe just so you know we're looking at the same thing we'll save that come over here refresh there we go guys i hope you found this video valuable if you did subscribe to this channel give the video a thumbs up and if you do end up subscribing i will see you in the next one [Music] you
Info
Channel: Tony Teaches Tech
Views: 2,757
Rating: undefined out of 5
Keywords: mail in a box, mail in a box smtp, mail in a box tutorial, email server mail in a box, mailinabox, mailinabox email, install mailinabox, mailinabox setup, host email server, setup email server, mailinabox tutorial, mail-in-a-box, vultr email server, contabo email server, linode email server, digitalocean email server
Id: -8a6E-Rb6BA
Channel Id: undefined
Length: 20min 9sec (1209 seconds)
Published: Thu Nov 11 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.