[原创]我的CourierMailServer的安装笔记
QUOTE:我的Courier Mail Server的安装笔记首先感谢网友“老手”对我的热心帮助
Courier 是一个全功能,包含SMTP/IMAP/POP3/HTTP(webmail)的电子邮件服务器软件。Courier 还扩充能了很
多SMTP功能,下面是我用courier0.42+mysql安装笔记
首先下载[url=http://osdn.dl.sourceforge.net/sourceforge/courier/courier-0.42.2.tar.bz2]http://osdn.dl.sourceforge.net/sourceforge/courier/courier-0.42.2.tar.bz2[/url]
解压 courier-0.42.2.tar.bz2
tar -zxvf courier-0.42.2.tar.bz2
参考安装说明,因为courier不能用root用户配置,所以,我就用默认的courier用户
[root@mail courier-0.42.2]$ echo "courier:521:521:Courier Mail Server:/dev/null:/sbin/nolnog"
>;>; /etc/passwd
[root@mail courier-0.42.2]$ echo "courier:521:" >;>; /etc/group
这里我用courier用户进行配制
[courier@mail courier-0.42.2]$ ./configure --prefix=/mail\
>; --with-authmysql=yes\
>; --with-mysql-includes=/usr/include/mysql\
>; --with-mysql-libs=/usr/lib/mysql\
>; --with-mailuser=courier\
>; --with-mailgroup=courier
配置安装
[root@mail courier-0.42.2]$make
[root@mail courier-0.42.2]$make install
[root@mail courier-0.42.2]$make install-configure
设置默认域如下
cat ;/mail/etc/defaultdomain
inhowmail.com.cn
!
cat ;/mail/etc/locals
inhowmail.com.cn
!
cat ;/mail/etc/hosteddomains/hosteddomains
inhowmail.com.cn
!
smtp受权
cat ;/mail/etc/esmtpacceptmailfor.dir/esmtpacceptmailfor
inhowmail.com.cn
!
使设置生效
[root@mail courier-0.42.2]$/mail/sbin/makesmtpaccess
[root@mail courier-0.42.2]$/mail/sbin/makehosteddomains
[root@mail courier-0.42.2]$/mail/sbin/makeacceptmailfor
修改authdaemonrc
authmodulelist="authmysql authpam"
authmodulelistorig="authmysql authpam"
daemons=5
version=""
至于esmtpd pop3d imapd esmtpd-ssl pop3d-ssl imapd-ssl 可根据不同需要自行修改,在这里不做修改。
设置域用户为test
[root@mail courier-0.42.2]$mkdir -p domain/inhowmail.com.cn/test
创建Maildir目录
[root@mail courier-0.42.2]$/mail/bin/./maildirmake /mail/domain/inhowmail.com.cn/test/Maildir
因为要与mysql结合,所以要配置authmysqlrc文件:
配置如下:
MYSQL_SERVER localhost
MYSQL_USERNAME courier
MYSQL_PASSWORD admin
MYSQL_SOCKET /var/mysql/mysql.sock
MYSQL_DATABASE maildata
MYSQL_USER_TABLE passwd
MYSQL_CLEAR_PWFIELD clear
DEFAULT DOMAIN inhowmail.com.cn
MYSQL_QUOTA_FIELD quota
创建数据库如下:
mysqladmin -u root -p create maildata
mysql -u root -p
use maildata;
CREATE TABLE passwd (
id char(12 DEFAULT '' NOT NULL,
crypt char(12 DEFAULT '' NOT NULL,
clear char(12 DEFAULT '' NOT NULL,
name char(12 DEFAULT '' NOT NULL,
uid int(10) unsigned DEFAULT '65534' NOT NULL,
gid int(10) unsigned DEFAULT '65534' NOT NULL,
home char(255) DEFAULT '' NOT NULL,
quota char(255) DEFAULT '' NOT NULL,
KEY id (id(12)
);
插入测试用户 test
insert into passwd values
([url=mailto:'[email]test@inhowmail.com.cn[/email]',']'[email]test@inhowmail.com.cn[/email]','[/url] ','test','test',48,48,'/mail/domain/inhowmail.com.cn/test'
,'');
update passwd set crypt=encrypt('test') where [url=mailto:id='[email]test@inhowmail.com.cn[/email]']id='[email]test@inhowmail.com.cn[/email]'[/url];
mysql>; select *from users;
+-----------------------+---------------+-------+------+-----+-----+----------------------------
--------+-------+
| id | crypt | clear | name | uid | gid | home
| quota |
+-----------------------+---------------+-------+------+-----+-----+----------------------------
--------+-------+
| [url=mailto:test@inhowmail.com.cn]test@inhowmail.com.cn[/url] | teH0wLIpW0gyQ | test | test | 48 | 48 |
/mail/domain/inhowmail.com.cn/test | |
+-----------------------+---------------+-------+------+-----+-----+----------------------------
--------+-------+
1 row in set (0.01 sec)
替换原sendmail
mv /usr/sbin/sendmail /usr/sbin/sendmailbak
cp -a /mail/bin/sendmail /usr/sbin/sendmail
创建mail日志目录
touch /mail/log/maillog
touch /mail/log/errmail
修改/etc/syslog.conf 改mail日志路径
创建启动脚本
[root@mail authlib]# pwd
/mail/libexec/authlib
[root@mail authlib]# cat ;>;/mail/start
>; /mail/libexec/authlib/authdaemond start
>; !
[root@mail authlib]# cd ../../sbin
[root@mail sbin]# cat ;>;/mail/start
>; /mail/sbin/courier start
>; /mail/sbin/courierfilter start
>; /mail/sbin/pop3d start
>; /mail/sbin/esmtpd start
>; !
[root@mail sbin]#chmod 100 /mail/start
为了调试,我开启了mysql的日志(测试后建议停了mysql日志)
进行测试如下:
[root@mail sbin]#/mail/./start
[root@mail sbin]#tail /mail/log/mysql.log
19 Connect couriermail@localhost on 与数据库连接正常
[root@mail etc]# telnet 127.0.0.1 110
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
+OK Hello there.
user test
+OK Password required.
pass test
-ERR Login failed.
user [url=mailto:test@inhowmail.com.cn]test@inhowmail.com.cn[/url]
+OK Password required.
pass test
+OK logged in.
quit
+OK Bye-bye.
Connection closed by foreign host.
测试test用户收发
[root@mail new]# mail [url=mailto:test@inhowmail.com.cn]test@inhowmail.com.cn[/url]
Subject: hello test
hello courier mail services
dkjfkdjfkdjfdkfj
dfkdjfkd
.
Cc:
tail /mail/log/maillog
Aug 12 16:19:46 mail courierd: newmsg,id=0000B77A.3F452962.0000038A: dns; localhost (localhost
[127.0.0.1])
Aug 12 16:19:46 mail courierd:
started,id=0000B77A.3F452962.0000038A,from=;,module=local,host=test@inhowma
il.com.cn!!48!48!/mail/domain/inhowmail.com.cn/test!!,addr=;
Aug 12 16:19:46 mail courierd: Waiting. shutdown time=none, wakeup time=none, queuedelivering=1,
inprogress=1
Aug 12 16:19:47 mail courierlocal:
id=0000B77A.3F452962.0000038A,from=;,addr=;,size=366,
success: Message delivered.
Aug 12 16:19:47 mail courierd: completed,id=0000B77A.3F452962.0000038A
Aug 12 16:19:47 mail courierd: Waiting. shutdown time=Thu Aug 12 17:18:29 2003, wakeup time=Thu
Aug 12 17:18:29 2003, queuedelivering=0, inprogress=0
[root@mail new]# cat
1061497187.M162621P911V0000000000000805I00015F69_0.mail.inhowmail.com.cn,S=439
Delivered-To: [url=mailto:test@inhowmail.com.cn]test@inhowmail.com.cn[/url]
Return-Path: ;
Received: from localhost (localhost [127.0.0.1])
(uid 0)
by mail.inhowmail.com.cn with local; Thu, 12 Aug 2003 16:19:45 -0400
To: [url=mailto:test@inhowmail.com.cn]test@inhowmail.com.cn[/url]
Subject: hello test
From: root ;
Message-ID: ;
Date: Thu, 12 Aug 2003 16:19:45 -0400
hello courier mail services
dkjfkdjfkdjfdkfj
dfkdjfkd
配置mailfilter
修改/mail/etc/courierd
把./Maildir 注释,并开起 DEFAULTDELIVERY="| /mail/bin/maildrop"
配置/mail/etc/maildirfilterconfig文件
[root@mail etc]# vi maildirfilterconfig
MAILDIRFILTER=../.mailfilter
MAILDIR=./Maildir
这样过滤就可以用了
设置webmail
[root@mail etc]$cp -a /mail/libexec/courier/webmail /var/www/cgi-bin
[root@mail etc]$cp -a /mail/share/courier/sqwebmail/images /var/www/html/webmail
设置webadmin
[root@mail mail etc]$cp -a /mail/libexec/courier/webmail/webadmin /var/www/cgi-bin
[root@mail courier-0.42.2]$make install-webadmin-password
我的SSL没起用,所以在这里改为
[root@mail courier-0.42.2]touch /mail/etc/webadmin/unsecureok
对于webmail中的模板,感觉不好,所以想换一下自已以前的模板,但发现,首页中没有main.html,而默认执
行的是folders.html,我想可能要改码了,要是懒得改也可以直接改htm/en-us模板。
courier的功能很强大,我只是对此感兴趣才选择了courier ,但没有真正的完成所有功能的配置。
以上安装只是我的一个笔记,是一片安装流水笔记,因为在安装前找了很长时间都没有找到相关的中文才料,所以写上安装笔记,对新手有些帮助,其实没有什么技术含量,主要是参考courier/doc中的说明,安
装中难免有一些不对之处,还望大家给予指正。
__________________________________
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmousewheel="return imgzoom(this);">
红藕香残玉簟秋。轻解罗裳,独上兰舟。云中谁寄锦书来?雁字回时,月满西楼。 花自飘零水自流。一种相思,两处闲愁。此情无计可消除,才下眉头,却上心头!
页:
[1]