shell script to setup email server on centos

I want  a bash script which will automatically setup a given domain on fresh centos installation so server can receive emails for that domain.

is there any such script? or please guide me how I can do it.
LVL 6
nasirbestAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cjl7freelance for hireCommented:
What mail-server are you running?

If you are running postfix all you need to do is add a domain-name to a line in the config file and do a 'postfix reload'.

But you might wanna run vusers for your mailserver?

//jonas
0
jar3817Commented:
A fresh centos install is probably running sendmail. All you have to do is add the domain to /etc/mail/local-host-names and restart sendmail:

# echo "domainname.com" >> /etc/mail/local-host-names && /etc/rc.d/init.d/sendmail restart

If you have iptables running, you might need to add a rule to allow incoming tcp/25. Add this line to /etc/sysconfig/iptables above the last reject/drop rule:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT

Then restart iptables too: # /etc/rc.d/init.d/iptables restart
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nasirbestAuthor Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.