Here we will see about the installation of a basic SMTP server on
Ubuntu
$ sudo apt-get update
# apt-get update –fix-missing
# apt-get install bind9 dnsutils apache2 php5 postfix dovecot-common
dovecot-imapd dovecot-pop3d squirrelmail
|
Click okay for Internet Site
Let us cd /etc/bind
# vim named.conf.local be
very careful about the style of quotes it is a normal double quote msword
will put curly quotes which will not get interpreted correctly.
zone “mark.net” {
type master;
file “/etc/bind/db.mark”;
};
zone “0.168.192.in-addr.arpa” {
type master;
file “/etc/bind/db.192”;
};
|
# cp db.local db.mark
# cp db.127 db.192
# vim db.mark
$TTL 604800
@ IN SOA
ns.mark.net. root.mark.net. (
2 ; Serial
604800 ; Refresh
86400 ;
Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN
NS ns.mark.net.
@ IN
A 192.168.0.1
ns IN
A 192.168.0.1
IN
MX 10 mail.mark.net.
www IN CNAME
ns
mail IN CNAME
ns
|
# vim db.192
$TTL 604800
@ IN SOA
ns.mark.net. root.mark.net. (
1 ; Serial
604800 ; Refresh
86400 ;
Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN
NS ns.mark.net.
1 IN
PTR ns.mark.net
|
Now we will restart bind9
# invoke-rc.d bind9 restart
Now when we do nslookup mail.mark.net we should get
the IP of our mail server.
When we do a dig mail.mark.net we should get
answers from mark.db file of bind9 conf.
Now let us work on the configuration of apache2
configuration file.
# cd /etc/apache2/sites-available/
# ls -l
# cp default mail.conf
# vim mail.conf
Now under VirutalHost directive under ServerAdmin let add the first
line and update DocumentRoot
ServerAdmin
webmaster@localhost
ServerName mail.mark.net
DocumentRoot
/usr/share/squirrelmail
# Change the next Directory line as shown below.
|
Next we should try to enable that site with #
a2ensite mail
Then try to reload apache2 service.
service apache2 reload
Now let us try to reconfigure postfix
# dpkg-reconfigure postfix
Select Localonly and press Okay
Then for System mail name: “mail.mark.net” and press OK.
Then for Root and postmaster don’t give anything and press OK.
Then for other destination to accept mail for change the line to
mail.mark.net, mark-virtual-machine, localhost.localdomain, ,
localhost, mark.net
Then for “Force synchronous updates on mail queue” press No
Then in Local networks append 192.168.0.0/24 network
Then leave the mailox size limit at 0 bytes.
Then leave the * for Local address extension character and press Ok.
Then for Internet Protocols to use press all and press OK.
|
Now let us edit the squirrelmail’s apache configuration
file.
# vim /etc/squirrelmail/apache.conf
Go down and uncomment
DocumentRoot /usr/share/squirrelmail
Edit the next line to this
ServerName mail.mark.net
vim.tiny /etc/squirrelmail/config.php
$imapServerAddress =
'192.168.56.102';
$smtpServerAddress =
'192.168.56.102';
|
Now let us start editing the Dovecot configuration file.
# vim /etc/dovecot/dovecot.conf
Go to the very bottom of the file and start typing
protocols = imap pop3
#disable_plaintext_auth = no
mail_location = mbox:~/mail:INBOX=/var/mail/%u
#mail_location = maildir: ~/Maildir
|
Change this line alone in /etc/postfix/main.cf
inet_interfaces = 192.168.56.102,127.0.0.1
Now that all configuration is over let us restart all the
processes.
# killall named
# killall apache2
# killall dovecot
# invoke-rc.d bind9 restart
# invoke-rc.d apache2 restart
# invoke-rc.d postfix restart
# invoke-rc.d dovecot restart
|
Now let us create a couple of users to try logging in as
them for email transaction.
# adduser bala1
# adduser bala2
|