Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to install a mail server on my root server. I'm relative new to Linux but not a absolute beginner. There are many many how to's on the internet I tried to get my own mail server with IMAP/SMTP. Also maybe some virus/spam detection.

I've got a Root Server (CentOS 6.4) and a own domain (let us say 'morekings.com').

I want to have some email adresses (admin@morekings.com, peter@morekings.com, etc). Nice would be some kind of encryption (ssl/tsl). But I have no official cert.

Roughly speaking I removed sendmail, installed postfix and cyrus and configured it. Among others for example I tried this tutorial https://www.digitalocean.com/community/articles/how-to-install-postfix-on-centos-6

In main.cf of Postfix I used this:

myhostname              = mail.morekings.com 
mydomain                = morekings.com

Is this right?

At least I got it to send mails via Thunderbird and send/receive via telnet. But I'm not so sure about that what I'm doing.

Now I'm looking for some guides which will get me working this. Also some guides which get me into this topic.

share|improve this question
I put this tutorial together a while ago for setting up a mail server on CentOS 5 which might be helpful for you: lamolabs.org/blog/226/how-to-setup-a-mail-server-on-centos-5. I use sendmail in the tutorial, not postfix but it still might be helpful for you. – slm Jun 28 '13 at 2:32

myhostname: is the host name of the system (i.e, the system is called mail or mail.example.com). You can find it in /etc/hosts or /etc/hostname

mydomain: is the domain name for the email server (it can be a real or fake domain name). So when you add a mail user foo for your configuration his mail will be foo@morekings.com. If you set it like mydomain=mail.morekings.com than it will be *foo@mail.morekings.com*... If you usemyorigin = $mydomain`

This is the default settings on postfix, if you don't specify mydomain.

See here

share|improve this answer
first line is for IPv4, so consider changing your hostname like, for example, mail.morekings.com mailmorekings localhost.localdomain localhost, change HOSTNAME=mail.morekings.com in /etc/sysconfig/network and do /etc/init.d/network restart or like in example here . Ofcourse if you have public IP or you will be relaying you mail to some other server, you need to tell your DNS that mail.morekings.com has that IP. – mirkobrankovic Jun 28 '13 at 13:11
Sorry that I deleted my comment. I just wanted edit it again but it wasnt possible anymore. I'm really new to this stackexchange network. I know this is a little bit off topic and doesnt treat my question but: Why do I have to change my hosts file? www.morekings.com forwards to my public IP adress already. Is it just for internal behaviors? In my etc/sys/config/network also only is this line: NETWORKING=yes. I guess I have to read some more about this. Do you maybe have some helpfull article for me? – HeyILikeYouAlot Jun 28 '13 at 13:15
what is the output of hostname, if you already registered that hostname with your DNS, than in postfix: myhostname=<output you get from hostname>, and if it's morekings.com than keep mydomain=morekings.com. If this isn't mail server only – mirkobrankovic Jun 28 '13 at 13:23
hostname is xxxxx.servers.jiffybox.de which is not my morekings.com but the adress which is given from my root server provider. – HeyILikeYouAlot Jun 28 '13 at 13:26

Take a look at the ISPmail tutorials, their are made for Debian releases but it's easy to modify them for CentOS. They are not only explaining how to install and configure basic services but how to put them all together in to a professional mail server with antivirus and spam filters.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.