zoukankan      html  css  js  c++  java
  • centos/redhat 上安装邮件系统postfix+extmail

    、简介:
    本文以最简单,最方便的方法在centos 5.2 上安装一个全功能的邮件系统,此文适合REDHAT所有系列,在文中,能用RPM 安装的,我们将采用rpm 安装,如果rpm没有的,我们将创建自己的rpm。部分软件简介:
    1、AMP ---apacheweb服务) 、mysql数据库)、php(非必需) 的简称
    2、postfix --mta 邮件系统核心
    3、courier-authlib--一个为courier-imap,maildrop,sasl2 提供用户信息的后台进程序
    4、courier-imap --提供pop3,pop3s,imap,imaps 服务的程序
    5、amavisd-new --提供内容过滤
    6、clamav -- 著名的杀毒软件
    7、extmail --一个著名的webmail程序
    8、extman --与extmail集成的后台管理程序
    9、slockd --一个基于smtp阶段的反垃圾邮件程序
    10、vhmgr --由本文作者编写,用于管理apache,ftp,mysql 的虚拟主机管理程序。

    安装环境
    centos 5.2
    域名机器名:mail.yiyou.org
    域名:yiyou.org

    二、安装系统安装系统时,选择“customize software selection”(自定义安装),在package group selection 对话框里选择:

    1. [*]base
    2. [*]devlopment libraries
    3. [*]development tools
    4. [*]editors
    5. [*]text-base internet
    复制代码

    其它不选择。
    在setup agnet(或进入系统后运行setup) 里选择firewall configuration 将security level 与SELinux 改为disabled,目的是为了避免在安装调试时产生不必要的麻烦,在系统安装完成后,可以自己去调试安全部分,在这里将不作详细介绍。
    配置yum,在本文中使用的是网通线路,所以选择了http://mirrors.ta139.com/ 作为安装镜像。
    三、安装软件
    1、安装AMP

    1. [root@localhost ~]# yum -y install httpd httpd-devel mysql mysql-devel mysql-server php php-xml php-cli php-pdo php-mbstring php-mcrypt php-gd php-common php-devel php-mysql
    复制代码

    修改启动配置并启动

    1. [root@localhost ~]# chkconfig --level 345  mysqld on
    2. [root@localhost ~]# chkconfig --level 345  httpd on
    3. [root@localhost ~]# service mysqld start
    4. [root@localhost ~]# service httpd start
    复制代码

    2、安装phpmyadmin注意:可以选择自己需要的版本

    1. [root@localhost ~]# wget http://nchc.dl.sourceforge.net/sourceforge/phpmyadmin/phpMyAdmin-2.11.9-all-languages-utf-8-only.tar.bz2
    2. [root@localhost ~]# tar xjf phpMyAdmin-2.11.9-all-languages-utf-8-only.tar.bz2
    3. [root@localhost ~]# mv phpMyAdmin-2.11.9-all-languages-utf-8-only /var/www/html/phpmyadmin
    4. [root@localhost phpmyadmin]# cp config.sample.inc.php config.inc.php
    复制代码

    编辑config.inc.php 改为下面,字符串是任意的。

    1. $cfg['blowfish_secret'] = 'skssiwksksie'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
    复制代码

    进入phpmyadmin 请马上修改mysql root 用户的密码。
    3、导入extman 后台数据库将extmail/extman/slockd 上传到服务器,可以使用ftp/winscp 上传

    1. [root@localhost ~]# tar zxf extman-0.2.5b1.tar.gz
    2. [root@localhost ~]# cd extman-0.2.5b1/docs/
    3. [root@localhost docs]# mysql -uroot -p <extmail.sql
    4. Enter password:
    5. [root@localhost docs]# mysql -uroot -p <init.sql
    6. Enter password:
    复制代码

    如何使用了phpmyadmin改了root 密码,记得输入密码,如果密码为空,请按回车。
    4、RPM 简介下面我们将采用rpm 的方式安装软件
    /usr/src/redhat/SPEC spec 文件夹,通常是rpm文件夹
    /usr/src/redhat/RPMS 是生成rpm 的文件,下面还有i368,i486 等子文件夹,一般我们用i386 架构
    /usr/src/redhat/SOURCE 源文件文件夹
    为了安装时切换目录的方便,我们将目录存放到一个shell变量里。

    1. [root@localhost ~]# export RPMS=/usr/src/redhat/RPMS
    2. [root@localhost ~]# export SOURCE=/usr/src/redhat/SOURCES
    3. [root@localhost ~]# export SPEC=/usr/src/redhat/SPECS
    复制代码

    在下面安装过程中,大家要记住cd $RPMS 与cd /usr/src/redhat/RPMS 的目的是一样的,只是shell变量的替换。
    5、安装authlibA、安装依懒的包

    1. [root@localhost ~]# yum -y install postgresql-devel expect libtool-ltdl-devel
    2. [root@localhost ~]# wget http://prdownloads.sourceforge.net/courier/courier-authlib-0.61.0.tar.bz2
    3. [root@localhost ~]# tar xjf courier-authlib-0.61.0.tar.bz2
    4. [root@localhost ~]# cd courier-authlib-0.61.0
    5. [root@localhost courier-authlib-0.61.0]# cp courier-authlib.spec $SPEC
    6. [root@localhost courier-authlib-0.61.0]# cd ..
    7. [root@localhost ~]# cp courier-authlib-0.61.0.tar.bz2 $SOURCE
    8. [root@localhost ~]# cd $SPEC
    9. [root@localhost SPECS]# rpmbuild -bb courier-authlib.spec (创建rpm文件)
    复制代码

    B、安装生成的rpm

    1. [root@localhost SPECS]# cd $RPMS/i386
    2. [root@localhost i386]# rpm -ivh courier-authlib-0.61.0-1.i386.rpm
    3. [root@localhost i386]# rpm -ivh courier-authlib-devel-0.61.0-1.i386.rpm
    4. [root@localhost i386]# rpm -ivh courier-authlib-mysql-0.61.0-1.i386.rpm
    复制代码

    C、配置authlibdaemon

    1. [root@localhost i386]# cd /etc/authlib/
    2. [root@localhost authlib]# mv authdaemonrc authdaemonrc.bak
    3. [root@localhost authlib]# vim authdaemonrc
    复制代码

    输入下面的内容:

    1. authmodulelist="authmysql"
    2. authmodulelistorig="authmysql"
    3. daemons=10
    4. authdaemonvar=/var/spool/authdaemon
    5. DEBUG_LOGIN=2
    6. DEFAULTOPTIONS="wbnodsn=1"
    7. LOGGEROPTS=""
    复制代码

    D、配置authmysqlrc

    1. [root@localhost authlib]# mv authmysqlrc authmysqlrc.bak
    2. [root@localhost authlib]# vim authmysqlrc
    复制代码

    输入下面的内容:

    1. MYSQL_SERVER    localhost
    2. MYSQL_USERNAME  extmail
    3. MYSQL_PASSWORD  extmail
    4. MYSQL_PORT      0
    5. MYSQL_SOCKET    /var/lib/mysql/mysql.sock
    6. MYSQL_OPT       0
    7. MYSQL_DATABASE  extmail
    8. MYSQL_SELECT_CLAUSE     SELECT username,password,"",uidnumber,gidnumber,\
    9.                         CONCAT('/home/data/domains/',homedir),               \
    10.                         CONCAT('/home/data/domains/',maildir),               \
    11.                         quota,                                          \
    12.                         name                                            \
    13.                         FROM mailbox                                    \
    14.                         WHERE username = '$(local_part)@$(domain)'
    复制代码

    E、启动authlib

    1. [root@localhost ~]# service courier-authlib start
    2. Starting Courier authentication services: authdaemond
    3. [root@localhost ~]# chmod 777 /var/spool/authdaemon/
    复制代码

    6、安装courier-imap由于courier-imap 不能用root身份生成rpm那么我们新建一个普通用户,并创建一个rpm环境

    1. [root@localhost ~]# useradd yiyou
    复制代码

    软件包依懒需要安装openldap-server,rpm创建完成后可以删除

    1. [root@localhost ~]# yum -y install openldap-servers
    2. [root@localhost ~]# su - yiyou
    3. [yiyou@localhost ~]$ mkdir -p rpm/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
    4. [yiyou@localhost ~]$ vim  ~/.rpmmacros
    复制代码

    输入内容:

    1. %_topdir /home/yiyou/rpm
    2. [yiyou@localhost ~]$ wget http://prdownloads.sourceforge.net/courier/courier-imap-4.4.1.tar.bz2
    3. [yiyou@localhost ~]$ cp courier-imap-4.4.1.tar.bz2 rpm/SOURCES/
    4. [yiyou@localhost ~]$ tar xjf courier-imap-4.4.1.tar.bz2
    5. [yiyou@localhost ~]$ cd courier-imap-4.4.1
    6. [yiyou@localhost courier-imap-4.4.1]$ cp courier-imap.spec ../rpm/SPECS/
    7. [yiyou@localhost courier-imap-4.4.1]$ cd ../rpm/SPECS/
    复制代码

    编辑courier-imap.spec 将下面的内容:

    1. %if %suse_version
    2. BuildPreReq: rpm >= 3.0.5 /usr/bin/sed openldap2 openldap2-devel %([ %{suse_version} -gt 819 ] && echo /usr/include/fam.h)
    3. %else
    4. BuildPreReq: rpm >= 4.0.2 sed /usr/include/fam.h openldap-devel openldap-servers
    5. %endif
    复制代码

    改为:

    1. %if %suse_version
    2. BuildPreReq: rpm >= 3.0.5 /usr/bin/sed openldap2 openldap2-devel
    3. %else
    4. BuildPreReq: rpm >= 4.0.2 sed openldap-devel openldap-servers
    5. %endif
    复制代码

    创建rpm

    1. [yiyou@localhost SPECS]$ rpmbuild -bb courier-imap.spec
    复制代码

    完成rpm后,输入exit退出当前用户。

    1. [root@localhost ~]# rpm -ivh /home/yiyou/rpm/RPMS/i386/courier-imap-4.4.1-1.i386.rpm
    2. [root@localhost ~]# service courier-imap start
    复制代码

    7、安装cyrus-saslA、安装SRPM

    1. [root@localhost ~]# wget ftp://194.199.20.114/linux/fedora/updates/8/SRPMS/cyrus-sasl-2.1.22-8.fc8.src.rpm
    2. [root@localhost ~]# rpm -ivh cyrus-sasl-2.1.22-8.fc8.src.rpm
    3. [root@localhost ~]# cd $SPEC
    复制代码

    编辑cyrus-sasl.spec 将下面:

    1. # Bundling copy of Berkeley DB, for sasldb support.
    2. topdir=`pwd`
    3. pushd db-%{db_version}/build_unix
    4. ../dist/configure \
    5.         --with-mutex=UNIX/fcntl --disable-shared --enable-static --with-pic \
    6.         --with-uniquename=_cyrus_sasl_sasldb_rh \
    7.         --prefix=${topdir}/db-instroot \
    8.         --includedir=${topdir}/db-instroot/include \
    9.         --libdir=${topdir}/db-instroot/lib
    复制代码

    改为:

    1. # Bundling copy of Berkeley DB, for sasldb support.
    2. topdir=`pwd`
    3. pushd db-%{db_version}/build_unix
    4. ../dist/configure \
    5.         --with-mutex=UNIX/fcntl --disable-shared --enable-static --with-pic \
    6.         --with-uniquename=_cyrus_sasl_sasldb_rh \
    7.         --prefix=${topdir}/db-instroot \
    8.         --includedir=${topdir}/db-instroot/include \
    9.         --libdir=${topdir}/db-instroot/lib \
    10.         --with-authdaemond=/var/spool/authdaemon
    复制代码

    B、生成rpm

    1. [root@localhost SPECS]# rpmbuild -bb cyrus-sasl.spec
    2. [root@localhost RPMS]# cd $RPMS/i386
    3. [root@localhost i386]# rpm -e --nodeps cyrus-sasl-devel cyrus-sasl-plain cyrus-sasl cyrus-sasl-lib (如果这些包存在)
    4. [root@localhost i386]# rpm -ihv cyrus-sasl-lib-2.1.22-8.i386.rpm
    5. [root@localhost i386]# rpm -ihv cyrus-sasl-2.1.22-8.i386.rpm
    6. [root@localhost i386]# rpm -ihv cyrus-sasl-plain-2.1.22-8.i386.rpm
    复制代码

    ---------在这一步中有可能还要安装cyrus-sasl-devel,看实际情况
    C、配置sasl2创建/usr/lib/sasl2/smtpd.conf 文件,输入下面的内容:

    1. pwcheck_method:authdaemond
    2. log_level:3
    3. mech_list:PLAIN LOGIN
    4. authdaemond_path:/var/spool/authdaemon/socket
    复制代码

    8、安装postfixA、下载软件包

    1. [root@localhost i386]# cd
    2. [root@localhost ~]# wget http://ftp.wl0.org/official/2.5/SRPMS/postfix-2.5.4-2.src.rpm
    3. [root@localhost ~]# rpm -ivh postfix-2.5.4-2.src.rpm
    4. [root@localhost ~]# cd $SPEC
    复制代码

    编辑postfix.spec 修改下面的选项

    1. %define distribution rhel-5.0
    2. %define with_mysql_redhat 1
    3. %define with_sasl         2
    4. %define with_vda          1
    复制代码

    B、创建rpm

    1. [root@localhost SPECS]# rpmbuild -bb postfix.spec
    2. [root@localhost RPMS]# cd $RPMS/i386
    3. [root@localhost i386]# rpm -ivh postfix-2.5.4-2.rhel4.i386.rpm
    复制代码

    C、切换mta

    1. [root@localhost i386]# alternatives --config mta (选择2,postfix)
    2. [root@localhost i386]# rpm -e sendmail
    3. [root@localhost i386]# cd /usr/sbin/
    4. [root@localhost sbin]# mv sendmail sendmail.bak
    5. [root@localhost sbin]# newaliases
    6. [root@localhost sbin]# ln -s sendmail.postfix sendmail
    复制代码

    D、配置postfix

    1. [root@localhost ~]# cd /etc/postfix/
    2. [root@localhost postfix]# mv main.cf main.cf.bak
    3. [root@localhost postfix]# vim main.cf
    复制代码

    输入下面的内容:

    1. queue_directory = /var/spool/postfix
    2. command_directory = /usr/sbin
    3. daemon_directory = /usr/libexec/postfix
    4. data_directory = /var/lib/postfix
    5. mail_owner = postfix
    6. unknown_local_recipient_reject_code = 550
    7. debug_peer_level = 2
    8. debugger_command =
    9.          PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
    10.          ddd $daemon_directory/$process_name $process_id & sleep 5
    11. sendmail_path = /usr/sbin/sendmail.postfix
    12. newaliases_path = /usr/bin/newaliases.postfix
    13. mailq_path = /usr/bin/mailq.postfix
    14. setgid_group = postdrop
    15. html_directory = /usr/share/doc/postfix-2.5.2-documentation/html
    16. manpage_directory = /usr/share/man
    17. sample_directory = /etc/postfix
    18. readme_directory = /usr/share/doc/postfix-2.5.2-documentation/readme
    19. alias_database = hash:/etc/postfix/aliases
    20. alias_maps = hash:/etc/postfix/aliases
    21. myhostname = mail.yiyou.org
    22. mydomain = yiyou.org
    23. mydestination = $myhostname
    24. smtpd_banner = yiyou.org ESMTP Mail System
    25. message_size_limit = 14680064
    26. virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
    27. virtual_mailbox_base = /home/data/domains
    28. virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
    29. virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
    30. virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_limit_maps.cf
    31. virtual_transport = maildrop:
    32. maildrop_destination_recipient_limit = 1
    33. #sasl
    34. smtpd_sasl_auth_enable = yes
    35. smtpd_sasl2_auth_enable = yes
    36. smtpd_sasl_security_options = noanonymous
    37. broken_sasl_auth_clients = yes
    38. smtpd_recipient_restrictions =
    39. permit_mynetworks,
    40. permit_sasl_authenticated,
    41. reject_unauth_destination,
    42. reject_unauth_pipelining,
    43. reject_invalid_hostname
    复制代码

    复制extman/docs 目录的cf 文件到/etc/postfix

    1. [root@localhost postfix]# cp /root/extman-0.2.5b1/docs/mysql_virtual_* .
    复制代码

    因为配置文件的用户、密码与数据库时一样,所以不用修改。

    1. [root@localhost postfix]# service postfix start
    复制代码

    9、安装maildrop A、下载生成RPM

    1. [root@localhost postfix]# cd
    2. [root@localhost ~]# wget http://prdownloads.sourceforge.net/courier/maildrop-2.0.4.tar.bz2
    3. [root@localhost ~]# cp maildrop-2.0.4.tar.bz2 $SOURCE
    4. [root@localhost ~]# tar xjf maildrop-2.0.4.tar.bz2
    5. [root@localhost ~]# cd maildrop-2.0.4
    6. [root@localhost maildrop-2.0.4]# cp maildrop.spec $SPEC
    7. [root@localhost maildrop-2.0.4]# cd $SPEC
    复制代码

    编辑maildrop.spec 把下面:

    1. BuildRequires: /usr/include/fam.h gdbm-devel pcre-devel
    复制代码

    改为:

    1. BuildRequires:  gdbm-devel pcre-devel
    复制代码

    把下面:

    1. %configure --with-devel --enable-userdb --enable-maildirquota  \
    2. --enable-syslog=1 --enable-trusted-users='root mail daemon postmaster qmaild mmdf' \
    3. --enable-restrict-trusted=0 \
    4. --enable-sendmail=/usr/sbin/sendmail
    复制代码

    改为:

    1. %configure --with-devel --enable-userdb --enable-maildirquota \
    2. --enable-syslog=1 --enable-trusted-users='root mail daemon postmaster qmaild mmdf' \
    3. --enable-restrict-trusted=0 --enable-sendmail=/usr/sbin/sendmail \
    4. --enable-authlib
    复制代码

    B、创建安装maildrop rpm

    1. [root@localhost SPECS]# yum -y install pcre-devel
    2. [root@localhost SPECS]# rpmbuild -bb maildrop.spec
    3. [root@localhost SPECS]# cd $RPMS/i386
    4. [root@localhost i386]# rpm -ivh maildrop-2.0.4-1.i386.rpm
    复制代码

    C、添加虚似用户及创建目录

    1. [root@localhost i386]# cd
    2. [root@localhost ~]# groupadd -g 1000 vgroup
    3. [root@localhost ~]# useradd -g 1000 -u 1000 -s /sbin/nologin -d /dev/null vuser
    复制代码

    编辑/etc/postfix/master.cf ,加入下面的内容:

    1. maildrop unix -     n     n     -     -     pipe
    2. flags=DRhu user=vuser argv=/usr/bin/maildrop -d ${user}@${nexthop} ${recipient} ${user} ${extension} ${nexthop}
    复制代码

    D、创建邮件存储目录

    1. [root@localhost ~]# mkdir -p /home/data/domains/extmail.org/postmaster
    2. [root@localhost ~]# maildirmake /home/data/domains/extmail.org/postmaster/Maildir
    3. [root@localhost ~]# chown -R vuser:vgroup /home/data/domains/   
    复制代码

    E、测试maildrop

    1. [root@localhost ~]# echo "test" | maildrop -V 10 -d postmaster@extmail.org
    2. maildrop: authlib: groupid=1000
    3. maildrop: authlib: userid=1000
    4. maildrop: authlib: logname=postmaster@extmail.org, home=/home/data/domains/extmail.org/postmaster, mail=/home/data/domains/extmail.org/postmaster/Maildir/
    5. maildrop: Changing to /home/data/domains/extmail.org/postmaster
    6. Message start at 0 bytes, envelope sender=postmaster@extmail.org
    7. maildrop: Attempting .mailfilter
    8. maildrop: Delivery complete.
    复制代码

    出现上以信息说明authlib,maildrop 工作正常
    F、测试pop3

    1. [root@localhost ~]# telnet localhost 110
    2. Trying 127.0.0.1...
    3. Connected to localhost.localdomain (127.0.0.1).
    4. Escape character is '^]'.
    5. +OK Hello there.
    6. user postmaster@extmail.org
    7. +OK Password required.
    8. pass extmail
    9. +OK logged in.
    10. list
    11. +OK POP3 clients that break here, they violate STD53.
    12. 1 6
    13. .
    14. retr 1
    15. +OK 6 octets follow.
    16. test
    17. .
    18. quit
    19. +OK Bye-bye.
    20. Connection closed by foreign host.
    复制代码

    G、测试postfix

    1. [root@localhost ~]# perl -MMIME::Base64 -e 'print encode_base64("postmaster\@extmail.org");'
    2. cG9zdG1hc3RlckBleHRtYWlsLm9yZw==
    3. [root@localhost ~]# perl -MMIME::Base64 -e 'print encode_base64("extmail");'               
    4. ZXh0bWFpbA==
    5. [root@localhost ~]# service postfix restart (重启一下)
    6. [root@localhost ~]# telnet localhost 25
    7. Trying 127.0.0.1...
    8. Connected to localhost.localdomain (127.0.0.1).
    9. Escape character is '^]'.
    10. 220 yiyou.org ESMTP Mail System
    11. ehlo test.com
    12. 250-mail.yiyou.org
    13. 250-PIPELINING
    14. 250-SIZE 14680064
    15. 250-VRFY
    16. 250-ETRN
    17. 250-AUTH LOGIN PLAIN
    18. 250-AUTH=LOGIN PLAIN
    19. 250-ENHANCEDSTATUSCODES
    20. 250-8BITMIME
    21. 250 DSN
    22. auth login
    23. 334 VXNlcm5hbWU6
    24. cG9zdG1hc3RlckBleHRtYWlsLm9yZw==
    25. 334 UGFzc3dvcmQ6
    26. ZXh0bWFpbA==
    27. 235 2.7.0 Authentication successful
    28. quit
    29. 221 2.0.0 Bye
    30. Connection closed by foreign host
    复制代码

    10、安装amavisd-new编辑/etc/yum.repos.d/CentOS-Base.repo 加入下面的内容:

    1. [dag]
    2. name=Dag RPM Repostory for Red Hat Enterprise Linux
    3. baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
    4. gpgcheck=1
    5. enabled=1
    6. gpgkey=http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt
    复制代码
    1. [root@localhost ~]# yum -y install clamav clamav-db clamd clamav-devel amavisd-new
    复制代码

    编辑/etc/amavisd.conf,修改下面的内容

    1. $mydomain = 'yiyou.org';   # a convenient default for other settings
    复制代码

    把下面内容去掉注释,并修改为下面

    1. ['ClamAV-clamd',
    2.    \&ask_daemon, ["CONTSCAN {}\n", "/tmp/clamd.socket"],
    3.    qr/\bOK$/, qr/\bFOUND$/,
    4.    qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
    复制代码
    1. [root@localhost ~]# usermod -G amavis clamav
    2. [root@localhost ~]# service clamd start
    复制代码

    在/etc/postfix/master.cf 增加下面的内容:

    1. smtp-amavis  unix    -    -    n    -    4    smtp
    2.         -o smtp_data_done_timeout=1200
    3.         -o smtp_send_xforward_command=yes
    4.         -o disable_dns_lookups=yes
    5. 127.0.0.1:10025 inet    n    -    n    -    -    smtpd
    6.         -o content_filter=
    7.         -o local_recipient_maps=
    8.         -o relay_recipient_maps=
    9.         -o smtpd_restriction_classes=
    10.         -o smtpd_helo_restrictions=
    11.         -o smtpd_sender_restrictions=
    12.         -o smtpd_recipient_restrictions=permit_mynetworks,reject
    13.         -o mynetworks=127.0.0.0/8
    14.         -o strict_rfc821_envelopes=yes
    15.         -o smtpd_error_sleep_time=0
    16.         -o smtpd_soft_error_limit=1001
    17.         -o smtpd_hard_error_limit=1000
    18.         -o receive_override_options=no_header_body_checks
    复制代码

    在/etc/postfix/main.cf 加入下面的内容

    1. content_filter = smtp-amavis:[localhost]:10024
    复制代码
    1. [root@localhost ~]# service postfix reload
    复制代码

    11、安装extman/extmailA、配置apache修改/etc/httpd/conf/httpd.conf,将下面的选项改为:

    1. User vuser
    2. Group vgroup
    复制代码
    1. [root@localhost ~]# cd /etc/httpd/conf.d/
    2. [root@localhost conf.d]# vim extmail.conf
    复制代码

    输入下面的内容:

    1. Alias /extman/cgi/ /var/www/extsuite/extman/cgi/
    2. Alias /extman /var/www/extsuite/extman/html/
    3. <Location "/extman/cgi">
    4. SetHandler cgi-script
    5. Options +ExecCGI
    6. </Location>
    7. # config for ExtMail
    8. Alias /extmail/cgi/ /var/www/extsuite/extmail/cgi/
    9. Alias /extmail /var/www/extsuite/extmail/html/
    10. <Location "/extmail/cgi">
    11. SetHandler cgi-script
    12. Options +ExecCGI
    13. </Location>
    复制代码
    1. [root@localhost ~]# mkdir /var/www/extsuite
    2. [root@localhost ~]# tar zxf extmail-1.0.5b1.tar.gz
    3. [root@localhost ~]# cp -r extmail-1.0.5b1 /var/www/extsuite/extmail
    4. [root@localhost ~]# cp -r extman-0.2.5b1 /var/www/extsuite/extman
    复制代码

    B、配置extmail参数

    1. [root@localhost ~]# cd /var/www/extsuite/extmail/
    2. [root@localhost extmail]# cp webmail.cf.default webmail.cf
    复制代码

    修改webmail.cf 下面的选项

    1. SYS_SESS_DIR = /tmp/extmail
    2. SYS_MAILDIR_BASE = /home/data/domains
    3. SYS_MYSQL_USER = extmail
    4. SYS_MYSQL_PASS = extmail
    复制代码

    C、配置extman参数

    1. [root@localhost extmail]# cd /var/www/extsuite/extman/
    复制代码

    修改webman.cf 下面的选项:

    1. SYS_MAILDIR_BASE = /home/data/domains
    复制代码

    D、创建session 目录

    1. [root@localhost extman]# mkdir /tmp/{extman,extmail}
    2. [root@localhost extman]# chown vuser:vgroup /tmp/ext*
    复制代码

    E、配置后台日志分析工具

    1. [root@localhost addon]# cd /var/www/extsuite/extman/addon/
    2. [root@localhost addon]# cp -r mailgraph_ext /usr/local/
    复制代码

    将下面的内容加入/etc/rc.local

    1. /usr/local/mailgraph_ext/mailgraph-init start
    2. /usr/local/mailgraph_ext/qmonitor-init start
    复制代码

    安装所依懒的软件包

    1. [root@localhost mailgraph_ext]# yum -y install rrdtool perl-rrdtool perl-GD perl-File-Tail
    复制代码

    F、启动后台进程

    1. [root@localhost mailgraph_ext]# /usr/local/mailgraph_ext/qmonitor-init start
    2. Starting queue statistics grapher: qmonitor
    3. [root@localhost mailgraph_ext]# /usr/local/mailgraph_ext/mailgraph-init start
    4. Starting mail statistics grapher: mailgraph_ext
    复制代码

    G、访问extmail/extman打开浏览器,输入http://your_ip_address/extmail 注意:your_ip_address 为你实际的ip
    第一个测试用户为:postmaster 密码:extmail 域:extmail

    打开浏览器,输入http://your_ip_address/extman
    extman root 用户为:root@extmail.org 密码为:extmail*123*
    注意:进入系统后要修改密码及找回密码的提示问题、答案。

    12、安装slockdslockd 是一个基于策略的垃圾邮件软件,很多用户反映使用后,反垃圾效果非常明显,但是有部分用户由于对该软件的使用,特性不了解,而产生了很多麻烦。
    所在在此建议,如果你对该软件不了解,或者系统里的垃圾邮件少,可以暂时不安装。

    1. [root@localhost ~]# tar zxf slockd-0.2beta1.tar.gz
    2. [root@localhost ~]# cp -r slockd-0.2beta1 /usr/local/slockd
    3. [root@localhost ~]# cd /usr/local/slockd
    复制代码

    将下面的内容加入/etc/rc.local

    1. /usr/local/slockd/slockd-init start
    复制代码

    [root@localhost slockd]# vim config/main.cf (编辑slockd/config/main.cf)修改下面的内容

    1. setsid          1  (去掉注释,让程序成为后台进程)
    复制代码

    修改/etc/postfix/main.cf 将原先的内容:

    1. smtpd_recipient_restrictions =
    2. permit_mynetworks,
    3. permit_sasl_authenticated,
    4. reject_unauth_destination,
    5. reject_unauth_pipelining,
    6. reject_invalid_hostname
    复制代码

    改为:

    1. smtpd_recipient_restrictions =
    2. permit_mynetworks,
    3. permit_sasl_authenticated,
    4. reject_unauth_destination,
    5. reject_unauth_pipelining,
    6. reject_invalid_hostname,
    7. check_policy_service inet:127.0.0.1:10030
    复制代码

    重载postfix 配置文件

    1. [root@localhost slockd]# service postfix reload
    复制代码

    13、安装vhmgr vhostmgr 是一款虚似主机管理软件,可以对apache,pure-ftp,mysql 进行管理,是管理员的好帮手。
    vhostmgr 有如下特点:

    1. a、只需要安装一个apache,ftp
    2. b、apache 不需要以root
    3. 运行。用普通用户身份运行就行了。
    4. c、可以通过web 进行重读配置文件,系统关机,等操作
    5. d、采用apache+cgi
    6. 方式运行,容易配置,安装、使用文档详细。
    7. e、如果你是一个管理员,每为一个用户添加主机而麻烦,使用该软件将为你节省大量时间
    8. f、开通apache,ftp,mysql
    9. 都是即时生效。
    10. 更多功能,更多方便,使用后才知道!!!
    11. g、支持freebsd ,linux 等多种系统
    复制代码

    vhmgr 还有一个重要特点:开源并完全免费使用。


    为了不重复劳功,将不再次叙述。

    apache 改变运行id 后,php session功能将会出现问题,因为session 的存储目录权限没有跟着改变为新的,只要执行下面的命令即可解决问题。

    1. [root@localhost slockd]# chown -R vuser:vgroup /var/lib/php/session/
    复制代码

    这几天我会再做下测试,再传上来,在这安装过程中,最好不要只是复制,粘贴命令,各个命令是什么意思要仔细看,且

    且安装过程中如有错误要仔细看它的日志。

  • 相关阅读:
    shell脚本中生成延时
    linux小技巧
    自定义微信圈分享带的图片和内容
    OOM killer
    svn报错
    Fatal error: Call-time pass-by-reference has been removed
    ThinkPHP3.1.3源码分析---php文件压缩zlib.output_compression 和 ob_gzhandler
    确保 PHP 应用程序的安全
    判断来自电脑还是手机
    以About Us为范例在Zen cart中增加页面
  • 原文地址:https://www.cnblogs.com/zhouwenwu/p/2305543.html
Copyright © 2011-2022 走看看