your own mail server with virtualmin – low end box
TRANSCRIPT
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 1/23
LowEndBox
Hosting Websites on Bare Minimum VPS/Dedicated Servers
Your own mail server with Virtualmin
tutorials August 24, 2013 @ 8:34 am, by Maarten Kossen
In light of recent events, there’s been a lot of chatter about leaving free e-mail services in favor of self-hostede-mail. With self-hosted e-mail you have the option to host your e-mail wherever you want it, either on aserver at home or on a VPS.
There’s plenty of affordable options around to run your own mail server. I would personally recommend a
Xen or KVM VPS for this, as with OpenVZ it is really easy for your provider to “snoop” on your e-mail. Thisis also possible with Xen or KVM, but it usually requires a reboot (which you will probably notice).
I’ve used a 512MB Xen VPS for this tutorial. I’ve used “this much” memory because I want to run clamd and
SpamAssassin in RAM. The server also has 45GB of disk space, which is more than enough to run a coupleof big mailboxes on. You could do with less RAM (though that would increase the CPU load and slow down
mail processing) and far less disk space (depending on your needs), but with “my” specs, you’re on the safe
side.
Installing Virtualmin
I’m using Virtualmin in this tutorial. The choice for Virtualmin is quite easy: it’s free, fast, stable and doesn’tinvade your system (like, for example, cPanel does). Virtualmin may not have the prettiest UI out there, but it’s
clean and it’s effective. You’ll only be using Virtualmin to create and administrate mailboxes. Other than that,you won’t need it.
Virtualmin has an open source (GPL) version and a commercial version. The commercial version has some“advanced” features not in the GPL version. I’ll be using the GPL version. This should run on most Linux
distributions and FreeBSD.
So let’s install Virtualmin. I recommend a clean server for this, to avoid any conflicts. On the server, run:
wget http://software.virtualmin.com/gpl/scripts/install.sh
Which will get the installer script. Next, make it executable:
chmod +x install.sh
And finally, run the installer:
sudo ./install.sh
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 2/23
Which should ask you for your sudo password and if you’re sure you’re running the installer on a suitablesystem:
Next, it’s going to install a bunch of packages. Just sit back and relax. Get a cup of coffee or a beer. It couldtake anywhere from 5 tot 15 minutes (on average).
Once that is done, open a web browser and go to either your IP address or domain name on port 10000 with‘https’ prepended:
https://192.0.2.1:10000
https://leb001.example.net:10000/
This should ask you to log in:
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 3/23
Use the username and password of your sudo user to log in. Once logged in, the post-installation wizardshould appear:
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 4/23
Click ‘Next’. You will be asked whether to preload the virtualmin libraries or not and whether you want to runthe email domain lookup server. I would recommend against the former, except if you have plenty of RAM. Iwould recommend turning on the domain lookup server for faster mail processing.
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 5/23
In the next step you can enable the ClamAV mail scanner server. I would really recommend enabling this.
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 6/23
The same applies to the SpamAssassin server filter in the next step. This one is easier on the memory than theClamAV server or domain lookup server, so even in you choose not to enable those two, you should enablethis one.
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 7/23
We don’t need MySQL or PostgreSQL running and sucking up memory. So disable both.
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 8/23
We don’t need bind, so tick the box to skip the resolvability check and leave the other fields the way they are.
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 9/23
Passwords should never, ever be stored in plain text, so only store hashed passwords.
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 10/23
Click ‘Next’ to go to the ‘System Information’ screen.
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 11/23
Which should look like this (don’t mind the yellow warning, we’ll get to that):
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 12/23
You’ve now successfully installed Virtualmin! Let’s configure it and create a mailbox.
Configuring services and adding your first mailbox
First, we need to configure some services. Go to ‘System Settings’ in the left menu and then to ‘Features andPlugins’. This is where we disable all services that are not related to serving e-mail. Untick all the boxes I haveunticked in this screenshot:
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 13/23
When you click ‘Save’ you should return to the ‘System Information’ screen.
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 14/23
In the left menu, under ‘System Settings’, click ‘Re-Check Configuration’. This should check several things ofyour installation and display an error is something is wrong.
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 15/23
Let’s create a Virtual Server, so we can add a mailbox. Click ‘Create Virtual Server’ in the left menu:
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 16/23
Fill out the domain name for the server, which is the domain name you wish to receive e-mail for. Also pick astrong password. Click ‘Create Server’ to actually create the server:
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 17/23
Once your virtual server is up, let’s create a mailbox. Click ‘Edit Users’ in the left menu, which should openthe user list:
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 18/23
Clicking ‘Add a user to this server’ opens the screen to create a new user. Because we disabled severalfeatures before, the user you’re going to create will only have an e-mail account. So, basically, you’re creatingan e-mail account.
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 19/23
Fill out the e-mail address field, a real name and a strong password. Click ‘Create’ to finish this. You shouldbe returned to the user overview, where you see your newly-created user including the IMAP/POP3 login.
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 20/23
And that’s it! You’ve just created your own e-mail server and your first mailbox!
To add your mailbox to an e-mail client, like Mozilla Thunderbird, your details will be (from the exampleabove):
Username: john.smith.examplePassword: the one you pickedMail server (IMAP/POP3/SMTP): the domain name/IP of the mail server
TLS is available but the certificate is self-signed, so you should accept the certificate to enable securecommunication with the mail server.
The final step is to point you domain name’s DNS records to your newly created server, if you didn’t already.If your domain points to the server, point the MX record to your domain. If you’ve used a different domain foryour server, point the MX record to that or the server IP. Once the DNS records have propagated, youshould be receiving e-mail!
Final notes
This is one of the easiest ways to get a mail server running. You can improve your server by using acommercial SSL certificate (although, there is word those are not save from government eyes either) and installwebmail software. Those are things for a future tutorial, however!
Your mail server also supports IMAP IDLE, which boils down to push for IMAP. This works especially well
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 21/23
with K-9 Mail on an Android device or Mozilla Thunderbird (which both support IMAP IDLE). So, no lossleaving your free e-mail service here!
Up next week: Getting started with OpenVPN (tap)!
7 Comments
1. jcaleb:
Good tutorial Maarten
August 24, 2013 @ 8:37 am | Reply
Maarten Kossen:
Thanks!
August 24, 2013 @ 8:52 am | Reply
2. Lucas:
How it safe from ddos and hackers?
August 24, 2013 @ 8:50 am | Reply
Maarten Kossen:
It’s as safe from hackers as most mail servers as long as you keep the software up to date. UsingIPtables to secure your server will definitely help.
To protect the server from a DDOS, I suggest getting a DDOS-protected IP address if yourprovider offers those.
August 24, 2013 @ 8:53 am | Reply
3. DomainBop:
Two security suggestions I would make if you’re using webmin/virtualmin is to change the port from thedefault 10000 and install fail2ban because webmin on port 10000 is a favorite target of brute forceattackers.
August 24, 2013 @ 9:08 am | Reply
4.
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 22/23
John:
Fantastic tutorial, was looking at how to set up a mail server but looked really difficult! Thanks!
August 24, 2013 @ 9:38 am | Reply
5.
hein:
newbie question, how about inbox rate?
August 24, 2013 @ 9:44 am | Reply
Leave a Reply
Some notes on commenting on LowEndBox:
Do not use LowEndBox for support issues. Go to your hosting provider and issue a ticket there.
Coming here saying "my VPS is down, what do I do?!" will only have your comments removed.Akismet is used for spam detection. Quoting webhostingtalk.com URL seems to get binned consistently
here, but I do peek into the spam box frequently to publish those comments.Use <pre>...</pre> to quote the output from your terminal/console, or consider using a pastebin
service.
Your email address will not be published. Required fields are marked *
Name *
Email *
Website
Comment
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronymtitle=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <pre><q cite=""> <strike> <strong>
Post Comment
Notify me of followup comments via e-mail
About LowEndBox
24/08/13 Your own mail server with Virtualmin – Low End Box
lowendbox.com/blog/your-own-mail-server-with-virtualmin/ 23/23
This website is dedicated for running websites and services on low end dedicated servers/virtual private
servers, where you only need to pay a few dollars a month to get full root access. [More/Contact]
Find
Community
Low End TalkLow End Wiki
Recent Posts
Your own mail server with Virtualmin on 24 August 2013Crissic Solutions – $1.64/Month 256MB RAM OpenVZ VPS in Jacksonville on 23 August 2013
XFuse Solutions – $6.99 1.5GB OpenVZ VPS in Buffalo, NY on 22 August 2013Servarica – $7/Month 1GB Windows XEN HVM or 1.5GB Linux PV in Montreal, Canada on 21
August 2013UGVPS – $30/6 months 3GB OpenVZ in Los Angeles, Buffalo, Atlanta or Chicago on 20 August
2013FrapHost – $25/Year 1GB OpenVZ VPS in Las Vegas, Nevada on 20 August 2013
ExpertVM – $40/Year 128MB OpenVZ/KVM in Singapore on 19 August 2013
IPtables: IPv6 and more rules on 17 August 2013VPS Ace – $9/Year 128mb SSD-Cached in Buffalo, Chicago & Los Angeles on 16 August 2013
Kickstarter Competition (start your own host) Update/Reminder on 15 August 2013
2008-2013 © LowEndBox. Powered by WordPress. Generated in 0.068 seconds. RSS FeedAll date/time in UTC.