In light of recent events, there’s been a lot of chatter about leaving free e-mail services in favor of self-hosted e-mail. With self-hosted e-mail you have the option to host your e-mail wherever you want it, either on a server 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. This is 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 couple of 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’t invade 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
Which should ask you for your sudo password and if you’re sure you’re running the installer on a suitable system:
Next, it’s going to install a bunch of packages. Just sit back and relax. Get a cup of coffee or a beer. It could take 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:
Use the username and password of your sudo user to log in. Once logged in, the post-installation wizard should appear:
Click ‘Next’. You will be asked whether to preload the virtualmin libraries or not and whether you want to run the email domain lookup server. I would recommend against the former, except if you have plenty of RAM. I would recommend turning on the domain lookup server for faster mail processing.
In the next step you can enable the ClamAV mail scanner server. I would really recommend enabling this.
The same applies to the SpamAssassin server filter in the next step. This one is easier on the memory than the ClamAV server or domain lookup server, so even in you choose not to enable those two, you should enable this one.
We don’t need MySQL or PostgreSQL running and sucking up memory. So disable both.
We don’t need bind, so tick the box to skip the resolvability check and leave the other fields the way they are.
Passwords should never, ever be stored in plain text, so only store hashed passwords.
Click ‘Next’ to go to the ‘System Information’ screen.
Which should look like this (don’t mind the yellow warning, we’ll get to that):
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 and Plugins’. This is where we disable all services that are not related to serving e-mail. Untick all the boxes I have unticked in this screenshot:
When you click ‘Save’ you should return to the ‘System Information’ screen.
In the left menu, under ‘System Settings’, click ‘Re-Check Configuration’. This should check several things of your installation and display an error is something is wrong.
Let’s create a Virtual Server, so we can add a mailbox. Click ‘Create Virtual Server’ in the left menu:
Fill out the domain name for the server, which is the domain name you wish to receive e-mail for. Also pick a strong password. Click ‘Create Server’ to actually create the server:
Once your virtual server is up, let’s create a mailbox. Click ‘Edit Users’ in the left menu, which should open the user list:
Clicking ‘Add a user to this server’ opens the screen to create a new user. Because we disabled several features before, the user you’re going to create will only have an e-mail account. So, basically, you’re creating an e-mail account.
Fill out the e-mail address field, a real name and a strong password. Click ‘Create’ to finish this. You should be returned to the user overview, where you see your newly-created user including the IMAP/POP3 login.
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 example above):
- Username: john.smith.example
- Password: the one you picked
- Mail 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 secure communication 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 for your server, point the MX record to that or the server IP. Once the DNS records have propagated, you should 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 a commercial SSL certificate (although, there is word those are not save from government eyes either) and install webmail 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 with K-9 Mail on an Android device or Mozilla Thunderbird (which both support IMAP IDLE). So, no loss leaving your free e-mail service here!
Up next week: Getting started with OpenVPN (tap)!
Related Posts:

Are Tutorials Dead?

Have You Checked Out RackNerd's TikTok Channel? Video Content That Brings Web Hosting Mainstream!

From Oracle Cloud to TOR to Telegram: Check Out LowEndTalk Tutorials!

LowEndBox BUSTED for Dealing in Mind Expanding Substances

Guest Post: Top Five Reasons Why Most Businesses Either Fail or Stay Stagnant by Dustin B. Cisneros,...






















good tutorials, thanks for sharing man.
This is really amazing and very informative tutorial thanks for sharing this one.
Is this good for mac.I have mac and want to install this. This is good way.
Good post again and thanks.
Hi there, I use a small usb modem for my internet access and using a usb wifi adaptor and a virtual wifi router I was able to share my internet …
nice post, thanks for reference. I will try it.
thanks for nice post
nice post, could you explain the records with an exemple please? MX, A and AAAA. i’ve got trouble in my installation
Big thank you
Tubemate is a software to watch and download videos online on Youtube very quickly and conveniently. This application is provided completely free
Hi bro, I used a small usb modem for my internet access and using a usb wifi adaptor and a virtual wifi router.I was able to share my internet …
I cannot install. As you said it only takes about 5 mins or 15 mins but I even waited for 1 hour but it did not done.
Thanks for your sharing. It has useful information which benefits me a lot.
Nice. I also have intention of installing Virtualmin. Your post hekp me a lot. Thanks for your sharing.
Nice, it is really informative, thanks a lot
ice. I also have intention of installing Virtualmin. Your post hekp m. this post is really amazing thing you can get this more at showbox apk here.
popcorn apk is also a best know app for streaming movie app get this here for free.
chekc this out latets showbox alternatives that might helpful for you
this is very nice post and i have enjoyed a lot.
great post. and i have the post bookmarked for the future reading.
I usually use a small USB modem for my internet access and using a USB wifi adapter and a virtual wifi router I was able to share my internet …This is a nice post, it is really informative, thanks for your sharing very much.
On our varlet, you will obtain a detailed pathfinder to download ShowBox Apk for Android and former platforms and use it to maximise your day-by-day acid of amusement. At the closing of the day, you will deliver often more than what you bargained for with this app. Before we advance to our scout, withal, we want to payoff a look at the features that survive a standout servicing.
Thank you for sharing. I was looking for the info and finally found it here.
Thank you so much for sharing…
Always wanted to do this, thanks for such valuable information.
thanks for sharing the knowledge with us.
Thanks for sharing wonderful information with us. We glad we found article to gain the knowledge 🙂
Great infor. Thanks for sharing that.
Fantastic tutorial.Thanks for sharing that.
Good Post.
Hello your post is amazing and I like it so much it helps me to understand a lot of things which cover my curiosity.
Thanks for the post.
good tutorial thank you.
Thanks for sharing that. This is something totally new to me.
Glad so many people have found this tutorial helpful.
Thanks for your post