1、利用Ubuntu ExtMail 30分钟配置好一个功能强大的邮件利用Ubuntu ExtMail 30分钟配置好一个功能强大的利用Ubuntu ExtMail 30分钟配置好一个功能强大的服务器V1.1,以下文档通过19个大的步骤进行配置,配置成功! 由于网上Ubuntu ExtMail的步骤特别多,看了都头痛,在此特别给朋友们制作了一个简洁的安装文档,希望大家喜欢:)环境:Ubuntu 8.04 TLSpostfix 2.5.1ExtMail 1.2extman 1.1 1.安装依赖包apt-get install mysql-client-5.0 mysql-server apache2
2、 postfix postfix-mysql postfix-doc courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql openssl libapache2-mod-fastcgi libfcgi-perl build-essential libtool libnet-server-perl libnet-cidr-perl l
3、ibberkeleydb-perl arc zoo lzop liblzo1 libstdc+5 libgd-gd2-perl libfile-tail-perl libdigest-sha1-perl libdigest-HMAC-perl libnet-ip-perl libnet-dns-perl libhtml-tagset-perl libhtml-parser-perl libio-stringy-perl libio-multiplex-perl libio-socket-ssl-perl libio-zlib-perl libnet-ssleay-perl libunix-sy
4、slog-perl libtimedate-perl libmailtools-perl libconvert-binhex-perl libconvert-tnef-perl libconvert-uulib-perl libcompress-zlib-perl libarchive-zip-perl libarchive-tar-perl perl-suid你会被询问以下问题:Create directories for web-based administration? NoGeneral type of mail configuration: Internet SiteSystem m
5、ail name: mail.extmail.org2.下载extmail-1.2和extman-1.1,并修改配置下载地址:.extmail.org/downloadtar xvzf extmail-1.2.tar.gztar xvzf extman-1.1.tar.gzmkdir /var/extsuitemv extmail-1.2/ /var/extsuite/extmailmv extman-1.1/ /var/extsuite/extmancp /var/extsuite/extman/docs/mysql_virtual_*.cf /etc/postfix/注意,非常重要:修改/
6、etc/postfix/mysql_virtual_*.cf,将其中的“localhost”均改为“127.0.0.1”,修改数据库配置,保证能够连到mysql3.建立相关系统用户1)新建普通用户useradd -m -d /home/hugwww -s /bin/bash hugwwwpasswd hugwww2)删除以前gid,uid为1000的用户userdel -r gaojinbo3)建立extmail所需要的用户和组groupadd -g 1000 vgroupuseradd -m -g vgroup -u 1000 -d /home/vmail -s /bin/false vus
7、er4.修改权限chmod 755 /etc/postfix/mysql_virtual_*.cfchgrp postfix /etc/postfix/mysql_virtual_*.cfchown -R vuser:vgroup /var/extsuite/extmail/cgi/chown -R vuser:vgroup /var/extsuite/extman/cgi/cd /var/extsuite/extmail/cp webmail.cf.default webmail.cfcd /var/extsuite/extman/cp webman.cf.default webman.cf
8、5.修改/var/extsuite/extmail/webmail.cf里的其他参数,主要变动的容见下:vi /var/extsuite/extmail/webmail.cfSYS_USER_LANG = zh_CNSYS_MYSQL_USER = extmailSYS_MYSQL_PASS = extmailSYS_MYSQL_DB = extmailSYS_MYSQL_SOCKET = /var/run/mysqld/mysqld.sockSYS_AUTHLIB_SOCKET = /var/run/courier/authdaemon/socketSYS_MAILDIR_BASE = /h
9、ome/vmailSYS_MESSAGE_SIZE_LIMIT = 102400000 /注:这个选项为修改附件的大小,默认为5M,你可以自行修改,这里面改了是不行的,还要去postfix里面修改,我在下面会讲到6.修改 /var/extsuite/extman/webman.cf的参数vi /var/extsuite/extman/webman.cfSYS_CAPTCHA_ON = 0 /用于关闭后台登录时的验证码SYS_MAILDIR_BASE = /home/vmailSYS_MYSQL_SOCKET = /var/run/mysqld/mysqld.sockSYS_LANG = zh_
10、CNSYS_GROUPMAIL_SENDER = postmasterextmail.org /注:这个选项是,你在后台群发后,用户收到的发件人地址,你可以自行修改7.修改/var/extsuite/extman/contrib/passwd2ext.plmy $sock = /var/run/mysqld/mysqld.sock;8.数据库初始化执行以下命令导入mysql数据库结构及初始化数据,注意必须逐行输入以下命令.请把替换成自己的密码mysql -u root -plinuxidc. /var/extsuite/extman/docs/extmail.sqlmysql -u root
11、-plinuxidc. /var/extsuite/extman/docs/init.sql9.建立临时文件夹:mkdir /tmp/extmanchown -R vuser:vgroup /tmp/extman编辑rc.local,加入下面容以实现开机自动建立编辑rc.local,加入下面容以实现开机自动建立www.linuxidc.vi /etc/rc.localif ! -d /tmp/extman ; thenmkdir /tmp/extmanchown -R vuser:vgroup /tmp/extmanfi 10.建立上边导入mysql的postmasterextmail.org
12、的Maildir,请输入如下命令:cd /var/extsuite/extman/tools./maildirmake.pl /home/vmail/extmail.org/postmaster/Maildirchown -R vuser:vgroup /home/vmail/extmail.org/11.Postfix配置cd /etc/postfix/cp main.cf main.cf_backupvi main.cf# TLS parameterssmtpd_tls_cert_file = /etc/postfix/smtpd.certsmtpd_tls_key_file = /etc
13、/postfix/smtpd.keysmtpd_use_tls = yes# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for# information on enabling SSL in the smtp client.mydomain = extmail.orgmyhostname = mail.$mydomainmyorigin = $mydomainmydestination = mail.$mydomain, localhost.$mydomain, localhostalias_maps
14、 = hash:/etc/aliasesalias_database = hash:/etc/aliasesrelayhost =mynetworks = 127.0.0.1message_size_limit = 102400000mailbox_size_limit = 0recipient_delimiter = +inet_interfaces = allhtml_directory = /usr/share/doc/postfix/html# virtual config#virtual_alias_domains =virtual_alias_maps = mysql:/etc/p
15、ostfix/mysql_virtual_alias_maps.cfvirtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cfvirtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cfvirtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_limit_maps.cfvirtual_mailbox_base = /home/vmailvirtual_uid_
16、maps = static:1000virtual_gid_maps = static:1000virtual_create_maildirsize = yesvirtual_mailbox_extended = yesvirtual_overquota_bounce = yesvirtual_mailbox_limit_override = yesvirtual_maildir_limit_message = Sorry, the your Maildir has overdrawn your diskspace quota, please free up some of spaces of
17、 your mailbox try again.proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_ma
18、ps $mynetworks $virtual_mailbox_limit_maps重启 postfix/etc/init.d/postfix restart12.SMTP身份认证cd /etc/postfixopenssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509它们询问你问题Country Name (2 letter code) AU: 国家State or Province Name (full name) So
19、me-State: 省Locality Name (eg, city) : 城市Organization Name (eg, company) Internet Widgits Pty Ltd: 组织名称Organizational Unit Name (eg, section) : 组织单位名称Common Name (eg, YOUR name) : 通用名称Email Address : 地址 .linuxidc.13.Apache2配置:vi /etc/apache2/sites-available/mailServerAdmin adminlinuxidc.ServerName ma
20、il.linuxidc.DocumentRoot /var/extsuite/extmail/htmlAlias /extmail/cgi/ /var/extsuite/extmail/dispatch.fcgi/Alias /extmail /var/extsuite/extmail/htmlFastCgiExternalServer /var/extsuite/extmail/dispatch.fcgi -host 127.0.0.1:8888 -idle-timeout 240SetHandler fastcgi-scriptScriptAlias /extman/cgi/ /var/e
21、xtsuite/extman/cgi/Alias /extman /var/extsuite/extman/htmlErrorLog /var/log/apache2/error.log# Possible values include: debug, info, notice, warn, error, crit,# alert, emerg.LogLevel warnCustomLog /var/log/apache2/access.log combinedSuexecUserGroup vuser vgroup14.编辑/var/extsuite/extmail/dispatch-ini
22、t文件:vi /var/extsuite/extmail/dispatch-initMAXFORK=10最后启动fastcgi server:/var/extsuite/extmail/dispatch-init start如果没有意外将启动10个dispatch.fcgi守护进程,可以通过以下命令将启动命令加到rc.local中,实现自启动:echo /var/extsuite/extmail/dispatch-init start/etc/rc.local15.SMTP认证1).更改saslauthdvi /etc/default/saslauthd更改如下几项START=yes /设置开
23、机自动启动OPTIONS=-c -m /var/spool/postfix/var/run/saslauthd -r2). 创建文件/etc/pam.d/smtpvi /etc/pam.d/smtp容如下:auth required pam_mysql.so user=extmail passwd=extmail host=127.0.0.1 db=extmail table=mailbox usercolumn=username passwdcolumn=password crypt=1account sufficient pam_mysql.so user=extmail passwd=e
24、xtmail host=127.0.0.1 db=extmail table=mailbox usercolumn=username passwdcolumn=password crypt=1解释一下:其实就是定义一个查询的方式 crypt=1或者0表示加密或者不加密 注意对照你的数据库还有用户名密码 请保持跟自己的一致3).由于postfix处于chroot,要想调用到saslauthd 必须更改socket文件mkdir -p /var/spool/postfix/var/run/saslauthdvi /etc/postfix/sasl/smtpd.conf创建smtpd.conf,并且
25、容如下:pwcheck_method:saslauthdmech_list:plain loginallow_plaintext: trueauxprop_plugin: mysqlsql_hostnames: 127.0.0.1sql_user: extmailsql_password: extmailsql_database: extmaillog_level:7sql_select: SELECT password FROM mailbox WHERE username=%u%r and domain=%r4).更改main.cf 文件vi /etc/postfix/main.cf#SM
26、TP AUTH config#broken_sasl_auth_clients = yessmtpd_sasl_auth_enable = yessmtpd_sasl_local_domain = $myhostnamesmtpd_sasl_security_options = noanonymous#smtpd related config#smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_sender_login_mismatch, reject_unknown_sende
27、r_domain, reject_non_fqdn_hostname, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, reject_unauth_pipelining, reject_invalid_hostname, check_recipient_maps5).添加用户adduser postfix sasl6).重启postfix saslauthd/etc/init.d/postfix restart/etc/i
28、nit.d/saslauthd restart7).测验telnet localhost 25Trying 127.0.0.1Connected to localhost.Escape character is .220 mail.extmail.org ESMTP Postfixehlo localhost250-mail.extmail.org250-PIPELINING250-SIZE 102400000250-VRFY250-ETRN250-STARTTLS250-AUTH PLAIN LOGIN250-AUTH=PLAIN LOGIN250-ENHANCEDSTATUSCODES25
29、0-8BITMIME250 DSNauth login334 VXNlcm5hbWU6cG9zdG1hc3RlckBleHRtYWlsLm9yZw=334 UGFzc3dvcmQ6ZXh0bWFpbA=235 2.7.0 Authentication successfulquit221 2.0.0 ByeConnection closed by foreign host.如果出现Authentication successful 表示没有问题了16.POP验证vi /etc/courier/authdaemonrc#更改如下一项authmodulelist=authmysqlcp /etc/c
30、ourier/authmysqlrc /etc/courier/authmysqlrc_origcat /dev/null /etc/courier/authmysqlrcvi /etc/courier/authmysqlrc#容如下:MYSQL_SERVER localhostMYSQL_USERNAME extmailMYSQL_PASSWORD extmailMYSQL_SOCKET /var/run/mysqld/mysqld.sockMYSQL_PORT 3306MYSQL_OPT 0MYSQL_DATABASE extmailMYSQL_USER_TABLE mailboxMYSQL_CRYPT_PWFIELD passwordMYSQL_UID_FIELD uidnumberMYSQL_GID_FIELD gidnumberMYSQL_LOGIN_FIELD usernameMYSQL_HOME_FIELD homedirMYSQL_NAME_FIELD name
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1