extmail安装(转载于bad0y)

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
简介:

http://mirror.extmail.org/yum/emos/1.5/os/i386/EMOS/

testsaslauthd -s smtp -u steve@westernmobile.net -p 0410

0: OK "Success."



http://sourceforge.net/projects/courier/files/


rpm -Uvh http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

yum -y install ntp vim-enhanced gcc gcc-c++ flex bison autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel freetype-demos libart_lgpl-devel libpng libtiff-devel freetype-devel libXpm-devel pam-devel libtool-ltdl openssl openssl-devel libxml2-devel gettext-devel pcre-devel fontconfig-devel libmcrypt mysql mysql-server mysql-devel httpd httpd-devel php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mcrypt openldap-servers perl-Unix-Syslog perl-Net-Daemon perl-PlRPC perl-DBI perl-DBD-MySQL perl-Time-HiRes perl-Time-HiRes-Value perl-File-Tail perl-libwww-perl perl-HTML-Parser perl-HTML-Tagset perl-IO-stringy perl-IO-Multiplex perl-MailTools perl-TimeDate perl-Convert-ASN1 perl-Convert-BinHex perl-MIME-tools perl-FCGI perl-GD rrdtool rrdtool-perl apr-devel apr-docs apr-util-devel apr-util-docs giflib libgdiplus mono-core dbus-sharp dbus-sharp-devel dbus-glib-devel dbh dbh-devel cyrus-sasl cyrus-sasl-plain expect fam-devel gdbm-devel libc-client-devel libmcrypt-devel libxslt-devel make rpm-build mod_ssl perl-Mon perl-Authen-PAM perl-Filter perl-Net_SSLeay perl-Convert-BER perl-URI perl-XML-SAX perl-Crypt-Blowfish perl-Crypt-CBC perl-Date-Calc net-snmp-devel libtool libtool-ltdl-devel openssl-perl pkgconfig postgresql-devel


yum install amavisd-new clamd clamav clamav-db spamassassin

chkconfig httpd on

chkconfig mysqld on


cd /usr/local/src

wget http://mirror.centos.org/centos/5/os/SRPMS/postfix-2.3.3-2.1.el5_2.src.rpm

rpm -ivh postfix-2.3.3-2.1.el5_2.src.rpm

cd /usr/src/redhat/SPECS



vi postfix.spec

%define LDAP 2

%define MYSQL 1

%define PCRE 1

%define SASL 2

%define TLS 1

%define IPV6 0

%define POSTDROP_GID 90

%define PFLOGSUMM 1


sed -i 's#%define MYSQL 0#%define MYSQL 1#g' /usr/src/redhat/SPECS/postfix.spec

sed -i 's#%define IPV6 1#%define IPV6 0#g' /usr/src/redhat/SPECS/postfix.spec



rpmbuild -bb /usr/src/redhat/SPECS/postfix.spec


rpm -Uvh /usr/src/redhat/RPMS/i386/postfix-2.3.*



alternatives --set mta /usr/sbin/sendmail.postfix

service sendmail stop

chkconfig sendmail off

chkconfig postfix on

service postfix start



postconf -m(查看postfix是否支持mysql)


/usr/sbin/groupadd -g 1000 vgroup

/usr/sbin/useradd -g 1000 -u 1000 -M -s /bin/false vuser




wget https://sourceforge.net/projects/courier/files/authlib/0.63.0/courier-authlib-0.63.0.tar.bz2/download

tar jxvf courier-authlib-0.63.0.tar.bz2

cd courier-authlib-0.63.0

./configure --prefix=/usr/local/courier-authlib --without-stdheaderdir --without-authuserdb --without-authpam --without-authldap --without-authpwd --without-authshadow --without-authvchkpw --without-authpgsql --without-authcustom --with-authmysql --with-redhat

make

make install

make install-configure

echo "/usr/local/courier-authlib/lib/courier-authlib" >> /etc/ld.so.conf

ldconfig

#ldconfig -v

cp courier-authlib.sysvinit /etc/rc.d/init.d/courier-authlib

chmod 755 /etc/rc.d/init.d/courier-authlib

chkconfig --add courier-authlib

chkconfig courier-authlib on

chmod 755 /usr/local/courier-authlib/var/spool/authdaemon

mv /usr/local/courier-authlib/etc/authlib/authmysqlrc /usr/local/courier-authlib/etc/authlib/authmysqlrc.bak

cd ..


vi /usr/local/courier-authlib/etc/authlib/authmysqlrc

MYSQL_SERVER            localhost

MYSQL_USERNAME          extmail

MYSQL_PASSWORD          extmail

MYSQL_SOCKET            /var/lib/mysql/mysql.sock

MYSQL_PORT              3306

MYSQL_OPT               0

MYSQL_DATABASE          extmail

MYSQL_USER_TABLE        mailbox

MYSQL_CRYPT_PWFIELD     password

MYSQL_UID_FIELD         uidnumber

MYSQL_GID_FIELD         gidnumber

MYSQL_LOGIN_FIELD       username

MYSQL_HOME_FIELD        homedir

MYSQL_NAME_FIELD        name

MYSQL_MAILDIR_FIELD     maildir

MYSQL_QUOTA_FIELD       quota

MYSQL_SELECT_CLAUSE     SELECT username,password,"",uidnumber,gidnumber,\

                       CONCAT('/home/domains/',homedir),\

                       CONCAT('/home/domains/',maildir),\

                       quota,\

                       name,\

                       CONCAT("disableimap=",disableimap,",disablepop3=",\

                       disablepop3,",disablewebmail=",disablewebmail,\

                       ",disablesmtpd=",disablesmtpd,",disablesmtp=",\

                       disablesmtp,",disablenetdisk=",disablenetdisk,\

                       ",netdiskquota=",netdiskquota)\

                       FROM mailbox\

                       WHERE username = '$(local_part)@$(domain)'

vi /usr/lib/sasl2/smtpd.conf   (/usr/lib64/sasl2/smtpd.conf)

pwcheck_method: authdaemond

log_level: 3

mech_list: PLAIN LOGIN

authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket

touch  /usr/local/courier-authlib/etc/authlib/authProg

chmod 777  /usr/local/courier-authlib/etc/authlib/authProg


chkconfig courier-authlib on

service courier-authlib start

ln -s /usr/local/courier-authlib/bin/courierauthconfig /usr/bin/courierauthconfig



wget http://sourceforge.net/projects/courier/files/maildrop/2.5.2/maildrop-2.5.2.tar.bz2/download

tar jxvf maildrop-2.5.2.tar.bz2

cd maildrop-2.5.2

./configure --enable-sendmail=/usr/sbin/sendmail --enable-trusted-users='root vuser' --enable-syslog=1 --enable-maildirquota --enable-maildrop-uid=1000 --enable-maildrop-gid=1000 --with-trashquota --with-dirsync

make

make install

cd ..


maildrop -v


wget http://sourceforge.net/projects/courier/files/imap/4.8.1/courier-imap-4.8.1.tar.bz2/download

tar jxvf courier-imap-4.8.1.tar.bz2

cd courier-imap-4.8.1

./configure --prefix=/usr/local/courier-imap --with-redhat --enable-unicode --disable-root-check --with-trashquota --without-ipv6 COURIERAUTHCONFIG='/usr/local/courier-authlib/bin/courierauthconfig'

make

make install


cp /usr/local/courier-imap/etc/imapd.dist /usr/local/courier-imap/etc/imapd

cp /usr/local/courier-imap/etc/imapd-ssl.dist /usr/local/courier-imap/etc/imapd-ssl

cp /usr/local/courier-imap/etc/pop3d.dist /usr/local/courier-imap/etc/pop3d

cp /usr/local/courier-imap/etc/pop3d-ssl.dist /usr/local/courier-imap/etc/pop3d-ssl

cp courier-imap.sysvinit /etc/rc.d/init.d/courier-imapd

chmod 755 /etc/rc.d/init.d/courier-imapd

chkconfig --add courier-imapd

chkconfig courier-imapd on

cd ..


vi /usr/local/courier-imap/etc/pop3d

POP3DSTART=YES

MAXDAEMONS=512

MAXPERIP=4000


sed -i 's#POP3DSTART=NO#POP3DSTART=YES#g' /usr/local/courier-imap/etc/pop3d

sed -i 's#MAXDAEMONS=40#MAXDAEMONS=512#g' /usr/local/courier-imap/etc/pop3d

sed -i 's#MAXPERIP=4#MAXPERIP=4000#g' /usr/local/courier-imap/etc/pop3d

service courier-imapd start



安装extmail,extman,slock

mkdir -p /var/www/extsuite

tar -zxvf extmail-1.2.tar.gz

cp -r extmail-1.2 /var/www/extsuite/extmail

cd /var/www/extsuite/extmail

cp webmail.cf.default webmail.cf

chown -R vuser:vgroup /var/www/extsuite/extmail/cgi/


sed -i "s#SYS_MYSQL_USER = db_user#SYS_MYSQL_USER = extmail#g" /var/www/extsuite/extmail/webmail.cf

sed -i "s#SYS_MYSQL_PASS = db_pass#SYS_MYSQL_PASS = extmail#g" /var/www/extsuite/extmail/webmail.cf

sed -i "s#SYS_SHOW_SIGNUP = 1#SYS_SHOW_SIGNUP = 0#g" /var/www/extsuite/extmail/webmail.cf

sed -i "s#SYS_MESSAGE_SIZE_LIMIT = 5242880#SYS_MESSAGE_SIZE_LIMIT = 52428800#g" /var/www/extsuite/extmail/webmail.cf

cd -


tar -zxvf extman-1.1.tar.gz

cp -r extman-1.1 /var/www/extsuite/extman/

chown -R vuser:vgroup /var/www/extsuite/extman/cgi/

mkdir /var/www/extsuite/extman/tmp

chown -R vuser:vgroup /var/www/extsuite/extman/tmp

cd /var/www/extsuite/extman

cp webman.cf.default webman.cf


sed -i "s#SYS_SESS_DIR = /tmp/extman/#SYS_SESS_DIR = /var/www/extsuite/extman/tmp/#g" /var/www/extsuite/extman/webman.cf

sed -i "s#SYS_MYSQL_PASS = webman#SYS_MYSQL_PASS = webman#g" /var/www/extsuite/extman/webman.cf


cd /var/www/extsuite/extman/docs/

sed -i 's#extmail\.org#easy-cdn\.cn#g' init.sql


导入数据


mysql -u root < /var/www/extsuite/extman/docs/extmail.sql

mysql -u root  < /var/www/extsuite/extman/docs/init.sql


生成extmail系统管理员的用户目录

cd /var/www/extsuite/extman/tools

./maildirmake.pl /home/domains/easy-cdn.cn/postmaster/Maildir

chown -R vuser:vgroup /home/domains


cp -r /var/www/extsuite/extman/addon/mailgraph_ext/ /usr/local/mailgraph_ext/

echo "/usr/local/mailgraph_ext/mailgraph-init start" >> /etc/rc.d/rc.local

echo "/usr/local/mailgraph_ext/qmonitor-init start" >> /etc/rc.d/rc.local

echo "/var/www/extsuite/extman/daemon/cmdserver --daemon" >>/etc/rc.d/rc.local


cp /var/www/extsuite/extman/docs/mysql_virtual_* /etc/postfix/


sed -i "s#password = extmail#password = extmail#g" /etc/postfix/mysql_virtual_alias_maps.cf

sed -i "s#password = extmail#password = extmail#g" /etc/postfix/mysql_virtual_domains_maps.cf

sed -i "s#password = extmail#password = extmail#g" /etc/postfix/mysql_virtual_limit_maps.cf

sed -i "s#password = extmail#password = extmail#g" /etc/postfix/mysql_virtual_mailbox_maps.cf

sed -i "s#password = extmail#password = extmail#g" /etc/postfix/mysql_virtual_sender_maps.cf


安装slockd



配置apache

vi /etc/httpd/conf/httpd.conf


#AddDefaultCharset UTF-8


NameVirtualHost *:80

Include conf/vhost_*.conf


vi /etc/httpd/conf/vhost_extmail.conf

# VirtualHost for ExtMail Solution

<VirtualHost *:80>

ServerName mail.easy-cdn.cn

DocumentRoot /var/www/extsuite/extmail/html/

LoadModule fastcgi_module modules/mod_fastcgi.so

<Ifmodule mod_fastcgi.c>

FastCgiExternalServer /usr/bin/dispatch.fcgi -host 127.0.0.1:8888

</Ifmodule>

Alias /extmail/cgi/ /usr/bin/dispatch.fcgi/

<Location "/extmail/cgi">

SetHandler fastcgi-script

</Location>


#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/

Alias /phpmyadmin               /var/www/extsuite/phpmyadmin/

Alias /phpldapadmin             /var/www/extsuite/phpldapadmin/htdocs/

# Suexec config

SuexecUserGroup vuser vgroup

</VirtualHost>



GRANT all privileges on extmail.* TO extmail@localhost IDENTIFIED BY 'extmail';

GRANT all privileges on extmail.* TO webman@localhost IDENTIFIED BY 'webman';



<VirtualHost *:80>

ServerName mail.easy-cdn.cn

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 vuser vgroup

</VirtualHost>




后台出错:No such file or directory

/var/www/extsuite/extman/daemon/cmdserver --daemon


root@extmail.org,初始密码:extmail*123*,




alternatives --config mta


virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf

virtual_mailbox_base = /home/data/domains

virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf  

virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf

virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_limit_maps.cf  

virtual_transport = maildrop:



maildrop   unix        -       n        n        -        -        pipe

 flags=DRhu user=vuser argv=maildrop -w 90 -d ${user}@${nexthop} ${recipient} ${user} ${extension} {nexthop}



echo 'maildrop   unix        -       n        n        -        -        pipe' >>/etc/postfix/master.cf

echo '  flags=DRhu user=vuser argv=/usr/local/bin/maildrop -w 90 -d ${user}@${nexthop} ${recipient} ${user} ${extension} {nexthop}' >>/etc/postfix/master.cf



sed -i 's/maildrop  unix/#maildrop  unix/g' master.cf

sed -i 's/flags=DRhu/#flags=DRhu/g' master.cf




 去除免费注册按钮

修改文件:/var/www/extsuite/extmail/webmail.cf

修改位置:SYS_SHOW_SIGNUP = 1

修改结果:SYS_SHOW_SIGNUP = 0



groupadd webadm

useradd -g webadm webadm


tar zxvf pcre-8.01.tar.gz

cd pcre-8.01/

./configure

make ;make install

cd ../


tar zxvf nginx-0.8.53.tar.gz

cd nginx-0.8.53

./configure --user=webadm --group=webadm --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module

make; make install

cd ../



user  webadm webadm;


worker_processes 4;


error_log  /var/log/nginx_error.log  crit;


pid        /usr/local/nginx/nginx.pid;


#Specifies the value for maximum file descriptors that can be opened by this process.

worker_rlimit_nofile 51200;


events

{

use epoll;

worker_connections 51200;

}


http

{

include       mime.types;

default_type  application/octet-stream;


#charset  gb2312;


server_names_hash_bucket_size 128;

client_header_buffer_size 32k;

large_client_header_buffers 4 32k;

client_max_body_size 8m;


sendfile on;

tcp_nopush     on;


keepalive_timeout 60;


tcp_nodelay on;


fastcgi_connect_timeout 300;

fastcgi_send_timeout 300;

fastcgi_read_timeout 300;

fastcgi_buffer_size 64k;

fastcgi_buffers 4 64k;

fastcgi_busy_buffers_size 128k;

fastcgi_temp_file_write_size 128k;


gzip on;

gzip_min_length  1k;

gzip_buffers     4 16k;

gzip_http_version 1.0;

gzip_comp_level 2;

gzip_types       text/plain application/x-javascript text/css application/xml;

gzip_vary on;


server

{

  listen       8800;

  server_name  _;

  index index.html index.htm index.php index.cgi;

  root  /var/www/extsuite/extmail/html/;


  location /extmail/cgi/ {


            fastcgi_pass          127.0.0.1:8888;

            fastcgi_index         index.cgi;

            fastcgi_param  SCRIPT_FILENAME   /var/www/extsuite/extmail/cgi/$fastcgi_script_name;

            include               fcgi.conf;

       }

       location  /extmail/  {

            alias  /var/www/extsuite/extmail/html/;

       }

       location /extman/cgi/ {


            fastcgi_pass          127.0.0.1:8888;

            fastcgi_index         index.cgi;

            fastcgi_param  SCRIPT_FILENAME   /var/www/extsuite/extman/cgi/$fastcgi_script_name;

            include            fcgi.conf;

       }

       location /extman/ {

            alias  /var/www/extsuite/extman/html/;

       }

     log_format  extmaillog  '$remote_addr - $remote_user [$time_local] "$request" '

             '$status $body_bytes_sent "$http_referer" '

             '"$http_user_agent" $http_x_forwarded_for';

     access_log  off;

  }

}


#fastcgi.conf

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;

fastcgi_param  SERVER_SOFTWARE    nginx;


fastcgi_param  QUERY_STRING       $query_string;

fastcgi_param  REQUEST_METHOD     $request_method;

fastcgi_param  CONTENT_TYPE       $content_type;

fastcgi_param  CONTENT_LENGTH     $content_length;


fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;

fastcgi_param  REQUEST_URI        $request_uri;

fastcgi_param  DOCUMENT_ROOT      $document_root;

fastcgi_param  SERVER_PROTOCOL    $server_protocol;


fastcgi_param  REMOTE_ADDR        $remote_addr;

fastcgi_param  REMOTE_PORT        $remote_port;

fastcgi_param  SERVER_ADDR        $server_addr;

fastcgi_param  SERVER_PORT        $server_port;

fastcgi_param  SERVER_NAME        $server_name;


perl cgi:

/var/www/extsuite/extmail/dispatch-init start




去掉后台验证码

vi /var/www/wxtsuite/extman/webman.cf

sys_captcha_on = 0



附件:

postfix:

message_size_limit = 52428800

mailbox_size_limit = 52428800

extmail webmail.cf

SYS_MESSAGE_SIZE_LIMIT = 524288000






时间不对,后台会验证不通过!

本文转自 liang3391 51CTO博客,原文链接:http://blog.51cto.com/liang3391/1225893



相关实践学习
Serverless极速搭建Hexo博客
本场景介绍如何使用阿里云函数计算服务命令行工具快速搭建一个Hexo博客。
相关文章
|
3月前
|
Linux 开发工具 数据安全/隐私保护
CentOS7报错:“xxx is not in the sudoers file. This incident will be reported“解决方法
CentOS7报错:“xxx is not in the sudoers file. This incident will be reported“解决方法
154 0
|
6月前
|
Ubuntu Unix Linux
Linux 用户使用sudo时 显示xxx is not in the sudoers file.This incident will be reported.的解决方法
Linux 用户使用sudo时 显示xxx is not in the sudoers file.This incident will be reported.的解决方法
250 1
Error: Cannot create file “D:xampp\xampp-controlin“.拒绝访问。
Error: Cannot create file “D:xampp\xampp-controlin“.拒绝访问。
|
关系型数据库 MySQL 数据库
XAMPP报错:mysqli::real_connect(): (HY000/1045): Access denied for user ‘pma‘@‘localhost‘
XAMPP报错:mysqli::real_connect(): (HY000/1045): Access denied for user ‘pma‘@‘localhost‘
|
关系型数据库 MySQL 应用服务中间件
linux篇-Parse error: syntax error, unexpected ‘new’ (T_NEW) in /usr/local/nginx/html/cacti/lib/adodb
linux篇-Parse error: syntax error, unexpected ‘new’ (T_NEW) in /usr/local/nginx/html/cacti/lib/adodb
171 0
linux篇-Parse error: syntax error, unexpected ‘new’ (T_NEW) in /usr/local/nginx/html/cacti/lib/adodb
成功解决 _mssql.c(568): fatal error C1083: 无法打开包括文件: “sqlfront.h”: No such file or directory
成功解决 _mssql.c(568): fatal error C1083: 无法打开包括文件: “sqlfront.h”: No such file or directory
|
关系型数据库 MySQL
MySQL 启动错误: [ERROR] Can't find messagefile '/usr/share/errmsg.sys'(转载)
110623 21:49:41 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 110623 21:49:41 [ERROR] Can't find messagefile '/usr/share/errmsg.
5171 0
|
数据安全/隐私保护
Linux_服务器_03_xxx is not in the sudoers file.This incident will be reported.的解决方法
1.切换到root用户下,怎么切换就不用说了吧,不会的自己百度去.2.添加sudo文件的写权限,命令是:chmod u+w /etc/sudoers3.编辑sudoers文件vi /etc/sudoers找到这行 root ALL=(ALL) ALL,在他下面添加xxx ALL=(ALL) ALL ...
956 0