《利用ubuntuextmail30分钟配置好一个功能强大的邮件.pdf》由会员分享,可在线阅读,更多相关《利用ubuntuextmail30分钟配置好一个功能强大的邮件.pdf(16页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、利用利用 Ubuntu ExtMail 30Ubuntu ExtMail 30 分钟配置好一个功能强分钟配置好一个功能强大的邮件大的邮件利用 Ubuntu ExtMail 30 分钟配置好一个功能强大的邮件服务器,以下文档通过 19 个大的步骤进行配置,配置成功!由于网上 Ubuntu ExtMail 的步骤特别多,看了都头痛,在此特别给朋友们制作了一个简洁的安装文档,希望大家喜欢:)环境:Ubuntu TLSpostfix 2.5.1ExtMailextman1.安装依赖包apt-getinstallmysql-serverapache2postfixpostfix-mysqlpostfix
2、-doccourier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imapcourier-imap-ssl libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysqlopenssllibapache2-mod-fastcgilibfcgi-perlbuild-essentiallibtoollibnet-server-perl libnet-cidr-perl libberkeleydb-perl arczoolzopliblzo1lib
3、stdc+5libgd-gd2-perllibfile-tail-perllibnet-dns-perllibdigest-sha1-perllibhtml-tagset-perllibio-multiplex-perllibdigest-HMAC-perllibhtml-parser-perllibnet-ip-perllibio-stringy-perllibio-socket-ssl-perllibio-zlib-perllibnet-ssleay-perllibunix-syslog-perllibtimedate-perl libmailtools-perl libconvert-b
4、inhex-perl libconvert-tnef-perllibconvert-uulib-perllibarchive-tar-perl perl-suid你会被询问以下问题:libcompress-zlib-perllibarchive-zip-perlCreate directories for web-based administration NoGeneral type of mail configuration:Internet SiteSystem mail name:下载和,并修改配置下载地址:xvzf xvzf /var/www/extsuitemv /var/www/e
5、xtsuite/extmailmv /var/www/extsuite/extmancp/var/www/extsuite/extman/docs/mysql_virtual_*.cf/etc/postfix/注意,非常重要:修改/etc/postfix/mysql_virtual_*.cf,将其中的“localhost”均改为“.0.1”,修改数据库配置,保证能够连到mysql3.建立相关系统用户1)新建普通用户useradd-m-d/home/hugwww-s/bin/bash hugwwwpasswd hugwww2)删除以前 gid,uid 为 1000 的用户userdel-r ga
6、ojinbo3)建立 extmail 所需要的用户和组groupadd-g 1000 vgroupuseradd-m-g vgroup-u 1000-d/home/vmail-s/bin/false vuser4.修改权限chmod 755/etc/postfix/mysql_virtual_*.cfchgrp postfix/etc/postfix/mysql_virtual_*.cfchown-R vuser:vgroup/var/www/extsuite/extmail/cgi/chown-R vuser:vgroup/var/www/extsuite/extman/cgi/cd/var
7、/www/extsuite/extmail/cpcd/var/www/extsuite/extman/cp5.修改/var/www/extsuite/extmail/里的其他参数,主要变动的内容见下:vi/var/www/extsuite/extmail/SYS_USER_LANG=zh_CNSYS_MYSQL_USER=extmailSYS_MYSQL_PASS=extmailSYS_MYSQL_DB=extmailSYS_MYSQL_SOCKET=/var/run/mysqld/SYS_AUTHLIB_SOCKET=/var/run/courier/authdaemon/socketSYS
8、_MAILDIR_BASE=/home/vmailSYS_MESSAGE_SIZE_LIMIT=0 5M改/var/www/extsuite/extman/的参数vi/var/www/extsuite/extman/SYS_CAPTCHA_ON=0 改/var/www/extsuite/extman/contrib/my$sock=/var/run/mysqld/;8.数据库初始化执行以下命令导入 mysql 数据库结构及初始化数据,注意必须逐行输入以下命令.请把替换成自己的密码mysql-u root /var/www/extsuite/extman/docs/mysql-u root /v
9、ar/www/extsuite/extman/docs/9.建立临时文件夹:mkdir/tmp/extmanchown-R vuser:vgroup/tmp/extman编辑,加入下面内容以实现开机自动建立编辑,加入下面内容以实现开机自动建立/etc/if !-d/tmp/extman;thenmkdir/tmp/extmanchown-R vuser:vgroup/tmp/extmanfi10.建立上边导入 mysql 的帐户的 Maildir,请输入如下命令:cd/var/www/extsuite/extman/tools./home/vmail/postmaster/Maildircho
10、wn-R vuser:vgroup/home/vmail/配置cd/etc/postfix/cpvi#TLS parameterssmtpd_tls_cert_file=/etc/postfix/smtpd_tls_key_file=/etc/postfix/smtpd_use_tls=yes#See/usr/share/doc/postfix/in the postfix-doc package for#information on enabling SSL in the smtp client.mydomain=myhostname=mail.$mydomainmyorigin=$mydo
11、mainmydestination=mail.$mydomain,localhost.$mydomain,localhostalias_maps=hash:/etc/aliasesalias_database=hash:/etc/aliasesrelayhost=mynetworks=message_size_limit=0mailbox_size_limit=0recipient_delimiter=+inet_interfaces=allhtml_directory=/usr/share/doc/postfix/html#virtual config#virtual_alias_domai
12、ns=virtual_alias_maps=mysql:/etc/postfix/virtual_mailbox_domains=mysql:/etc/postfix/virtual_mailbox_maps=mysql:/etc/postfix/virtual_mailbox_limit_maps=mysql:/etc/postfix/virtual_mailbox_base=/home/vmailvirtual_uid_maps=static:1000virtual_gid_maps=static:1000virtual_create_maildirsize=yesvirtual_mail
13、box_extended=yesvirtual_overquota_bounce=yesvirtual_mailbox_limit_override=yesvirtual_maildir_limit_message=Sorry,the yourMaildir hasoverdrawn yourdiskspace quota,please free up some of spaces of your mailbox try again.proxy_read_maps=$local_recipient_maps$mydestination$virtual_alias_maps$virtual_al
14、ias_domains$virtual_mailbox_maps$virtual_mailbox_domains$relay_recipient_maps$relay_domains$canonical_maps$sender_canonical_maps$recipient_canonical_maps$virtual_mailbox_limit_maps重启 postfix/etc/postfix restart身份认证cd/etc/postfixopenssl req-new-outform PEM-out -newkey rsa:2048-nodes-keyout -keyform P
15、EM-days 365-x509$relocated_maps$transport_maps$mynetworks它们询问你问题Country Name(2 letter code)AU:国家State or Province Name(full name)Some-State:省Locality Name(eg,city):城市Organization Name(eg,company)Internet Widgits Pty Ltd:组织名称Organizational Unit Name(eg,section):组织单位名称Common Name(eg,YOUR name):通用名称Ema
16、il Address:邮件地址配置:vi/etc/apache2/sites-available/mailServerAdminServerNameDocumentRoot/var/www/extsuite/extmail/htmlAlias/extmail/cgi/var/www/extsuite/extmail/Alias/extmail/var/www/extsuite/extmail/htmlFastCgiExternalServer/var/www/extsuite/extmail/-host -idle-timeout 240SetHandler fastcgi-scriptScr
17、iptAlias/extman/cgi/var/www/extsuite/extman/cgi/Alias/extman/var/www/extsuite/extman/htmlErrorLog/var/log/apache2/#Possible values include:debug,info,notice,warn,error,crit,#alert,emerg.LogLevel warnCustomLog/var/log/apache2/combinedSuexecUserGroup vuser vgroup14.编辑/var/www/extsuite/extmail/dispatch
18、-init文件:vi/var/www/extsuite/extmail/dispatch-initMAXFORK=10最后启动 fastcgi server:/var/www/extsuite/extmail/dispatch-init start如果没有意外将启动 10 个守护进程,可以通过以下命令将启动命令加到中,实现自启动:echo/var/www/extsuite/extmail/dispatch-init start/etc/认证1).更改 saslauthdvi/etc/default/saslauthd更改如下几项START=yes 创建文件/etc/smtpvi/etc/smt
19、p内容如下:authrequireduser=extmailpasswd=extmailhost=db=extmailtable=mailboxusercolumn=username passwdcolumn=password crypt=1account sufficient user=extmail passwd=extmail host=db=extmail table=mailboxusercolumn=username passwdcolumn=password crypt=1解释一下:其实就是定义一个查询的方式 crypt=1 或者 0 表示加密或者不加密 注意对照你的数据库还有用
20、户名密码 请保持跟自己的一致3).由于 postfix 处于 chroot,要想调用到 saslauthd 必须更改 socket 文件mkdir-p/var/spool/postfix/var/run/saslauthdvi/etc/postfix/sasl/创建,并且内容如下:pwcheck_method:saslauthdmech_list:plain loginallow_plaintext:trueauxprop_plugin:mysqlsql_hostnames:sql_user:extmailsql_password:extmailsql_database:extmaillog_
21、level:7sql_select:SELECT password FROM mailbox WHERE username=%u%r and domain=%r4).更改 文件vi/etc/postfix/#SMTP 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=
22、permit_mynetworks,permit_sasl_authenticated,reject_sender_login_mismatch,reject_unknown_sender_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_m
23、aps5).添加用户adduser postfix sasl6).重启 postfix saslauthd/etc/postfix restart/etc/saslauthd restart7).测验telnet localhost 25Trying Connected to localhost.Escape character is.220 ESMTP Postfixehlo localhost250-PIPELINING250-SIZE 0250-VRFY250-ETRN250-STARTTLS250-AUTH PLAIN LOGIN250-AUTH=PLAIN LOGIN250-ENHA
24、NCEDSTATUSCODES250-8BITMIME250 DSNauth login334 VXNlcm5hbWU6cG9zdG1hc3RlckBleHRtYWlsLm9yZw=334 UGFzc3dvcmQ6ZXh0bWFpbA=235 2.7.0 Authentication successfulquit221 ByeConnection closed by foreign host.如果出现 Authentication successful 表示没有问题了验证vi/etc/courier/authdaemonrc#更改如下一项authmodulelist=authmysqlcp/e
25、tc/courier/authmysqlrc/etc/courier/authmysqlrc_origcat/dev/null /etc/courier/authmysqlrcvi/etc/courier/authmysqlrc#内容如下:MYSQL_SERVER localhostMYSQL_USERNAME extmailMYSQL_PASSWORD extmailMYSQL_SOCKET/var/run/mysqld/MYSQL_PORT 3306MYSQL_OPT 0MYSQL_DATABASE extmailMYSQL_USER_TABLE mailboxMYSQL_CRYPT_PW
26、FIELD passwordMYSQL_UID_FIELD uidnumberMYSQL_GID_FIELD gidnumberMYSQL_LOGIN_FIELD usernameMYSQL_HOME_FIELD homedirMYSQL_NAME_FIELD nameMYSQL_MAILDIR_FIELD maildirMYSQL_QUOTA_FIELD quotaMYSQL_SELECT_CLAUSE SELECT username,password,uidnumber,gidnumber,CONCAT(/home/vmail/,homedir),CONCAT(/home/vmail/,m
27、aildir),quota,name,CONCAT(disablesmtpd=,disablesmtpd,disablesmtp=,disablesmtp,disablewebmail=,disablewebmail,disablenetdisk=,disablenetdisk,disableimap=,disableimap,disablepop3=,disablepop3,netdiskquota=,netdiskquota)FROM mailbox WHERE username=$(local_part)$(domain)配置 Courier-POP3vi/etc/courier/pop
28、3dMAILDIRPATH=/home/vmail/配置 Courier-IMAPvi/etc/courier/imapdMAILDIRPATH=/home/vmail/重新启动/etc/courier-authdaemon restart/etc/courier-imap restart/etc/courier-imap-ssl restart/etc/courier-pop restart/etc/courier-pop-ssl restart测试 Courier-Authlib是否能成功连接 mysqlauthtest-s login extmail如果成功应该有如下显示Authenti
29、cation succeeded.Authenticated(uid 1000,gid 1000)Home Directory:/home/vmail/postmasterMaildir:/home/vmail/postmaster/Maildir/Quota:0SEncrypted Password:$1$phz1mRrj$3ok6BjeaoJYWDBsEPZb5C0Cleartext Password:extmailOptions:disablesmtpd=0,disablesmtp=0,disablewebmail=0,disablenetdisk=0,disableimap=0,dis
30、ablepop3=0,netdiskquota=S测试 pop3telnet localhost 110Trying Connected toEscape character is.+OK Hello there.user+OK Password required.pass extmail+OK logged in.list+OK POP3 clients that break here,they violate STD53.quit+OK Bye-bye.Connection closed by foreign host.如果出现问题请仔细分析日志17.图形日志 extmailapt-get
31、 install mailgraphcp-r/var/www/extsuite/extman/addon/mailgraph_ext/usr/local/mailgraph_extvi/usr/local/mailgraph_ext/mailgraph-init为:MAIL_LOG=/var/log/然后复制文件cp/var/www/extsuite/extman/addon/mailgraph_ext/mailgraph-init/etc/mailgraphcp/var/www/extsuite/extman/addon/mailgraph_ext/etc/qmonitor启动服务/etc/
32、mailgraph start18.安装 Maildropapt-get install maildropvi/etc/So that you can continueto receive mail you need to remove some messages from your mailbox.19.解决 extman 问题1)修改相关服务路径vi/var/www/extsuite/extman/daemon/cmd_plugin/linux-cmd2)启动服务/var/www/extsuite/extman/daemon/cmdserver-v-d3)写入开机自动运行echo/var/www/extsuite/extman/daemon/cmdserver-v-d/etc/至此,全部完成 登录前台,后台后台默认用户名 默认密码 extmail*123*,登录前台需要自己先添加一个用户