<linux下extmail服务的搭建>
下载2个软件包: extmail-1.1.0.tar.gz extman-1.1.tar.gz
下载地址:http://www.cpan.org/
创建extsuite目录
mkdir /var/www/extsuite
解压这2个包到这个目录下:
tar zxf extman-1.1.tar.gz -C /var/www/extsuite
tar zxf extmail-1.1.0.tar.gz -C /var/www/extsuite
改个短的名字
mv extmail-1.1.0 extmail mv extman-1.1 extman
切换到后台目录:
/var/www/extsuite/extman/docs
cp三个文件 别名 域 mailbox配置文件
cp mysql_virtual_alias_maps.cf mysql_virtual_domains_maps.cf mysql_virtual_mailbox_maps.cf /etc/postfix/
安装mysql数据库 yum isnatll mysql-server.x86_64 -y
给mysql加个密码: mysql_secure_installation
切换到次目录: /var/www/extsuite/extman/docs
看到2个文件: extmail.sql init.sql mysql -pwestos < extmail.sql
vim init.sql 把密码项改成明文的:
mysql -pwestos < init.sql mysql -uextmail -pextmail
降下面的参数加入postfix主配置文件:
useradd -u 800 vmail
postconf -d | grep virtual
postconf -e virtual_uid_maps=static:800
postconf -e virtual_gid_maps=static:800
postconf -e virtual_mailbox_base=/home/vmail/
postconf -e virtual_alias_maps=mysql:/etc/postfixmysql_virtual_alias_maps.cf
postconf -e virtual_mailbox_domains=mysql:/etc/postfix/mysql_virtual_domains_maps.cf
postconf -e virtual_mailbox_domains=mysql:/etc/postfix/mysql_virtual_domains_maps.cf
分别校验是否ok
postmap -q "support@extmail.org" mysql:/etc/postfix/mysql_virtual_alias_maps.cf
postmap -q "postmaster@extmail.org" mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
postmap -q "extmail.org" mysql:/etc/postfix/mysql_virtual_domains_maps.cf
cd /var/www/extsuite/extmail/
less INSTALL
找到以下行写入http。
NameVirtualHost *:80
<VirtualHost *:80>
ServerName mail.extmail.org
DocumentRoot /var/www/extsuite/extmail/html/
ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi
Alias /extmail /var/www/extsuite/extmail/html
SuexecUserGroup vmail vmail
</VirtualHost>
cd cgi/ chown vmail.vmail . -R
要是在真机上测试Apache服务,注意配置解析:
vim /etc/hosts
/etc/init.d/httpd restart /etc/init.d/mysqld restart /etc/init.d/postfix restart
浏览器中输入:mail@extmail.org
下面进入报错的解决方案:
extmail报错:
Can't locate CGI.pm in @INC (@INC contains: /var/www/extsuite/extmail/libs /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at /var/www/extsuite/extmail/libs/Ext/CGI.pm line 20. BEGIN failed--compilation aborted at /var/www/extsuite/extmail/libs/Ext/CGI.pm line 20. Compilation failed in require at /var/www/extsuite/extmail/libs/Ext/App.pm line 23. BEGIN failed--compilation aborted at /var/www/extsuite/extmail/libs/Ext/App.pm line 23. Compilation failed in require at /var/www/extsuite/extmail/libs/Ext/App/Login.pm line 16. BEGIN failed--compilation aborted at /var/www/extsuite/extmail/libs/Ext/App/Login.pm line 16. Compilation failed in require at index.cgi line 20.
解决:yum install perl-CGI
报错: Can't locate /var/www/cgi-bin/extmail//lang//en_US in @INC (@INC contains: /var/www/extsuite/extmail/libs /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at /var/www/extsuite/extmail/libs/Ext/Lang.pm line 65.
解决:没有主文件
[root@vm1 extmail]# cp webmail.cf.default webmail.cf
[root@vm1 extmail]# pwd /var/www/extsuite/extmail
报错:
Unix::Syslog not found, please install it first! (in cleanup) Undefined subroutine &Ext::Logger::do_closelog called at /var/www/extsuite/extmail/libs/Ext/Logger.pm line 86.
解决方案:
没有这个包: Unix-Syslog-1.1.tar.gz
# perl Makefile.PL
安装这个包的报错
Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 1. BEGIN failed--compilation aborted at Makefile.PL line 1.
解决
yum install -y perl-ExtUtils-MakeMaker
# perl Makefile.PL # make install
报错
DBI connect('database=extmail;host=localhost;mysql_socket=/var/lib/mysql/mysql.sock','db_user',...) failed: Access denied for user 'db_user'@'localhost' (using password: YES) at /var/www/extsuite/extmail/libs/Ext/Auth/MySQL.pm line 45
解决:进入数据库失败,修改主配置文件。 SYS_MYSQL_USER = extmail SYS_MYSQL_PASS = extmail
报错 Can't chdir to /home/domains/extmail.org/postmaster/Maildir/, No such file or directory
解决:
SYS_MAILDIR_BASE = /home/vmail
# mail support@extmail.org 发封邮件让它创建邮件目录
extmail后台的配置
后台的操作 同样的操作
NameVirtualHost *:80 <VirtualHost *:80> ServerName mail.example.com DocumentRoot /path/to/your/document/root/ ScriptAlias /extman/cgi /var/www/extsuite/extman/cgi Alias /extman /var/www/extsuite/extman/html SuexecUserGroup vuser vgroup </VirtualHost>
只需要下面2行插入,mail前台配置中 ScriptAlias /extman/cgi /var/www/extsuite/extman/cgi Alias /extman /var/www/extsuite/extman/html
最终Apache写入的配置:
<VirtualHost *:80>
ServerName mail.extmail.org
DocumentRoot /var/www/extsuite/extmail/html/
ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi
Alias /extmail /var/www/extsuite/extmail/html
ScriptAlias /extman/cgi /var/www/extsuite/extman/cgi
Alias /extman /var/www/extsuite/extman/html
SuexecUserGroup vmail vmail
</VirtualHost>
/var/www/extsuite/extman chown vmail.vmail . -R
验证码
/var/www/extsuite/extman
cp webman.cf.default webman.cf
vim webman.cf SYS_CAPTCHA_ON = 1
SYS_CAPTCHA_LEN = 4
关于主页的显示:
vim /etc/rc.local
/var/www/extsuite/extman/daemon/cmdserver &
后台图形监控报错:
Can't locate RRDs.pm in @INC (@INC contains: /var/www/extsuite/extman/libs /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /var/www/extsuite/extman/libs/Ext/GraphLog.pm line 23. BEGIN failed--compilation aborted at /var/www/extsuite/extman/libs/Ext/GraphLog.pm line 23. Compilation failed in require at /var/www/extsuite/extman/libs/Ext/MgrApp/ViewLog.pm line 22. BEGIN failed--compilation aborted at /var/www/extsuite/extman/libs/Ext/MgrApp/ViewLog.pm line 22. Compilation failed in require at viewlog.cgi line 18.
解决方法: 下载软件包:rrdtool-perl-1.3.8-6.el6.x86_64.rpm yum localinstall rrdtool-perl-1.3.8-6.el6.x86_64.rpm
虽然显示出来监控目录,但是点击没反映:
# cp mailgraph_ext/ /usr/local/ -r 为什么要cp到/usr/local/下?
/usr/local/mailgraph_ext vim mailgraph-init会发现执行脚本的路经:BASEDIR=/usr/local/mailgraph_ext
# /usr/local/mailgraph_ext/mailgraph-init start
报错: Starting mail statistics grapher: mailgraph_ext Can't locate File/Tail.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/mailgraph_ext/mailgraph_ext.pl line 296. BEGIN failed--compilation aborted at /usr/local/mailgraph_ext/mailgraph_ext.pl line 296. Starting queue statistics grapher: qmonitor
下载包: File-Tail-0.99.3.tar.gz
tar -zxf File-Tail-0.99.3.tar.gz # cd File-Tail-0.99.3 # perl Makefile.PL
报错: File::Tail will be installed without debugging information. This information isn't usefull unless you intend to tinker with the code. To install with debugging enabled, use: perl Makefile.PL LOGIT Checking if your kit is complete... Looks good Warning: prerequisite Time::HiRes 1.12 not found. Writing Makefile for File::Tail
解决方法: # yum install perl-Time-HiRes -y # perl Makefile.PL # make install
# /usr/local/mailgraph_ext/mailgraph-init start
之后就会看到图形化监控。