Skip to main content

How to Host Your Own Email Server (for free)



Today Iam show you how to set up your very own

self-hosted email server for free we're

going to be using something called cyber

panel

and you know for the longest time i

resisted making this video because

i personally know how hard it is to set

up an email server

in general now not only do you have to

get the emails

sending and receiving properly but in

order to have your emails

not be sent to the spam folder at the

destination

you need to make sure that all of your

dns records are in place like the dkim

records the mx records the ptr records

all that stuff blah blah blah but the

reason we're doing

this tutorial today with cyberpanel is

because it takes the pain out of

generating those records by hand

manually there is literally done with a

click of a button so

it really simplifies the process of

setting up the email server

now i don't want to make it sound like

it's super easy because there are still

a lot of steps and this

tutorial video will probably be longer

than most of my videos on this channel

but my guarantee is that if you stick

around to the end of the video watch the

full thing all the way through

by the end you will have a working email

server where your emails

don't get sent to the spam folder

because we properly configured

everything the way it should be now the

one

aspect of this the email server itself

is free right it's open source

software cyber panel is you can actually

look at the source code

on github or something like that but you

will have to pay for

to host it if you don't already have a

server set up at your location

maybe you'll have to sign up for

some type of vps which is what we're

actually going to be using in this video

i'm going to use a linux server

i'll walk you through that process as

well but that does not have to be

the case for you you can use any ubuntu

server or

any other type of server that you want

in general so

with all that out of the way let's go

ahead and get on into the tutorial here

we will start out in lynnode which is

the server that i'm going to be

running my email server on again this

can be

you know a local server on your computer

for all that matters so

let's go ahead and create a linux here

i'm going to create

my first layout and what this is if if

this is confusing for you at this point

this is just me

spinning up a an ubuntu server a fresh

copy of ubuntu 28.04 so

i'm going to choose that here and

there we go so ubuntu 28.04 long term

support

i'm going to put it in fremont

california which is the location closest

to me

i'm going to do a 2 gigabyte ram plan

with

50 gigabytes of storage and then

i'll type in my root password

and i'll add my ssh keys and create that

server so

um this is going to take a few seconds

to boot up but we do have an ip address

here

and what we want to do with this ip

address right away is go over to

our domain name registrar the place that

we got our domain name from

and associate that ip address with the

domain name so

we're actually going to be in this

tutorial taking

um we're going to be hosting our own dns

server

on the mail server to simplify the

process of all those

dns records that i talked about so

that's we're going to start setting up

right now so

i bought my domain name site1.xyz that's

the domain name that we're going to use

in this tutorial

so anytime i talk about site1.xyz just

replace it with your domain name that

you want to set up a mail server for

anyway i bought this from namecheap here

and what i'm going to do

is go into the manage section and

you know like i said this this will be

slightly different for you wherever you

bought your domain name from but

the concept still is the same what we

what we're doing

about setting up the name servers is

going to be the same thing that you have

to do wherever you bought your domain

name from

so i'm going to come on over here into

the advanced dns

section and come down

to the personal dns server which is

kind of like the same thing as a private

dns server and i'm going to add a name

server here

so the name server is going to be ns1

dot site1.xyz and that's going to be

associated with the ip address of our

server

and then i'm going to add another one

called ns2

dot site1.xyz and then same thing

associated with the ip address ending in

248. so

um doesn't look like it's doing anything

but if you click on search you'll see

that we have

those two records set up here now the

other thing we want to do

inside of namecheap specifically is to

come back to the domain section here

and instead of when this loads

instead of having a basic dns name

servers we want to have custom dns name

servers

and here we will type in ns1.site1.xyz

for our first one ns2.site1.xyz

we will save those changes so

that basically what we did there is we

just told namecheap that

our name servers is going to be located

at the ip address that we told it

so we're going to have to set up the

name servers on our cyber panel

okay so by now i think we can go ahead

and check the status of this it looks

like it's up and running so let's go

ahead and log into that via ssh

so we can do ssh root

at the ip address hit enter

yes we can trust the connection so we

can continue

and now we are logged into that remote

server

what we want to do is to kick off the

cyber panel install

so with the official documentation this

is

how you do that and i'll have

all of these commands in this this video

linked down in the description below so

you don't have to type them from the

screen you can just copy and paste them

so

um sh we're going to pull down the

latest

installer script and go ahead and kick

off that installer

now here it's just checking make sure

everything's up to date

it is and we're good to go so let's go

ahead and do this

installation so what do we want to do we

want to install cyber panel so let's

pick option one here

type one and hit enter and we want to

install cyber panel with open light

speed this is the free version of the

lightspeed server

um option two is something that you'll

have to pay for so we want to pick

option one again here hit

enter and exactly just do you want to

install

cyber panel like in full which includes

power dns post fix in this ftp server

yes we definitely want to do this

especially because we want postfix which

is going to be the mail server that

we're using so

capital y hit enter and this next option

here is asking us do we will have a

remote

server meaning do we have a server that

is a database server that is

external to our server and the answer to

that in this case it doesn't really

matter but

for us it is no so capital n hit enter

and do you want the latest version of

the cyber panel

if you do hit enter i'm going to hit

enter or you can specify a specific

version

and then we're going to set a password

here with

s hit enter i'm going to type in my

password

and again

and uh do we want memcached it doesn't

really matter in this case i'm going to

say no just to speed up the installation

same thing for redis hit no but if you

want those things you can hit yes

and i will accept the watchdog here

so this is going to go ahead and install

cyber panel it takes

a good amount of time 5 10 15 minutes so

i'll pause the video here and catch back

up with you when it finishes all right

guys i'm back and the cyber panel

installation has finished it prompted me

if i wanted to reboot the server so i

went here

typed y and that went ahead and rebooted

the server

and now it should be up and online so

let's go ahead and check to see if

that's the case

if we um if we just copy our ip address

and open up a new window

type in that ip address and hit enter

this is good i mean 404 usually is not a

good thing but this is good this means

that there's something being served

on our cyber panel website web server

in order to access the dashboard for

cyber panel we can

tack on a colon 8090 here

and that's going to open up well you're

going to get the your connection is not

private so we can click on advanced and

proceed to the

the login screen but this is how you are

able to log into cyberpanel so

if you remember we created a admin user

with a password during the installation

process

so you can go ahead and type in those

credentials

and then go ahead and sign in and this

is the cyber panel dashboard now we're

going to do a lot of

a lot of things in here to configure our

email server

and right now there's three things that

we want to take care of okay we want to

we want to create a website okay we're

not going to put an application in the

website we're just going to create a

website

there's no there's not going to be

anything served yet okay it's just a

website

to create some dns records basically

okay

and then after that we want to add our

name server here that we talked about

from before so we'll

add the name servers here and we will

add an ssl certificate for our email

server too so let's go ahead and take

care of those three things

first let's do the website so if you

come here to the left click on websites

create website or you can uh go through

here on one of these right here

websites and uh create a website

and this is going to be we'll just

select the default package here the

default owner here there's only one

owner

and we'll put in the domain name

site1.xyz and again this is

this is the domain name that's going to

be you know

if i make an email address tony at

site1.xyz that's the email

or that's the domain name that you want

to put here so site1.xyz

um email this is this is just a generic

like

administrator email so i'm just going to

put my personal email here tony

tony teaches dot tech

and a php version really doesn't matter

unless you do plan on hosting a website

here

i'll just pick the latest version and

this is uh

this is where some of the power cyber

panel comes in so we want to

make sure we select dkim support which

if you're not familiar um is a critical

part of

hosting an email server it's one of

those dns records that we need to

make sure is configured properly so

let's go ahead and create this website

and again this is not an actual hosted

website this is just like a container

for a website

there's not going to be any applications

or html pages or anything like that it's

just

setting up some dns records for us okay

so that was successful

check that box let's go on to the next

step and create our name

server so if we go to on the left hand

side or you can go back to the dashboard

here that's where you see

all the options these options are pretty

much listed right here so

you can either click in here do dns and

then

create name server and this is where

we're just going to put in the

information

similar information that we put in where

we bought our domain name from so

um our domain name is site 1.xyz for me

the the first name server is going to be

ns1 dot

and then site1.xyz we'll do the ip

address in a second

and then we'll do ns2.site1.xyz for the

backup name server

and i'm just going to come up here to

the url and copy the ip address

and paste that in here so this is um

this is our self-hosted name server and

this should match up

directly with whatever you typed in at

your

domain name registrar okay so we'll

check that box as well

and now the last thing you want to do is

create the ssl

certificate for our mail server so we

can click on ssl

and then mail server ssl over here and

the website

is site1.xyz this would not show up

unless we added that website from before

so that's another reason that we created

that website

and then click on issue ssl

so now that's going to take a little bit

to do just a few seconds hopefully not

anything more than that

um i believe this also comes from let's

encrypt but i'm not 100

sure this is let's encrypt it's like a

free way to get ssls

um that's done now yep so it confirmed

it does use less encrypt as well okay so

we have all of that in place let's just

do some verification here see what's

working what is

ready to go so if we ping site1.xyz

we get information back that the ip

address is associated with that domain

name

and that is when we when we're making

that ping it's going to go to

our our name server that we just set up

and let's and we can confirm that with

pinging the name server too so ping

let's just ping nameserver1.site1.xyz

and we see that same ip address come

back as well so

that's that's good to go now

the the next part in this tutorial here

actually let's just verify it one more

time with a third party

i'm looking over here at my my outline

here

and we want to check the dns status

before proceeding any for

any any more in this tutorial so

if you go to a website called ultra

tools and we use their dns lookup tool

we can actually see what's going on

under the hood with all of our dns

records so let's type in the domain name

that we're working with

in this case it's site1.xyc hit go

and now you can see some of the the name

nameserver records and some of the a

records

some of the other existing records that

we have set up so far so

we have our ip address here um a text

record for our mail server which is

great that that was automatically

created for us

we have um a bunch of other records like

the name server records here that we

configured when we have another mx

record down here

excuse me and then the same thing for um

the other name server down here so that

looks good and we can actually proceed

uh what i'm going to do is pause the

video here real quick just so i can

understand what the next step of the

tutorial is and then i'll catch back up

with you when i'm ready alright guys so

this next part in the tutorial

is setting up a reverse dns server and

this is a very important part of this

tutorial it's not something you want to

skip over

and basically go what an uh what a

reverse dns server is

is being able to look up

a ip address based on a domain name

whereas like typically you're able to

look up a domain name from an ip address

so it's just the opposite of a typical

dns server and

and where we're going to do this is

within linode where we

set up our initial server so let me let

me just walk you through the process

here so

back here in lynode we want to come

under the networking tab

and by default they have a reverse dns

setup for

something under their domain name here

we want to set this

up with site1.xyz so we can

come in here and edit the reverse dns

settings

and hit er not hit type in site

1.xyz here and save and as long as

everything is configured properly it

will go ahead and save that information

and when i say that as far as your dns

server is configured properly

it'll be able to accept that value so

right here we want to check with a

similar third party tool

uh the status of the reverse dns lookup

so

we can use something here we'll open up

a new tab called

mx toolbox and they have a reverse

lookup tool

and we can hit enter to check that out

and i'm going to type in site

we can't type it's a reverse lookup so

we have to type in the ip address so let

me grab the ip address which

is back here so this ip address ending

in 248

we want to type this in we want to get

back site1.xyz

and this does take some time to to

propagate

so we do see the the old reverse dns

domain name here

um this i you know it varies it could be

anywhere from

five minutes for this to update up to

like 48 hours so

um i'm going to pause the video here and

i'll keep checking the status of this

but when it's finished

we can make sure that we have site1.xyz

here and then we can proceed with the

tutorial so

let's pause and i'll catch back up with

you when that happens okay guys i'm back

about an hour later and the reverse dns

propagation has finished so as you can

see here on the screen

the reverse dns is now associated with

site1.xyz which is perfect that's

exactly what we want so we can go ahead

and proceed with the tutorial

and what we're going to do next is to

create an email address so

let's go into the cyber panel and come

down to

email and create email so i'm going to

make

an email for myself so we'll associate

it with site1.xyz

it'll be tony at site1.xyz

and just for the sake of this tutorial

i'll generate a password

and copy that onto my clipboard we'll

use that and create this email

that's created very good that was really

quick so let's go back

into the email section and access the

webmail

now we can log in tony at site1.xyz

and i'll paste in my password remember

me

hit enter to login and

here we go so this is our email inbox uh

let's test this out let's see

if we can send an email message so if we

go to new message

um i'm gonna send it to tony

at tony teaches dot tech

subject and uh will be actually think i

have something over here

i have a pre formatted email

so i don't just sit here and type it out

for you guys so just uh whoops

didn't want that put the body down here

so dear tony this is an email to test

out my new mail server blah blah blah

cheers tony okay so let's make this

window like

a little bit smaller and i'm going to

bring in my mailbox for

tony at tony teaches text we can see

this happen in real time pretty much

um or however long it takes for this

email to send so let's go ahead

click the send button here and as

everything's set up properly that'll go

ahead and send

and within you know a few seconds we

should see a pop-up and we do

so here it is this is from tony at

siteone.xyz

to tony tonyteachers.tech

and google even recognizes this as

important

which is good good sign that it's not

spam and

it is using the the encryption that we

have set up for it so that's that's

really good

um it works so we'll reply

actually we'll use one of their canned

responses here glad to hear it we'll

send that back over

see if we can not only send messages but

receive matches

messages too and

there's a little bit of delay because of

the the ability to undo the sending of

emails

but if you want to refresh it uh see if

it pops up we can reload the message

list here

and there it is there's a response

coming back from gmail to

our custom email server glad to hear it

okay so that's pretty much all set up

there's one other thing that i just want

to show you guys that maybe

you'll find useful as a tool in the

future

and that is the ability to test the

spamminess of your emails okay

and we can use a a free service called

mail tester so if you open up a new tab

here

mailtester.com like i said test the

spamminess of your emails

if we send an email to this email

address

we can check our spamminess score so um

that's a big part of this because of all

the dns records that are that we were

working with and that we've been talking

about it's a good idea to know

what other i guess email servers

think of your email server as far as

spam because that's a big problem today

is spam with emails and that's what

makes it hard to set up these email

servers so

i'm going to use the same template that

we did before

for our email so i'm just going to copy

that in and paste it in here

and we'll send the email the test email

to that test email address

and that's on its way over there we can

come back over here

check our score for this and

it takes i guess 15 seconds enough for

this

wooden paddle boat to get over to the

palm tree

and we'll see how our score looks

and cross our fingers that we get a 10

out of 10

and we got a 10 out of 10. so

there's a little bit of improvement i

guess

and that is just based on the

fact that we don't have a list

unsubscribe but that's okay

we got a 10 and a 10 for our email

server so that's great

i think that means that we set

everything up properly with cyberpanel

guys i know this was a long tutorial if

you have any questions let me know in

the comments below i'll

do my best to help you out and if you've

got

any value out of this video whatsoever

please give it a thumbs up and subscribe

to this channel

um i make these videos for you guys so

uh in in this one specifically for

a lot of you asking for this type of

video um so i hope you appreciate it

thank you guys for watching i'll see you

in the next video


Comments