Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2897541
  • 博文数量: 454
  • 博客积分: 4860
  • 博客等级: 上校
  • 技术积分: 6375
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-13 10:08
个人简介

10年工作经验,专研网站运维。

文章分类

全部博文(454)

文章存档

2017年(11)

2016年(13)

2015年(47)

2014年(36)

2013年(147)

2012年(64)

2011年(136)

分类: LINUX

2011-05-19 21:04:24

1、搭建dns服务器
yum install -y bind bind*
vim /var/named/chroot/var/named/my120.com.zone
添加 :
www             IN A            192.168.0.58
@              IN MX    5       .
2、安装软件包:
yum install sendmail
yum install m4
yum install sendmail*
yum install sendmail-cf
yum install sendmail-doc
yum install sendmail-devel
yum install dovecot
/etc/init.d/sendmail restart
/etc/init.d/dovecot restart
/etc/init.d/saslauthd restart
chkconfig --level 35 sendmail on
chkconfig --level 35 dovecot on
chkconfig --level 35 saslauthd on
netstat -anp | grep 25
netstat -anp | grep 110
tail -l /etc/hosts
192.168.1.201 sendmail.cxkj.com sendmail
cd /etc/mail
ls
cat access   在数据库配置文件中进行内容的配置
makemap hash access.db < access   使用makemap命令将数据库配置文件生成对应的数据库文件
/etc/init.d/sendmail restart
tail -f /var/log/maillog
vim /etc/mail/local-host-names
cxkj.com
yum install perl
yum install perl*
yum install perl-CGI
yum install perl-CGI-SpeedyCGI
yum install perl-Compress-Raw-Zlib
yum install perl-libnet
yum install perl-MIME-Base64
yum install perl-suidperl
yum install perl-Text-Iconv
通过报错信息,安装所需软件,所需软件已经下载到本地了!
把所需要的7个软件包复制到服务器上:
rpm -ivh --force perl*.rpm
[root@ser ~]# vim /etc/yum.repos.d/openwebmail.repo 
[openwebmail]
## Thomas Chung
## 2008.05.29
name=Openwebmail for Fedora or Enterprise Linux
baseurl=
enabled=1
gpgcheck=1
gpgkey=RPM-GPG-KEY-openwebmail
#metadata_expire=0
若这样安装不成功,先安装 perl-Text-Iconv-1.4-1.2.el4.rf.i386.rpm
[root@ser ~]#  yum -y  install openwebmail
[root@ser ~]# cd /var/www/cgi-bin/openwebmail/etc
修改openwebmail 的一些配置文件
[root@ser etc]# vim dbm.conf
dbm_ext                 .db
dbmopen_ext             .db
dbmopen_haslock         no
[root@ser etc]]# cd defaults/
[root@ser defaults]#  vim dbm.conf
dbm_ext                 .db
dbmopen_ext             .db
dbmopen_haslock         yes
smtpserver  192.168.1.2
 rpm -e perl-suidperl-5.8.8-32.el5_6.3.x86_64
 yum install perl-suidperl
[root@ser ~]# cd /var/www/cgi-bin/openwebmail/
[root@ser openwebmail]#
/var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init  #出现Y/N时 ,按N.
如果不好用,就把这7个软件包,rpm -ivh一遍,不用--force参数,或者,yum安装一遍,或者先rpm -e,然后在yum安装,在rpm安装!!!
cd /var/www/cgi-bin/openwebmail/etc/defaults
[root@ser defaults]#  vim openwebmail.conf
domainnames             yjw.com
smtpserver              192.168.1.2
authpop3_server         192.168.1.2
再次初始化openwebmail
[root@ser defaults]# cd  ../../
/var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init
出现Y/N 时,按Y。

cd /etc/mail
vim /etc/mail/sendmail.mc
修改如下项:
a、删除这一行注释“dnl”
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
b、将127.0.0.1 改为 0.0.0.0
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
c、修改域,找到LOCAL_DOMAIN(`localhost.localdomain')dnl此行,       将其改为LOCAL_DOMAIN(`rhel5.com.cn')dnl
m4 sendmail.mc > sendmail.cf
/etc/init.d/sendmail restart
service saslauthd restart
groupadd mailuser
adduser -g mailuser -s /sbin/nologin mike
adduser -g mailuser -s /sbin/nologin john
passwd mike
passwd john
注意:创建用户的时候不要使用大写字母,否则邮件认证不能通过,用户名全部使用小写字母。
4、设置别名:
vim /etc/aliases
group:          liuyi,zhengdi,fengguangping
使用命令 : newaliases 生成aliases.db文件。

7、vim /usr/lib/sasl2/Sendmail.conf( 认证方式 )
pwcheck_method:saslauthd
/etc/init.d/saslauthd restart
cd /etc/mail
m4 sendmail.mc > sendmail.cf
vim /etc/mail/sendmail.mc
修改成如下:
原来的:DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')

修改成的:DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')

/etc/init.d/sendmail restart
8、配置dovecot :
vim /etc/dovecot.conf
把 protocols = imap imaps pop3 pop3s 前面的#去掉。
chkconfig --level 35 dovecot on
8、重启所需服务
/etc/init.d/sendmail restart
/etc/init.d/dovecot restart
/etc/init.d/saslauthd restart
/etc/init.d/iptables stop

yum install -y httpd
11、给openwebmail目录和文件相应权限 (先不做试试)
cd /usr/local/apache2/htdocs/cgi-bin/openwebmail
chmod -R 4755 openwebmail.pl
chmod -R 4755 openwebmail.pl
chmod -R 4755 openwebmail-main.pl
chmod -R 4755 openwebmail*
chmod -R 4777 /var/www/cgi-bin/openwebmail/etc/sessions/
chmod -R 4755 /var/www/
chmod -R 4777 /var/www/cgi-bin/openwebmail/openwebmail-read.pl
chmod -R 4755 /var/www/cgi-bin/openwebmail/*
chmod -R 4755 /usr/local/apache2/htdocs/cgi-bin/openwebmail/*
chmod -R 4777 /var/www/cgi-bin/openwebmail/etc/sessions/
vim /var/www/cgi-bin/openwebmail/etc/openwebmail.conf
domainnames     auto    修改为
domainnames     cxkj.com
default_language    en     修改为
default_language    zh_CN.GB2312
default_iconset     Cool3D.English   修改为
default_iconset     Cool3D.Chinese.Simplified
12、设置开机自动运行:
chkconfig --level 35 sendmail on
chkconfig --level 35 dovecot on
chkconfig --level 35 saslauthd on
13、访问地址:


vim /usr/local/apache2/conf/httpd.conf
ScriptAlias  /mail    /var/www/cgi-bin/openwebmail/openwebmail.pl 用下面的,不用这个
ScriptAlias  /mail    /usr/local/apache2/cgi-bin/openwebmail/openwebmail.pl

二、使用源码安装的apache发布

cp -rap /var/www/cgi-bin/ /usr/local/apache2/
cp -rap /var/www/cgi-bin /usr/local/apache2/htdocs/  不用试试
cp -rap /var/www/data /usr/local/apache2/htdocs/   不用试试
/usr/local/apache2/htdocs/cgi-bin/openwebmail/openwebmail-tool.pl --init
cd /usr/local/apache2/htdocs/cgi-bin/openwebmail
chmod -R 4755 openwebmail.pl
chmod -R 4755 openwebmail.pl
chmod -R 4755 openwebmail-main.pl
chmod -R 4755 openwebmail*
chmod -R 4777 /var/www/cgi-bin/openwebmail/etc/sessions/
chmod -R 4755 /var/www/
chmod -R 4777 /var/www/cgi-bin/openwebmail/openwebmail-read.pl
chmod -R 4755 /var/www/cgi-bin/openwebmail/*
chmod -R 4755 /usr/local/apache2/htdocs/cgi-bin/openwebmail/*
chmod -R 4777 /var/www/cgi-bin/openwebmail/etc/sessions/
/usr/local/apache2/bin/apachectl restart


二、配置多个邮件服务器。
vim /etc/mail/local-host-names
把你想添加的域名添加即可:
# local-host-names - include all aliases for your machine here.
315zf.com
315zf.org
保存退出。
重启服务器
/etc/init.d/sendmail restart
/etc/init.d/dovecot restart
/etc/init.d/saslauthd restart

三、客户端查看邮件:
1. mail
2. mutt


四、查看mx记录:
host -t mx some.domain.name
dig mx other.domain.name


五、 常见报错:
Unable to connect to tranport
[GC 33220K->21386K(43908K), 0.0022120 secs]
[GC 33610K->21431K(43908K), 0.0018930 secs]
[Apr 27, 2013 10:09:30 AM CST]:1367028570348:-1:-1:PLASPASHCNV4.PLA.ad.penske.com:3.242.189.137:-1:-1:1:20420:SYSADMIN(0):-1:Thread[outboundThreadGroup1,5,outboundThreadGroup]:3.242.189.137:3839:1367028205842:57:UNEXPECTED:[SVC-GSM-WFMLRSVC-44944-10006 : oracle.apps.fnd.wf.mailer.SMTPOutboundProcessor.open()]:Unable to connect to tranport
阅读(3102) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~