Setting up a Raspberry PI as an EMAIL/WEB SERVER

Step by step instructions for installation, setup and configuration of email server and web server on a Raspberry Pi

INTRODUCTION

“Any sufficiently advanced technology is indistinguishable from magic.” - Arthur C. Clarke

This article describes my installation of an email/web server onto a Raspberry PI. The actual installation, proving the idea and fixing issues took place over about forty days. This was not forty full days and some days I did not even look at it. Before I started I did some homework on what I would need to do but this is not included in the forty days. There were also several issues that made themselves known much later which I have also documented and resolved. I did make mistakes along the way which made the installation harder than it needed to be. I did also find some tools and web sites which helped to validate the installation which I have documented as I used them. Many times I was stopped with an issue, but diligent searching on the web usually gave me enough information to resolve them.

I did not have to change my concept from what I originally envisaged but it took some time to implement it I hope this article gives some of you the inspiration to set up your own email servers and become independent of the major providers of this world. It will certainly improve your knowledge about how web sites and email works. You will learn a lot more than just hosting your site with a commercial host. To be able to install this you need to have some understanding of how the internet works with IP addresses etc or be willing to learn. You do not need a PhD in computer science. During my installation I probably learnt more about email than I ever wanted to know. Do not lose heart if you think that it is taking too long. It may take six months and the time is not important, it is the journey that counts.

Do not get discouraged if you hit a brick wall, there is help there on the internet if you search for it. You will make mistakes but that is what the error logs, debugging tools, internet resources are there for. When I was implementing I kept a log. This was simply a text file with date headings and everything I did and tried each date detailed. I found it helped me solve issues quicker as I had a record of what did and did not work. I may have made errors in this document, and possibly missed some of the steps as my understanding of some areas is sketchy at best. If you notice errors or have problems then please contact me so missing parts can be added and errors put right.

Anyone wishing to comment can do so via the Contact page and I will add to the website all those that are printable.

Acknowledgments

Thanks to All the Available Resources

Requirements

To implement this Project the following are required

1. A raspberry PI

2. An internet connection

3. Domain Name

4. Web Server Software

5. Email Server Software

6. SSL certificate

For a detailed description of the Requirements and their choice please click anywhere on this section.

Some Terms and Ideas to Understand

A computer lets you make more mistakes faster than any invention in human history—with the possible exceptions of handguns and tequila. - Mitch Ratcliffe

Much of this is likely going over old ground for many of you so those who already know should just skip read this section. You can read the detail of this section by clicking on the section

Installation

Luck is what happens when Preparation meets Opportunity. Lucius Annaeus Seneca 4BC-65AD

This covers the installation of all software including the Operating System needed for this project.

Configuration of Internet and website

“However beautiful the strategy, you should occasionally look at the results.” - Sir Winston Churchill

This covers the configuration of the internet connection and all web site software.

Setting Up Email Users

“Be yourself; everyone else is already taken.” – Oscar Wilde

This shows how to set up and maintain email users.

Configuration of email

"Computers are useless. They can only give you answers." — Pablo Picasso

This covers the configuration of all email software.

SSL Certificate Configuration

The Moving Finger writes; and, having writ,
Moves on: nor all thy Piety nor Wit
Shall lure it back to cancel half a Line,
Nor all thy Tears wash out a Word of it.
Omar Khayyam

Security improvements

Quis custodiet ipsos custodes?
(Who will watch the watchers?)
Juvenal ~100AD

By now you should have a web site and email server both with SSL to help protect them.
It is not finished however. What is needed now is to check how secure both your web site and email server are considered to be.

Later fixes

"If anything can go wrong, it will." Murphy's Law:

These are things that are found with the system after it has gone live. They are normally not things that initial testing could be expected to find but are needed to be fixed for the smooth running of the system.

Debugging and Fixing Issues

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." - Brian W. Kernighan.

This summarises how to resolve issues when it does not work.

Email Clients

"Those who try to build idiot-proof systems always underestimate the persistence and ingenuity of idiots."— Anon

You need email client software to send, receive, view, store and organise your emails on your PC or phone.

Short History Of Unix

"Unix is simple. It just takes a genius to understand its simplicity." Dennis Ritchie 1941-2011

Unix was created in the late 1960’s by Ken Thompson, Dennis Ritchie and others.

Overview of TELNET

“All things appear and disappear because of the concurrence of causes and conditions. Nothing ever exists entirely alone; everything is in relation to everything else.” – The Buddha