/ 中存储网

RHEL系统中安装配置sendmail服务和dovecot服务

2014-12-28 20:14:02 来源:中存储网

[root@localhost ~]# rpm -q m4
m4-1.4.5-3.el5.1
[root@localhost ~]# rpm -q sendmail
sendmail-8.13.8-2.el5

[root@localhost ~]# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@localhost ~]# rpm -ivh /mnt/Server/sendmail-cf-8.13.8-2.el5.i386.rpm
warning: /mnt/Server/sendmail-cf-8.13.8-2.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
1:sendmail-cf            ########################################### [100%]
[root@localhost ~]# vi /etc/mail/sendmail.mc
dnl # The following causes sendmail to only listen on the IPv4 loopback address
dnl # 127.0.0.1 and not on any other network devices. Remove the loopback
dnl # address restriction to accept email from the internet or intranet.
dnl #
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl

此处将原先的本机回环地址修改为侦听任意的IP地址

TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl

此处将前面dn1删除掉表示启用smtp认证,且认证的方式为本机认证

[root@localhost ~]# netstat -ntpl |grep sendmail
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1894/sendmail: acce

[root@localhost ~]# service saslauthd restart
Stopping saslauthd:                                        [ OK ]
Starting saslauthd:                                        [ OK ]

[root@localhost ~]# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

[root@localhost ~]# service sendmail restart
Shutting down sm-client:                                   [ OK ]
Shutting down sendmail:                                    [ OK ]
Starting sendmail:                                         [ OK ]
Starting sm-client:                                        [ OK ]
[root@localhost ~]# netstat -ntpl |grep sendmail
tcp        0      0 0.0.0.0:25                  0.0.0.0:*                   LISTEN      2909/sendmail: acce

[root@localhost ~]# groupadd mailuser
[root@localhost ~]# useradd -g mailuser -s /sbin/nologin a
[root@localhost ~]# useradd -g mailuser -s /sbin/nologin b
[root@localhost ~]# passwd a
Changing password for user a.
New UNIX password:
BAD PASSWORD: it is WAY too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]# passwd b
Changing password for user b.
New UNIX password:
BAD PASSWORD: it is WAY too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

[root@localhost ~]# rpm -q dovecot
package dovecot is not installed

[root@localhost ~]# rpm -ivh /mnt/Server/dovecot-1.0-1.2.rc15.el5.i386.rpm
warning: /mnt/Server/dovecot-1.0-1.2.rc15.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
        libmysqlclient.so.15 is needed by dovecot-1.0-1.2.rc15.el5.i386
libmysqlclient.so.15(libmysqlclient_15) is needed by dovecot-1.0-1.2.rc15.el5.i386
        libpq.so.4 is needed by dovecot-1.0-1.2.rc15.el5.i386BT无线网络破解教程

[root@localhost ~]# rpm -ivh /mnt/Server/perl-DBI-1.52-1.fc6.i386.rpm
warning: /mnt/Server/perl-DBI-1.52-1.fc6.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
1:perl-DBI               ########################################### [100%]

[root@localhost ~]# rpm -ivh /mnt/Server/mysql-5.0.22-2.1.i386.rpm
warning: /mnt/Server/mysql-5.0.22-2.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
1:mysql                  ########################################### [100%]
[root@localhost ~]# rpm -ivh /mnt/Server/postgresql-libs-8.1.4-1.1.i386.rpm
warning: /mnt/Server/postgresql-libs-8.1.4-1.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
1:postgresql-libs        ########################################### [100%]
[root@localhost ~]# rpm -ivh /mnt/Server/dovecot-1.0-1.2.rc15.el5.i386.rpm
warning: /mnt/Server/dovecot-1.0-1.2.rc15.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
1:dovecot                ########################################### [100%]

[root@localhost ~]# vi /etc/dovecot.conf思科学习视频资料下载中心

# Protocols we want to be serving: imap imaps pop3 pop3s
# If you only want to use dovecot-auth, you can set this to "none".
protocols = imap imaps pop3 pop3s

[root@localhost ~]# service dovecot start
Starting Dovecot Imap:                                     [ OK ]

[root@localhost ~]# netstat -ntpl |grep 110
tcp        0      0 :::110                      :::*                        LISTEN      3087/dovecot

 思科路由器配置

如果要使sendmail能和外部的邮件系统能够相互收发邮件首先要有mx交换记 录,其次,在sendmail服务器上还要做下列设置:思科路由器交换机

[root@localhost ~]# cat /etc/mail/access (设置为本地内网IP,192.168.0.0/24网段的IP进行中继)
# Check the /usr/share/doc/sendmail/README.cf file for a description
# of the format of this file. (search for access_db in that file)
# The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc
# package.
#
# by default we allow relaying from localhost...
Connect:localhost.localdomain           RELAY
Connect:localhost                       RELAY
Connect:127.0.0.1                       RELAY
Connect:192.168.0                       RELAY思科路由器交换机模拟软件

[root@localhost ~]# makemap hash /etc/mail/access.db < /etc/mail/access (生成数据库文件)

[root@localhost ~]# cat /etc/mail/local-host-names (设置本地域名)
# local-host-names - include all aliases for your machine here.
yang.com