Mr.Kriangsak Namkot
Trainer& Director Jodoi IT&Service Co.,Ltd.
[email protected] [email protected]
http://www.jodoi.com
Linux Administrator (Advance)
Linux Admin II
Day 2
9:00
น
. - 12.00น. -
Mail Server ( postfix,dovicot ) 10:30น
. - 10.45น. -
Coffee Break10.45
น
. - 12.00น. -
Mail Server ( postfix,dovicot ) 12.00น
. - 13.00น. -
Lunch13.00
น
. - 14.30น. -
Webmail ( Squirrelmail ) 14.30น
. - 14.45น. -
Coffee BreakMail Server
Mail Server
- SMTP server à SMTP (Simple mail transfer protocol) server is a computer that receives outgoing mail messages from users and routes them to their intended recipients. - POP server à POP (Post Office Protocol) mail refers to
email software on your personal computer that sends and receives mail via a shared computer's electronic post office. - IMAP Serverà IMAP (Internet Message Access Protocol)
is a protocol for retrieving email messages and working with mailboxes on a mail server using an email client
Postfix Mail Server
Postfix SMTP Server Remove sendmail
[root@jodoi-server html]# /etc/init.d/sendmail stop Shutting down sm-client: [ OK ]
Shutting down sendmail: [ OK ]
[root@jodoi-server html]# yum remove sendmail
Install postfix
[root@jodoi-server html]# yum install postfix
or
Postfix Mail Server
[root@jodoi-server /]# vi /etc/postfix/main.cf #myhostname = host.domain.tld #myhostname = virtual.domain.tld myhostname = jodoi-server.com #mydomain = domain.tld mydomain = jodoi-server.com #myorigin = $mydomain myorigin = $mydomainPostfix Mail Server
#inet_interfaces = allinet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost
#mynetworks = 168.100.189.0/28, 127.0.0.0/8 mynetworks = 192.168.1.0/24, 127.0.0.0/8
Postfix Mail Server
[root@jodoi-server /]# /etc/init.d/postfix start Starting postfix: [ OK ][root@jodoi-server html]# netstat -anp |grep 25
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 5527/master [root@jodoi-server /]# ps -ef |grep postfix
root 4463 1 0 16:16 ? 00:00:00 /libexec/postfix/master postfix 4464 4463 0 16:16 ? 00:00:00 pickup -l -t fifo -u postfix 4465 4463 0 16:16 ? 00:00:00 qmgr -l -t fifo -u root 4586 2472 0 16:50 pts/0 00:00:00 grep postfix
Postfix Mail Server
Testing [root@jodoi-server /]# telnet 192.168.1.200 25 Trying 192.168.1.200... Connected to 192.168.1.200 (192.168.1.200). Escape character is '^]'. helo jodoi-server.com mail from:[email protected] rcpt to:[email protected] data test mail . quit 221 2.0.0 Bye
Postfix Mail Server
[
root@jodoi-server /]# tail -f /var/log/maillogAug 14 16:22:32 jodoi-server postfix/qmgr[4465]: 315E927BD1: removed Aug 14 16:51:47 jodoi-server postfix/smtpd[4590]: connect from
unknown[192.168.1.200]
Aug 14 16:52:23 jodoi-server postfix/smtpd[4590]: 84A7927BC7: client=unknown[192.168.1.200]
Aug 14 16:52:35 jodoi-server postfix/cleanup[4595]: 84A7927BC7: message-id=<[email protected]> Aug 14 16:52:35 jodoi-server postfix/qmgr[4465]: 84A7927BC7:
from=<[email protected]>, size=354, nrcpt=1 (queue active) Aug 14 16:52:35 jodoi-server postfix/local[4596]: 84A7927BC7:
to=<[email protected]>, relay=local, delay=23,
delays=22/0.07/0/0.01, dsn=2.0.0, status=sent (delivered to mailbox) Aug 14 16:52:35 jodoi-server postfix/qmgr[4465]: 84A7927BC7: removed Aug 14 16:52:39 jodoi-server postfix/smtpd[4590]: disconnect from
unknown[192.168.1.200]
Dovecot POP3/IMAP Server
[root@jodoi-server ~]# rpm -q dovecotdovecot-1.0-1.2.rc15.el5
[root@jodoi-server html]# yum install dovecot
or
[root@jodoi-server ~]# rpm -ivh dovecot-1.0.7-2.el5.i386.rpm [root@jodoi-server /]# vi /etc/dovecot.conf
#protocols = imap imaps pop3 pop3s protocols = imap pop3
Dovecot POP3/IMAP Server
[root@jodoi-server /]# /etc/init.d/dovecot start Starting Dovecot Imap: [ OK ][root@jodoi-server /]# netstat -anp|grep dovecot tcp 0 0 :::110 :::* LISTEN 4746/dovecot tcp 0 0 :::143 :::* LISTEN 4746/dovecot
Dovecot POP3/IMAP Server
[root@jodoi-server /]# telnet 192.168.1.200 110 Trying 192.168.1.200...
Connected to 192.168.1.200 (192.168.1.200). Escape character is '^]'.
+OK Dovecot ready. user jodoi
+OK pass xxxxx +OK Logged in. list
+OK 18 messages: 1 1439
2 3250 quit
+OK Logging out.
Mail Server
Squirrelmail Web Mail
Squirrelmail
http://www.squirrelmail.org/download.php
[root@jodoi-server ~]# wget
http://voxel.dl.sourceforge.net/sourceforge/squirrelmail/ squirrelmail-1.4.15.tar.gz
[root@jodoi-server ~]# tar -zxvf squirrelmail-1.4.15.tar.gz [root@jodoi-server ~]# mv squirrelmail-1.4.15 squirrelmail [root@jodoi-server squirrelmail]# pwd
Squirrelmail Web Mail
[root@jodoi-server config]# pwd/var/www/html/squirrelmail/config
[root@jodoi-server config]# rm -f config.php [root@jodoi-server config]# ./conf.pl
config 3 Menu
1. Organization Preferences 2. Server Settings and 3. General Options
Squirrelmail Web Mail
1. Organization Preferences
SquirrelMail Configuration : Read: config_default.php (1.4.0)
---Organization Preferences
1. Organization Name : Jodoi Webmail
2. Organization Logo : ../images/sm_logo.png 3. Org. Logo Width/Height : (308/111)
Squirrelmail Web Mail
2. Server Settings
SquirrelMail Configuration : Read: config_default.php (1.4.0)
---Server Settings General
---1. Domain : jodoi-server.com 2. Invert Time : false
3. Sendmail or SMTP : SMTP
A. Update IMAP Settings : localhost:143 (other) B. Update SMTP Settings : localhost:25
Squirrelmail Web Mail
3. General Options
SquirrelMail Configuration : Read: config.php (1.4.0)
---General Options
1. Data Directory : /var/www/html/squirrelmail/data/ 2. Attachment Directory : /var/www/html/squirrelmail/data/ 3. Directory Hash Level : 0
4. Default Left Size : 150
Squirrelmail Web Mail
S Save dataQ Quit
Command >> s
Data saved in config.php Press enter to continue...
Command >> q
[root@jodoi-server config]# chmod -fR 777
/var/www/html/squirrelmail/data/
[root@jodoi-server config]# service httpd restart Stopping httpd: [ OK ]
Starting httpd: [ OK ]