SlideShare a Scribd company logo
In this tutorial we are going to setup a local mail server with Postfix, Dovecot & SquirrelMail.
But before we begin installation, let’s learn in brief about mail server.
Postfix is free & open source mail transfer agent (MTA) that routes & delivers Email. It is fast,
secure & easy to administer and is a great alternative to SendMail MTA.
Dovecot is an IMAP and POP3 mail server for Linux. It provides a way for Mail User Agent
(MUAs) to access their mail. Its created to be fast, secure , requires very less administration &
uses very less memory to work.
Squirrelmail provides a graphical interface for sending mail. As you can understand sending &
receiving mail via command line can be bit of a hassle. With the help of Squirrelmail we can
open a console in our web browser for sending & receiving mail.
Pre-requisites
 Remove SendMail (if installed),
To remove previous installation of sendmail, run
$ yum remove sendmail
This is required to remove any conflicts between sendmail & postfix.
 Setup a static IP
A DHCP assigned IP will not work at all, we require a static IP. So make sure we have one, if
using DHCP server, make sure to reserve an IP address for the mail server. Refer to our tutorial
on DHCP server to learn how to reserve IP address.
 Setup a hostname
We will also need a permanent hostname for our server. To change hostname, run
$ hostnamectl set-hostname mail.ltechlab.com
You can also read out tutorial which details 5 ways you can change your system hostname.
 A working DNS server
To use our mail server, we need a working DNS server with mx record entry for our mail server.
To create a new DNS server & adding mx records for mail server, refer our tutorial on DNS
server
 An entry in /etc/host
Open /etc/hosts file & create an entry for our hostname
$ vi /etc/hosts
192.168.1.120 mail.ltechlab.com
 Enable epel-repository
We will need to install epel-repository for installing SquirrelMail on our server. To install epel-
repository
RHEL/CentOS 7
$ rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-10.noarch.rpm
RHEL/CentOS 6 (64 Bit)
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-
8.noarch.rpm
RHEL/CentOS 6 (32 Bit)
$ rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
Step 1 – Installing Postfix
We will install Postfix using yum,
$ yum install postfix
Postfix is now installed & we will now configure it,
Step 2 – Configuring Postfix
Main configuration file for Postfix is ‘/etc/postfix/main.cf’. open the file to make changes to it,
$ vi /etc/postfix/main.cf
myhostname = mail.ltechlab.com # Line 77
mydomain = ltechlab.com # Line 85
myorigin = $mydomain # Line 101
inet_interfaces = all # Line 115
inet_protocols = all # Line 121
#mydestination = $myhostname, localhost.$mydomain, localhost, # Line
166 (comment it)
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain # Line
167 (uncomment)
ynetworks = 192.168.1.0/24, 127.0.0.0/8 # Line 266
home_mailbox = Maildir/ # Line 421
Make sure you make changes as per your domain. Save the file & exit and restart the postfix
service to implement the changes,
$ systemctl restart postfix
$ systemctl enable postfix
Configurations for postfix are complete, next we will test postfix .
Step 3 – Testing Postfix
To test our Postfix setup, we will need a user. So firstly we will add a new user in our machine &
assign it a password,
$ useradd mailuser
$ passwd mailuser
& enter the password of your choosing. Next we will telnet into our our localhost smtp
$ telnet localhost smtp
& you will see a screen with following,
Trying ::1…
Connected to localhost.
Escape character is ‘^]’.
220 mail.ltechlab.com ESMTP Postfix
Now to connect to you mail server, type
ehlo localhost
250-mail.ltechlab.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
To send a mail, type your user name with the following command
mail from:<mailuser>
250 2.1.0 Ok
Then enter recipient mail address
rcpt to:<mailuser>
250 2.1.5 Ok
& enter the mail you want to type
data # will put text in mail body
354 End data with <CR><LF>.<CR><LF>
This is a test mail .
.
After you mail body is complete, type . (dot)
250 2.0.0 Ok: queued as E2B522032F93
To exit from the session, type
quit
221 2.0.0 Bye
Connection closed by foreign host.
Now, let’s check if the user has received any mail or not,
Goto user’s default mail directory for new mails which is /home/dan/Maildir/new. Next list the
directory items in the folder
$ ls
& you should see an item something like
‘2456127891.Grd71I393g3e8I235126.mail.ltechlab.com’, that’s the mail that was sent by user
‘mail user’. To read it, you can use ‘cat’ command.
So, our Postfix is working fine & we will move to configuring Dovecot.
Step 4 Installing & configuring Dovecot
To install Dovecot, use the following command
$ yum install dovecot
Once Dovecot is installed, open its configuration file i.e. ‘/etc/dovecot/dovecot.conf’,
$ vi /etc/dovecot/dovecot.conf
& uncomment the line 24, which is
protocols = imap pop3 lmtp
next open the file ‘/etc/dovecot/conf.d/10-mail.conf’ & again uncomment line 24,
$ vi /etc/dovecot/conf.d/10-mail.conf
mail_location = maildir:~/Maildir
then, open the file ‘/etc/dovecot/conf.d/10-auth.conf’ & make changes as following
$ vi /etc/dovecot/conf.d/10-auth.conf
# line 10 – Uncomment it
disable_plaintext_auth = yes
# line 100—edit it
auth_mechanisms = plain login
& last file to edit is ‘/etc/dovecot/conf.d/10-master.conf’, open it & uncomment then add
‘postfix’ to it,
$ vi /etc/dovecot/conf.d/10-master.conf
mode = 0600
user = postfix
group = postfix
[…]
Now restart dovecot service to implement all the changes we made,
$ systemctl restart dovecot
$ systemctl enable dovecot
Step 5 Testing Dovecot
We will now test dovecot by again logging into our telnet session with POP3
$ telnet localhost POP3
Trying ::1…
Connected to localhost.
Escape character is ‘^]’.
+OK Dovecot ready.
Enter user & password,
user mailuser
+OK
pass *****
+OK Logged in.
To view mail, type
retr 1
+OK 415 octets
Return‐Path: <mailuser@ltechlab.com>
X‐Original‐To: mailuser
Delivered‐To: mailuser@ltechlab.com
Received: from localhost (localhost [IPv6:::1])
by mail.ltechlab.com (Postfix) with ESMTP id D34567837Z13
for <sk>; Fri, 17 Mar 2017 2:41:26 +0530 (IST)
Message‐Id: 2456127891.Grd71I393g3e8I235126.mail.ltechlab.com’
Date: Fri, 17 Mar 2017 2:41:26 +0530 (IST)
From: mailuser@ltechlab.com
This is a test mail .
To quit,
Quit
+OK Logging out.
Connection closed by foreign host.
Our Dovecot is also working fine but as you can see it does not feel right reading mail without
GUI, so let’s install GUI for our mail server using Squirrelmail.
Step 6 Installing & configuring Squirrelmail,
Install Squirrelmail using yum,
$ yum install squirrelmail
To configure squirrelmail , we need to run a script named ‘conf.pl’ located at
‘/usr/share/squirrelmail/config/’
$ cd /usr/share/squirrelmail/config/
$ ./conf.pl
It will then open a configuration wizard with the following options,
SquirrelMail Configuration : Read: config.php (1.4.0)
———————————————————
Main Menu —
1. Organization Preferences
2. Server Settings
3. Folder Defaults
4. General Options
5. Themes
6. Address Books
7. Message of the Day (MOTD)
8. Plugins
9. Database
10. Languages
1. Set pre-defined settings for specific IMAP servers
C Turn color off
S Save data
Q Quit
Select ‘1’ Organisation Preferences & then changes your organization name, again by
selecting ‘1’,
SquirrelMail Configuration : Read: config.php (1.4.0)
———————————————————
Organization Preferences
Organization Name : SquirrelMail
Organization Logo : ../images/sm_logo.png
Org. Logo Width/Height : (308/111)
Organization Title : SquirrelMail $version
Signout Page :
Top Frame : _top
Provider link : http://squirrelmail.org/
Provider name : SquirrelMail
R Return to Main Menu
C Turn color off
S Save data
Q Quit
Set your organization name & press ‘enter’.
Similarly change other settings as well, once done save all the settings by pressing ‘s’. You will
now return first menu on the configuration wizard, we will now change our ‘Server settings ’ by
pressing ‘2’,
SquirrelMail Configuration : Read: config.php (1.4.0)
———————————————————
Server Settings
General
——-
Domain : localhost
Invert Time : false
Sendmail or SMTP : Sendmail
Update IMAP Settings : localhost:143 (uw)
Change Sendmail Config : /usr/sbin/sendmail
R Return to Main Menu
C Turn color off
S Save data
Q Quit
Change your domain name & save it.
SquirrelMail Configuration : Read: config.php (1.4.0)
———————————————————
Server Settings
General
——-
Domain : ltechlab.com
Invert Time : false
Sendmail or SMTP : SMTP
Update IMAP Settings : localhost:143 (uw)
Change Sendmail Config : /usr/sbin/sendmail
R Return to Main Menu
C Turn color off
S Save data
Q Quit
Our configuration for this wizard are now complete, so exit the wizard by typing ‘Q’. Next we
need to create a apache host settings for Squirrelmail in ‘/etc/httpd/conf/httpd.conf’ & enter the
following to the end of the file,
$ vi /etc/httpd/conf/httpd.conf
Alias /webmail /usr/share/squirrelmail
<Directory /usr/share/squirrelmail>
Options Indexes FollowSymLinks
RewriteEngine On
AllowOverride All
DirectoryIndex index.php
Order allow,deny
Allow from all
</Directory>
Save file & restart apache service to implement the changes.
$ systemctl restart httpd
Step 7 Accessing the Webmail
We can now access our webmail by entering the following URL in our web-browser,
http://IPaddress OR domain name/webmail
Then enter your username password & you can now access your webmail. You can read your
mail, compose new mails through webmail. If needed more users, create them as we created our
mailuser.
That’s it guys, you now have a fully functional local mail server. But if you want to send mail
over internet then you need to configure your mail server with a PUBLIC IP & make sure
to ask your ISP to create MX record for your mail server.
If having any issues or questions, please feel free to mention them in the comment box below

More Related Content

What's hot

Basic security &amp; info
Basic security &amp; infoBasic security &amp; info
Basic security &amp; info
Tola LENG
 
Definitive guide to setting up a lamp server using open source software
Definitive guide to setting up a lamp server using open source softwareDefinitive guide to setting up a lamp server using open source software
Definitive guide to setting up a lamp server using open source software
parves kamal
 
Powershell direct
Powershell directPowershell direct
Powershell direct
Naseem Khoodoruth
 
Membangun web server,_e-mail_server_dan_ftp_server
Membangun web server,_e-mail_server_dan_ftp_serverMembangun web server,_e-mail_server_dan_ftp_server
Membangun web server,_e-mail_server_dan_ftp_server
Iwan Kurniarasa
 
Configuration of BIND DNS Server On CentOS 8
Configuration of BIND DNS Server On CentOS 8Configuration of BIND DNS Server On CentOS 8
Configuration of BIND DNS Server On CentOS 8
Kaan Aslandağ
 
Tutorial CentOS 5 untuk Webhosting
Tutorial CentOS 5 untuk WebhostingTutorial CentOS 5 untuk Webhosting
Tutorial CentOS 5 untuk Webhosting
Beni Krisbiantoro
 
SquirrelMail for webmail
SquirrelMail for webmailSquirrelMail for webmail
SquirrelMail for webmail
Aryman Gautam
 
Configure Proxy and Firewall (Iptables)
Configure Proxy and Firewall (Iptables)Configure Proxy and Firewall (Iptables)
Configure Proxy and Firewall (Iptables)
Tola LENG
 
Modul mengamankan jaringan dhcp server menggunakan arp reply only menggunakan...
Modul mengamankan jaringan dhcp server menggunakan arp reply only menggunakan...Modul mengamankan jaringan dhcp server menggunakan arp reply only menggunakan...
Modul mengamankan jaringan dhcp server menggunakan arp reply only menggunakan...
Een Pahlefi
 
Modul quick debserver
Modul quick debserverModul quick debserver
Modul quick debserver
Slamet Achwandy
 
Installing lemp with ssl and varnish on Debian 9
Installing lemp with ssl and varnish on Debian 9Installing lemp with ssl and varnish on Debian 9
Installing lemp with ssl and varnish on Debian 9
عطاءالمنعم اثیل شیخ
 
Modul dhcp server menggunakan mikrotik os
Modul dhcp server menggunakan mikrotik osModul dhcp server menggunakan mikrotik os
Modul dhcp server menggunakan mikrotik os
Een Pahlefi
 
Drupal camp South Florida 2011 - Introduction to the Aegir hosting platform
Drupal camp South Florida 2011 - Introduction to the Aegir hosting platformDrupal camp South Florida 2011 - Introduction to the Aegir hosting platform
Drupal camp South Florida 2011 - Introduction to the Aegir hosting platform
Hector Iribarne
 
Sharing your-internet-connection-on-linux
Sharing your-internet-connection-on-linuxSharing your-internet-connection-on-linux
Sharing your-internet-connection-on-linux
jasembo
 
Apache1.ppt
Apache1.pptApache1.ppt
Apache1.ppt
webhostingguy
 
Open vpn server_linux
Open vpn server_linuxOpen vpn server_linux
Open vpn server_linux
Tola LENG
 
How to set up and Configure Kannel, A quick start
How to set up and Configure Kannel, A quick startHow to set up and Configure Kannel, A quick start
How to set up and Configure Kannel, A quick start
MobME Technical
 
How to install and configure LEMP stack
How to install and configure LEMP stackHow to install and configure LEMP stack
How to install and configure LEMP stack
RootGate
 
Implementing DNS in Samba PDC
Implementing DNS in Samba PDCImplementing DNS in Samba PDC
Implementing DNS in Samba PDC
Jalpa Soni
 
Kannel configuration step by step with Motorolla Razer
Kannel configuration step by step with Motorolla RazerKannel configuration step by step with Motorolla Razer
Kannel configuration step by step with Motorolla Razer
Mahtab Rasheed
 

What's hot (20)

Basic security &amp; info
Basic security &amp; infoBasic security &amp; info
Basic security &amp; info
 
Definitive guide to setting up a lamp server using open source software
Definitive guide to setting up a lamp server using open source softwareDefinitive guide to setting up a lamp server using open source software
Definitive guide to setting up a lamp server using open source software
 
Powershell direct
Powershell directPowershell direct
Powershell direct
 
Membangun web server,_e-mail_server_dan_ftp_server
Membangun web server,_e-mail_server_dan_ftp_serverMembangun web server,_e-mail_server_dan_ftp_server
Membangun web server,_e-mail_server_dan_ftp_server
 
Configuration of BIND DNS Server On CentOS 8
Configuration of BIND DNS Server On CentOS 8Configuration of BIND DNS Server On CentOS 8
Configuration of BIND DNS Server On CentOS 8
 
Tutorial CentOS 5 untuk Webhosting
Tutorial CentOS 5 untuk WebhostingTutorial CentOS 5 untuk Webhosting
Tutorial CentOS 5 untuk Webhosting
 
SquirrelMail for webmail
SquirrelMail for webmailSquirrelMail for webmail
SquirrelMail for webmail
 
Configure Proxy and Firewall (Iptables)
Configure Proxy and Firewall (Iptables)Configure Proxy and Firewall (Iptables)
Configure Proxy and Firewall (Iptables)
 
Modul mengamankan jaringan dhcp server menggunakan arp reply only menggunakan...
Modul mengamankan jaringan dhcp server menggunakan arp reply only menggunakan...Modul mengamankan jaringan dhcp server menggunakan arp reply only menggunakan...
Modul mengamankan jaringan dhcp server menggunakan arp reply only menggunakan...
 
Modul quick debserver
Modul quick debserverModul quick debserver
Modul quick debserver
 
Installing lemp with ssl and varnish on Debian 9
Installing lemp with ssl and varnish on Debian 9Installing lemp with ssl and varnish on Debian 9
Installing lemp with ssl and varnish on Debian 9
 
Modul dhcp server menggunakan mikrotik os
Modul dhcp server menggunakan mikrotik osModul dhcp server menggunakan mikrotik os
Modul dhcp server menggunakan mikrotik os
 
Drupal camp South Florida 2011 - Introduction to the Aegir hosting platform
Drupal camp South Florida 2011 - Introduction to the Aegir hosting platformDrupal camp South Florida 2011 - Introduction to the Aegir hosting platform
Drupal camp South Florida 2011 - Introduction to the Aegir hosting platform
 
Sharing your-internet-connection-on-linux
Sharing your-internet-connection-on-linuxSharing your-internet-connection-on-linux
Sharing your-internet-connection-on-linux
 
Apache1.ppt
Apache1.pptApache1.ppt
Apache1.ppt
 
Open vpn server_linux
Open vpn server_linuxOpen vpn server_linux
Open vpn server_linux
 
How to set up and Configure Kannel, A quick start
How to set up and Configure Kannel, A quick startHow to set up and Configure Kannel, A quick start
How to set up and Configure Kannel, A quick start
 
How to install and configure LEMP stack
How to install and configure LEMP stackHow to install and configure LEMP stack
How to install and configure LEMP stack
 
Implementing DNS in Samba PDC
Implementing DNS in Samba PDCImplementing DNS in Samba PDC
Implementing DNS in Samba PDC
 
Kannel configuration step by step with Motorolla Razer
Kannel configuration step by step with Motorolla RazerKannel configuration step by step with Motorolla Razer
Kannel configuration step by step with Motorolla Razer
 

Similar to Mail

Build your own secure mail server on the cloud using Amazon Web Services
Build your own secure mail server on the cloud using Amazon Web ServicesBuild your own secure mail server on the cloud using Amazon Web Services
Build your own secure mail server on the cloud using Amazon Web Services
ponukumatla joel nishanth
 
Mail server configuration
Mail server configurationMail server configuration
Mail server configuration
chacheng oo
 
Step by step_linux_guide
Step by step_linux_guideStep by step_linux_guide
Step by step_linux_guide
vinod31dec
 
Mail server setup
Mail server setupMail server setup
Mail server setup
Sreenatha Reddy K R
 
Install iRedMail on Red Hat Enterprise Linux, CentOS
Install iRedMail on Red Hat Enterprise Linux, CentOSInstall iRedMail on Red Hat Enterprise Linux, CentOS
Install iRedMail on Red Hat Enterprise Linux, CentOS
InfoExcavator
 
Install iRedMail on Red Hat Enterprise Linux, CentOS
Install iRedMail on Red Hat Enterprise Linux, CentOSInstall iRedMail on Red Hat Enterprise Linux, CentOS
Install iRedMail on Red Hat Enterprise Linux, CentOS
Md Meherab Hossen
 
Migrating to Exchange 2010 and ad 2080 r2
Migrating to Exchange 2010 and ad 2080 r2Migrating to Exchange 2010 and ad 2080 r2
Migrating to Exchange 2010 and ad 2080 r2
Nathan Winters
 
Capistrano Overview
Capistrano OverviewCapistrano Overview
Capistrano Overview
Travis Roberts
 
Lab08Email
Lab08EmailLab08Email
Lab08Email
Robert Klebes
 
Configuring apache, php, my sql, ftp, ssl, ip tables phpmyadmin and server mo...
Configuring apache, php, my sql, ftp, ssl, ip tables phpmyadmin and server mo...Configuring apache, php, my sql, ftp, ssl, ip tables phpmyadmin and server mo...
Configuring apache, php, my sql, ftp, ssl, ip tables phpmyadmin and server mo...
Chanaka Lasantha
 
TrinityCore server install guide
TrinityCore server install guideTrinityCore server install guide
TrinityCore server install guide
Seungmin Shin
 
pop3-imap.ppt
pop3-imap.pptpop3-imap.ppt
pop3-imap.ppt
BilalYounssi
 
pop3-imap.ppt
pop3-imap.pptpop3-imap.ppt
pop3-imap.ppt
JohnMarshall898974
 
Capistrano
CapistranoCapistrano
Capistrano
Travis Roberts
 
Mini CTF workshop dump
Mini CTF workshop dumpMini CTF workshop dump
main
mainmain
DNS,SMTP and POP3
DNS,SMTP and POP3DNS,SMTP and POP3
DNS,SMTP and POP3
Omar Faruk Sazib
 
Linux10 sendmail
Linux10 sendmailLinux10 sendmail
Linux10 sendmail
Jainul Musani
 
How to simplify Email oriented workflow with - Visendo SMTP Extender
How to simplify Email oriented workflow with - Visendo SMTP Extender How to simplify Email oriented workflow with - Visendo SMTP Extender
How to simplify Email oriented workflow with - Visendo SMTP Extender
Johannes Cosmin dumitru
 
A Docker-based Development Environment Even I Can Understand
A Docker-based Development Environment Even I Can UnderstandA Docker-based Development Environment Even I Can Understand
A Docker-based Development Environment Even I Can Understand
Jeremy Gimbel
 

Similar to Mail (20)

Build your own secure mail server on the cloud using Amazon Web Services
Build your own secure mail server on the cloud using Amazon Web ServicesBuild your own secure mail server on the cloud using Amazon Web Services
Build your own secure mail server on the cloud using Amazon Web Services
 
Mail server configuration
Mail server configurationMail server configuration
Mail server configuration
 
Step by step_linux_guide
Step by step_linux_guideStep by step_linux_guide
Step by step_linux_guide
 
Mail server setup
Mail server setupMail server setup
Mail server setup
 
Install iRedMail on Red Hat Enterprise Linux, CentOS
Install iRedMail on Red Hat Enterprise Linux, CentOSInstall iRedMail on Red Hat Enterprise Linux, CentOS
Install iRedMail on Red Hat Enterprise Linux, CentOS
 
Install iRedMail on Red Hat Enterprise Linux, CentOS
Install iRedMail on Red Hat Enterprise Linux, CentOSInstall iRedMail on Red Hat Enterprise Linux, CentOS
Install iRedMail on Red Hat Enterprise Linux, CentOS
 
Migrating to Exchange 2010 and ad 2080 r2
Migrating to Exchange 2010 and ad 2080 r2Migrating to Exchange 2010 and ad 2080 r2
Migrating to Exchange 2010 and ad 2080 r2
 
Capistrano Overview
Capistrano OverviewCapistrano Overview
Capistrano Overview
 
Lab08Email
Lab08EmailLab08Email
Lab08Email
 
Configuring apache, php, my sql, ftp, ssl, ip tables phpmyadmin and server mo...
Configuring apache, php, my sql, ftp, ssl, ip tables phpmyadmin and server mo...Configuring apache, php, my sql, ftp, ssl, ip tables phpmyadmin and server mo...
Configuring apache, php, my sql, ftp, ssl, ip tables phpmyadmin and server mo...
 
TrinityCore server install guide
TrinityCore server install guideTrinityCore server install guide
TrinityCore server install guide
 
pop3-imap.ppt
pop3-imap.pptpop3-imap.ppt
pop3-imap.ppt
 
pop3-imap.ppt
pop3-imap.pptpop3-imap.ppt
pop3-imap.ppt
 
Capistrano
CapistranoCapistrano
Capistrano
 
Mini CTF workshop dump
Mini CTF workshop dumpMini CTF workshop dump
Mini CTF workshop dump
 
main
mainmain
main
 
DNS,SMTP and POP3
DNS,SMTP and POP3DNS,SMTP and POP3
DNS,SMTP and POP3
 
Linux10 sendmail
Linux10 sendmailLinux10 sendmail
Linux10 sendmail
 
How to simplify Email oriented workflow with - Visendo SMTP Extender
How to simplify Email oriented workflow with - Visendo SMTP Extender How to simplify Email oriented workflow with - Visendo SMTP Extender
How to simplify Email oriented workflow with - Visendo SMTP Extender
 
A Docker-based Development Environment Even I Can Understand
A Docker-based Development Environment Even I Can UnderstandA Docker-based Development Environment Even I Can Understand
A Docker-based Development Environment Even I Can Understand
 

More from Md Shihab

Samba
SambaSamba
Samba
Md Shihab
 
Nfs
NfsNfs
Maria db
Maria dbMaria db
Maria db
Md Shihab
 
Iscsi
IscsiIscsi
Iscsi
Md Shihab
 
Dns
DnsDns
Dhcp
DhcpDhcp
Dhcp
Md Shihab
 
Boot
BootBoot
Boot
Md Shihab
 
Rhel 7 root password reset
Rhel 7 root password resetRhel 7 root password reset
Rhel 7 root password reset
Md Shihab
 
Easy vlsm
Easy vlsmEasy vlsm
Easy vlsm
Md Shihab
 
RedHat/CentOs Commands for administrative works
RedHat/CentOs Commands for administrative worksRedHat/CentOs Commands for administrative works
RedHat/CentOs Commands for administrative works
Md Shihab
 
How to transfer core mode into gui in RedHat/centOs
How to transfer core mode into gui in RedHat/centOsHow to transfer core mode into gui in RedHat/centOs
How to transfer core mode into gui in RedHat/centOs
Md Shihab
 
Assignment on windows firewall
Assignment on windows firewallAssignment on windows firewall
Assignment on windows firewall
Md Shihab
 
Assignment on high availability(clustering)
Assignment on high availability(clustering)Assignment on high availability(clustering)
Assignment on high availability(clustering)
Md Shihab
 

More from Md Shihab (13)

Samba
SambaSamba
Samba
 
Nfs
NfsNfs
Nfs
 
Maria db
Maria dbMaria db
Maria db
 
Iscsi
IscsiIscsi
Iscsi
 
Dns
DnsDns
Dns
 
Dhcp
DhcpDhcp
Dhcp
 
Boot
BootBoot
Boot
 
Rhel 7 root password reset
Rhel 7 root password resetRhel 7 root password reset
Rhel 7 root password reset
 
Easy vlsm
Easy vlsmEasy vlsm
Easy vlsm
 
RedHat/CentOs Commands for administrative works
RedHat/CentOs Commands for administrative worksRedHat/CentOs Commands for administrative works
RedHat/CentOs Commands for administrative works
 
How to transfer core mode into gui in RedHat/centOs
How to transfer core mode into gui in RedHat/centOsHow to transfer core mode into gui in RedHat/centOs
How to transfer core mode into gui in RedHat/centOs
 
Assignment on windows firewall
Assignment on windows firewallAssignment on windows firewall
Assignment on windows firewall
 
Assignment on high availability(clustering)
Assignment on high availability(clustering)Assignment on high availability(clustering)
Assignment on high availability(clustering)
 

Recently uploaded

TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
TIPNGVN2
 
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Zilliz
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 

Recently uploaded (20)

TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
 
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 

Mail

  • 1. In this tutorial we are going to setup a local mail server with Postfix, Dovecot & SquirrelMail. But before we begin installation, let’s learn in brief about mail server. Postfix is free & open source mail transfer agent (MTA) that routes & delivers Email. It is fast, secure & easy to administer and is a great alternative to SendMail MTA. Dovecot is an IMAP and POP3 mail server for Linux. It provides a way for Mail User Agent (MUAs) to access their mail. Its created to be fast, secure , requires very less administration & uses very less memory to work. Squirrelmail provides a graphical interface for sending mail. As you can understand sending & receiving mail via command line can be bit of a hassle. With the help of Squirrelmail we can open a console in our web browser for sending & receiving mail. Pre-requisites  Remove SendMail (if installed), To remove previous installation of sendmail, run $ yum remove sendmail This is required to remove any conflicts between sendmail & postfix.  Setup a static IP A DHCP assigned IP will not work at all, we require a static IP. So make sure we have one, if using DHCP server, make sure to reserve an IP address for the mail server. Refer to our tutorial on DHCP server to learn how to reserve IP address.  Setup a hostname We will also need a permanent hostname for our server. To change hostname, run $ hostnamectl set-hostname mail.ltechlab.com You can also read out tutorial which details 5 ways you can change your system hostname.  A working DNS server To use our mail server, we need a working DNS server with mx record entry for our mail server. To create a new DNS server & adding mx records for mail server, refer our tutorial on DNS server  An entry in /etc/host
  • 2. Open /etc/hosts file & create an entry for our hostname $ vi /etc/hosts 192.168.1.120 mail.ltechlab.com  Enable epel-repository We will need to install epel-repository for installing SquirrelMail on our server. To install epel- repository RHEL/CentOS 7 $ rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-10.noarch.rpm RHEL/CentOS 6 (64 Bit) $ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6- 8.noarch.rpm RHEL/CentOS 6 (32 Bit) $ rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm Step 1 – Installing Postfix We will install Postfix using yum, $ yum install postfix Postfix is now installed & we will now configure it, Step 2 – Configuring Postfix Main configuration file for Postfix is ‘/etc/postfix/main.cf’. open the file to make changes to it, $ vi /etc/postfix/main.cf myhostname = mail.ltechlab.com # Line 77 mydomain = ltechlab.com # Line 85 myorigin = $mydomain # Line 101 inet_interfaces = all # Line 115 inet_protocols = all # Line 121 #mydestination = $myhostname, localhost.$mydomain, localhost, # Line
  • 3. 166 (comment it) mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain # Line 167 (uncomment) ynetworks = 192.168.1.0/24, 127.0.0.0/8 # Line 266 home_mailbox = Maildir/ # Line 421 Make sure you make changes as per your domain. Save the file & exit and restart the postfix service to implement the changes, $ systemctl restart postfix $ systemctl enable postfix Configurations for postfix are complete, next we will test postfix . Step 3 – Testing Postfix To test our Postfix setup, we will need a user. So firstly we will add a new user in our machine & assign it a password, $ useradd mailuser $ passwd mailuser & enter the password of your choosing. Next we will telnet into our our localhost smtp $ telnet localhost smtp & you will see a screen with following, Trying ::1… Connected to localhost. Escape character is ‘^]’. 220 mail.ltechlab.com ESMTP Postfix Now to connect to you mail server, type ehlo localhost 250-mail.ltechlab.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN
  • 4. To send a mail, type your user name with the following command mail from:<mailuser> 250 2.1.0 Ok Then enter recipient mail address rcpt to:<mailuser> 250 2.1.5 Ok & enter the mail you want to type data # will put text in mail body 354 End data with <CR><LF>.<CR><LF> This is a test mail . . After you mail body is complete, type . (dot) 250 2.0.0 Ok: queued as E2B522032F93 To exit from the session, type quit 221 2.0.0 Bye Connection closed by foreign host. Now, let’s check if the user has received any mail or not, Goto user’s default mail directory for new mails which is /home/dan/Maildir/new. Next list the directory items in the folder $ ls & you should see an item something like ‘2456127891.Grd71I393g3e8I235126.mail.ltechlab.com’, that’s the mail that was sent by user ‘mail user’. To read it, you can use ‘cat’ command. So, our Postfix is working fine & we will move to configuring Dovecot. Step 4 Installing & configuring Dovecot To install Dovecot, use the following command
  • 5. $ yum install dovecot Once Dovecot is installed, open its configuration file i.e. ‘/etc/dovecot/dovecot.conf’, $ vi /etc/dovecot/dovecot.conf & uncomment the line 24, which is protocols = imap pop3 lmtp next open the file ‘/etc/dovecot/conf.d/10-mail.conf’ & again uncomment line 24, $ vi /etc/dovecot/conf.d/10-mail.conf mail_location = maildir:~/Maildir then, open the file ‘/etc/dovecot/conf.d/10-auth.conf’ & make changes as following $ vi /etc/dovecot/conf.d/10-auth.conf # line 10 – Uncomment it disable_plaintext_auth = yes # line 100—edit it auth_mechanisms = plain login & last file to edit is ‘/etc/dovecot/conf.d/10-master.conf’, open it & uncomment then add ‘postfix’ to it, $ vi /etc/dovecot/conf.d/10-master.conf mode = 0600 user = postfix group = postfix […] Now restart dovecot service to implement all the changes we made, $ systemctl restart dovecot $ systemctl enable dovecot Step 5 Testing Dovecot We will now test dovecot by again logging into our telnet session with POP3 $ telnet localhost POP3 Trying ::1… Connected to localhost.
  • 6. Escape character is ‘^]’. +OK Dovecot ready. Enter user & password, user mailuser +OK pass ***** +OK Logged in. To view mail, type retr 1 +OK 415 octets Return‐Path: <mailuser@ltechlab.com> X‐Original‐To: mailuser Delivered‐To: mailuser@ltechlab.com Received: from localhost (localhost [IPv6:::1]) by mail.ltechlab.com (Postfix) with ESMTP id D34567837Z13 for <sk>; Fri, 17 Mar 2017 2:41:26 +0530 (IST) Message‐Id: 2456127891.Grd71I393g3e8I235126.mail.ltechlab.com’ Date: Fri, 17 Mar 2017 2:41:26 +0530 (IST) From: mailuser@ltechlab.com This is a test mail . To quit, Quit +OK Logging out. Connection closed by foreign host. Our Dovecot is also working fine but as you can see it does not feel right reading mail without GUI, so let’s install GUI for our mail server using Squirrelmail. Step 6 Installing & configuring Squirrelmail, Install Squirrelmail using yum, $ yum install squirrelmail To configure squirrelmail , we need to run a script named ‘conf.pl’ located at ‘/usr/share/squirrelmail/config/’
  • 7. $ cd /usr/share/squirrelmail/config/ $ ./conf.pl It will then open a configuration wizard with the following options, SquirrelMail Configuration : Read: config.php (1.4.0) ——————————————————— Main Menu — 1. Organization Preferences 2. Server Settings 3. Folder Defaults 4. General Options 5. Themes 6. Address Books 7. Message of the Day (MOTD) 8. Plugins 9. Database 10. Languages 1. Set pre-defined settings for specific IMAP servers C Turn color off S Save data Q Quit Select ‘1’ Organisation Preferences & then changes your organization name, again by selecting ‘1’, SquirrelMail Configuration : Read: config.php (1.4.0) ——————————————————— Organization Preferences Organization Name : SquirrelMail Organization Logo : ../images/sm_logo.png Org. Logo Width/Height : (308/111) Organization Title : SquirrelMail $version Signout Page : Top Frame : _top Provider link : http://squirrelmail.org/ Provider name : SquirrelMail
  • 8. R Return to Main Menu C Turn color off S Save data Q Quit Set your organization name & press ‘enter’. Similarly change other settings as well, once done save all the settings by pressing ‘s’. You will now return first menu on the configuration wizard, we will now change our ‘Server settings ’ by pressing ‘2’, SquirrelMail Configuration : Read: config.php (1.4.0) ——————————————————— Server Settings General ——- Domain : localhost Invert Time : false Sendmail or SMTP : Sendmail Update IMAP Settings : localhost:143 (uw) Change Sendmail Config : /usr/sbin/sendmail R Return to Main Menu C Turn color off S Save data Q Quit Change your domain name & save it. SquirrelMail Configuration : Read: config.php (1.4.0) ——————————————————— Server Settings General ——- Domain : ltechlab.com Invert Time : false Sendmail or SMTP : SMTP Update IMAP Settings : localhost:143 (uw) Change Sendmail Config : /usr/sbin/sendmail R Return to Main Menu C Turn color off
  • 9. S Save data Q Quit Our configuration for this wizard are now complete, so exit the wizard by typing ‘Q’. Next we need to create a apache host settings for Squirrelmail in ‘/etc/httpd/conf/httpd.conf’ & enter the following to the end of the file, $ vi /etc/httpd/conf/httpd.conf Alias /webmail /usr/share/squirrelmail <Directory /usr/share/squirrelmail> Options Indexes FollowSymLinks RewriteEngine On AllowOverride All DirectoryIndex index.php Order allow,deny Allow from all </Directory> Save file & restart apache service to implement the changes. $ systemctl restart httpd Step 7 Accessing the Webmail We can now access our webmail by entering the following URL in our web-browser, http://IPaddress OR domain name/webmail Then enter your username password & you can now access your webmail. You can read your mail, compose new mails through webmail. If needed more users, create them as we created our mailuser. That’s it guys, you now have a fully functional local mail server. But if you want to send mail over internet then you need to configure your mail server with a PUBLIC IP & make sure to ask your ISP to create MX record for your mail server. If having any issues or questions, please feel free to mention them in the comment box below