在Linux平台上安装基于Postfix、Courier-imap、Extmail的邮件系统

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

在Linux平台上安装基于Postfix、Courier-imap、Extmail的邮件系统 V 0.2

很久之前就计划写一个Postfix在Linux平台上面的安装文档,把自己安装Postfix的过程总结一下,但由于工作的关系直到现在才动手。和个人的习惯有关,在安装过程中我使用了很多源代码,这对一个新手可能有些难度,但是我认为在Linux下面如何从源代码安装软件应当是每个系统管理都必须掌握的知识。我使用了CFLAGS="-march=i686 -O2 -fexpensive-optimizations" 作为gcc 3.4.4在686 CPU上面的优化参数,我不知道这样作是否妥当。这个版本修正了上个版本中出现的一些错误,在此对hzqbbc对我的帮助致以最诚挚的谢意。

*************************************************************************************

1、安装操作系统
首先请准备好CentOS 4.2安装光盘的第一张和第二张,在“Installation Type"中选择“Custom”。在“Disk Partitioning Setup”时选择“Manually partition with Disk Druid”,因为我们要将邮件保存在“/home/mail”目录中,所以请为其保留足够的硬盘空间。在“Firewall Configuration”中选择“No firewall”,这样便于调试,你可以在邮件系统工作正常之后根据实际情况设置Firewall策略。在“Package Group Selection”中选择“Text-based Internet”、“Development Tools”和“Administration Tools”三项。关于语言的选项你可以选择默认值,这样总的安装文件大小为“1218MB”。安装完成后可以设置Crontab,让邮件服务器每天1点和时间服务器同步时间:
crontab -e
0 1 * * * /usr/bin/rdate -s

2、安装MySQL
你可以根据服务器的CPU类型,下载适合你所用CPU的MySQL发行包。据MySQL官方网站()的报道,使用icc 8.1编译的MySQL在Intel CPU上面的性能与gcc相比有20%的上升,如果你使用Intel的CPU可以选择icc编译的MySQL发行包,我不知道为什么最新的4.1.15和5.0.15没有提供i386的icc编译版本,所以你只能使用4.1.14。
下载并安装icc8.1的RPM包:
/downloads/os-linux.html intel-icc8-libs-8.1-0.i386.rpm
/centos/4/os/i386/CentOS/RPMS/ compat-libstdc++-33-3.2.3-47.3.i386.rpm
rpm -ivh compat-libstdc++-33-3.2.3-47.3.i386.rpm
rpm -ivh intel-icc8-libs-8.1-0.i386.rpm
增加MySQL运行所需要的用户和组:
groupadd mysql
useradd mysql -g mysql -c "MySQL user" -d /nonexistent -s /sbin/nologin
安装MySQL软件,MySQL将被安装到“/usr/local/mysql”目录下:
tar zvxf mysql-max-4.1.14-pc-linux-gnu-i686-icc-glibc23.tar.gz
mv mysql-max-4.1.14-pc-linux-gnu-i686-icc-glibc23 /usr/local/mysql
cd /usr/local/mysql
scripts/mysql_install_db --user=mysql
chown -R root .
chown -R mysql data
chgrp -R mysql .
cp support-files/f /etc/f
修改MySQL的

配置文件(/etc/f),将MySQL服务器和客户端的默认socket由“/tmp/mysql.sock”修改为“/var/lib/mysql/mysql.sock”,并建立相应的目录:
mkdir /var/lib/mysql
chown mysql /var/lib/mysql
将mysql和mysqladmin两个命令连接到/usr/local/bin/目录下以方便使用:
ln -s /usr/local/mysql/bin/mysql /usr/local/bin/
ln -s /usr/local/mysql/bin/mysqladmin /usr/local/bin/
配置MySQL服务开机自动运行:
cp support-files/mysql.server /etc/rc.d/init.d/mysql
chmod +x /etc/rc.d/init.d/mysql
chkconfig --add mysql
设置MySQL的默认字符集为GB2312,并且只绑定在127.0.0.1这个IP地址上,增强其安全性:
修改/etc/rc.d/init.d/mysql文件,将第199行
从“$bindir/mysqld_safe --datadir=$datadir --pid-file=$pid_file >/dev/null 2>&1 &”
修改为“$bindir/mysqld_safe --datadir=$datadir --default-character-set=gb2312 --bind-address=127.0.0.1 --pid-file=$pid_file >/dev/null 2>&1 &”
注:为了安全请立即修改MySQL管理员的密码。

3、安装Web服务器
从下面的URL下载Apache 2.0.55的源代码:/dist/httpd/
增加Apache运行所需的用户和组:
groupadd httpd
useradd httpd -g httpd -c "Apache user" -d /nonexistent -s /sbin/nologin
安装Apache软件,Apache将被安装在“/usr/local/httpd”目录下:
tar jvxf httpd-2.0.55.tar.bz2
cd httpd-2.0.55
./configure --prefix=/usr/local/httpd --enable-so --enable-ssl \
--with-mpm=worker --enable-rewrite --enable-suexec --with-suexec-caller=httpd \
CFLAGS="-march=i686 -O2 -fexpensive-optimizations" CXXFLAGS="-march=i686 -O2 -fexpensive-optimizations"
make
make install
修改apache的配置文件(/usr/local/httpd/conf/httpd.conf),配置apache的默认语言、运行用户等参数:
DefaultLanguage zh_CN
User httpd
Group httpd

StartServers 10
MaxClients 1024
MinSpareThreads 100
MaxSpareThreads 800
ThreadsPerChild 64
MaxRequestsPerChild 0

设置Apache开机自动运行,在/etc/rc.local中增加:
/usr/local/httpd/bin/apachectl start&

4、安装PHP
从下面的URL下载PHP 4.4.0的源代码:/downloads.php
从MySQL的网站()上下载MySQL的开发包MySQL-devel-standard-4.1.14-0.rhel4.i386.rpm和MySQL-shared-standard-4.1.14-0.rhel4.i386.rpm
安装MySQL的开发包:
rpm -ivh MySQL-devel-standard-4.1.14-0.rhel4.i386.rpm
rpm -ivh MySQL-shared-standard-4.1.14-0.rhel4.i386.rpm
安装PHP 4.4.0,PHP将被安装在“/usr/local/php”目录下,PHP的配置文件(php.ini)放在“/usr/local/php/lib”目录中:
tar jvxf php-4.4.0.tar.bz2
cd php-4.4.0
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/httpd/bin/apxs \
--enable-track-vars --with-config-file-path=/usr/local/php/lib --with-mysql=/usr \
--enable-force-cgi-redirect --enable-ftp --with-openssl=/usr --with-gettext --with-zlib
make
make install
cp php.ini-dist

/usr/local/php/lib/php.ini
修改Apache的配置,增加对PHP的支持:
增加“AddType application/x-httpd-php .php .phtml”
修改“DirectoryIndex index.html index.html.var”为“DirectoryIndex index.html index.htm index.php index.cgi”
验证PHP是否安装成功:
echo '' >/usr/local/httpd/htdocs/info.php
重新启动Apache,在浏览器的地址栏中输入“http://服务器IP地址/info.php”,你应当可以看到关于PHP的详细信息,确认在MySQL章节中的“Client API version”版本是4.1.14。

5、安装Postfix
从下面的URL下载Postfix 2.2.5的源代码:
从下面的URL下载Postfix 2.2.5的VDA补丁程序:.br/nadal/
删除系统自带的Sendmail:
mv /etc/rc.d/init.d/sendmail /etc/rc.d/init.d/sendmail.OFF
mv /usr/sbin/sendmail /usr/sbin/sendmail.OFF
mv /usr/bin/newaliases /usr/bin/newaliases.OFF
mv /usr/bin/mailq /usr/bin/mailq.OFF
chmod 755 /usr/sbin/sendmail.OFF /usr/bin/newaliases.OFF /usr/bin/mailq.OFF
增加Postfix运行所需要的用户和组,并建立“/home/mail”目录作为存储邮件的地方:
groupadd postfix
groupadd postdrop
useradd postfix -g postfix -c "Postfix user" -d /nonexistent -s /sbin/nologin
mkdir /home/mail
chown postfix:postfix /home/mail
安装Postfix:
gzip -d postfix-2.2.5-vda.patch.gz
tar zvxf postfix-2.2.5.tar.gz
cd postfix-2.2.5
patch -p1 < ../postfix-2.2.5-vda.patch
make -f Makefile.init makefiles \ OPT='-march=i686 -O2 -fexpensive-optimizations' \
'CCARGS=-DHAS_MYSQL -I/usr/include/mysql -DUSE_SASL_AUTH -I/usr/include/sasl -DUSE_TLS' \
'AUXLIBS=-L/usr/lib -lmysqlclient -lz -lm -L/usr/local/lib -lsasl2 -lssl -lcrypto'
make
make install
注:“make install”命令后的所有问题都直接敲回车键即可。
mv /etc/aliases /etc/aliases.old
ln -s /etc/postfix/aliases /etc/aliases
echo 'root: admin@'>>/etc/postfix/aliases
/usr/bin/newaliases
注:因为Postfxi不允许直接发邮件给root用户,所以你需要为root用户建立一个别名。
建立Postfix作smtpd用户认证的配置文件:
vi /usr/lib/sasl2/smtpd.conf
pwcheck_method: authdaemond
log_level: 3
mech_list: plain login
authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket
建议用postconf -n 简化main.cf,这样的好处是main.cf比较短小,不容易造成同一个配置出现2次的问题:
cd /etc/postfix
postconf -n > main2.cf
mv main.cf main.cf.old
mv main2.cf main.cf
修改Postfix的配置文件,#号之后是说明文字:
vi /etc/postfix/main.cf
myhostname = # Line 68 是安装Postfix软件的主机名
mydomain = # Line 76 是安装Postfix软件的主机名中的域名部分
myorigin = $mydomain # Line 92
mydestination = # Line 153
alias_maps = hash:/etc/aliases # Line 375
home_mail

box = Maildir/ # Line 408
mailbox_transport = /usr/bin/procmail # Line 455
fallback_transport = /usr/bin/procmail # Line 473

# Add following line in file's finality
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_gid_maps = static:502
virtual_mailbox_base = /home/mail
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_limit = 102400000
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 502
virtual_transport = virtual
virtual_uid_maps = static:502
# Additional for quota support
virtual_create_maildirsize = yes
virtual_mailbox_extended = yes
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = Sorry, the user's maildir has overdrawn his diskspace quota, please try again later.
virtual_overquota_bounce = yes

broken_sasl_auth_clients = yes
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_non_fqdn_hostname,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unauth_destination,
reject_unauth_pipelining,
reject_invalid_hostname,
reject_rbl_client ,
reject_rbl_client ,
reject_rbl_client ,
reject_rbl_client
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
注:“virtual_gid_maps”和“virtual_uid_maps”是postfix用户的gid和uid,“virtual_minimum_uid”应当≤“virtual_uid_maps”,“virtual_mailbox_limit”是每个邮箱的大小。
配置Postfix使用MySQL存储用户信息:
vi /etc/postfix/mysql_virtual_alias_maps.cf
user = postfix
password = PosSDtf5$iTYx
hosts = localhost
dbname = postfix
query = SELECT goto FROM alias WHERE address='%s'

vi /etc/postfix/mysql_virtual_domains_maps.cf
user = postfix
password = PosSDtf5$iTYx
hosts = localhost
dbname = postfix
query = SELECT description FROM domain WHERE domain='%s'

vi /etc/postfix/mysql_virtual_mailbox_maps.cf
user = postfix
password = PosSDtf5$iTYx
hosts = localhost
dbname = postfix
query = SELECT maildir FROM mailbox WHERE username='%s'

vi /etc/postfix/mysql_virtual_mailbox_limit_maps.cf
user = postfix
password = PosSDtf5$iTYx
hosts = localhost
dbname = postfix
query = SELECT quota FROM mailbox WHERE username='%s'
注:配置文件中的“user”和“password”是Postfix访问MySQL的用户名和密码,我们将在安装PostfixAdmin的时候添加这个用户。
设置Postfix开机自动运行,在/etc/rc.local中增加:
/usr/sbin/postfix start&

6、安装Courier authentication library
从下面的URL下载Courier authlib 0.57的源代码:/?download.php
安装Courier authentication library:
tar jvxf courier-authlib-0.57.20051004.tar.bz2
cd courier-authlib-0.57.20

051004
./configure --prefix=/usr/local/courier-authlib --without-authpam --without-authldap \
--without-authpwd --without-authshadow --without-authvchkpw --without-authpgsql \
--with-authmysql --with-mysql-libs=/usr/lib --with-mysql-includes=/usr/include/mysql --with-redhat \
--with-authmysqlrc=/usr/local/courier-authlib/etc/authmysqlrc \
--with-authdaemonrc=/usr/local/courier-authlib/etc/authdaemonrc \
CFLAGS="-march=i686 -O2 -fexpensive-optimizations" CXXFLAGS="-march=i686 -O2 -fexpensive-optimizations"
make
make install
chmod 755 /usr/local/courier-authlib/var/spool/authdaemon
配置Courier authentication library:
cp /usr/local/courier-authlib/etc/authdaemonrc.dist /usr/local/courier-authlib/etc/authdaemonrc
vi /usr/local/courier-authlib/etc/authdaemonrc
authmodulelist="authmysql"
authmodulelistorig="authmysql"
daemons=10

vi /usr/local/courier-authlib/etc/authmysqlrc
MYSQL_SERVER localhost
MYSQL_USERNAME postfix
MYSQL_PASSWORD PosSDtf5$iTYx
MYSQL_SOCKET /var/lib/mysql/mysql.sock
MYSQL_DATABASE postfix
MYSQL_USER_TABLE mailbox
MYSQL_CRYPT_PWFIELD password
MYSQL_UID_FIELD '502'
MYSQL_GID_FIELD '502'
MYSQL_LOGIN_FIELD username
MYSQL_HOME_FIELD concat('/home/mail/',maildir)
MYSQL_MAILDIR_FIELD concat('/home/mail/',maildir)
MYSQL_NAME_FIELD name
注:配置文件中的“MYSQL_USERNAME”和“MYSQL_PASSWORD”是Courier authentication library访问MySQL的用户名和密码,你可以使用与Postfix访问MySQL相同的用户。“MYSQL_UID_FIELD”和“MYSQL_GID_FIELD”是postfix用户的gid和uid。
设置Courier authentication library开机自动运行,在/etc/rc.local中增加:
/usr/local/courier-authlib/sbin/authdaemond start&

7、安装Courier-IMAP
从下面的URL下载Courier-IMAP 4.0.6的源代码:/?download.php
增加Courier-IMAP运行所需的用户和组:
groupadd vmail
useradd vmail -g vmail -c "Courier imap user" -d /nonexistent -s /sbin/nologin
安装Courier-IMAP:
tar jvxf courier-imap-4.0.6.20051004.tar.bz2
cd courier-imap-4.0.6.20051004
./configure --prefix=/usr/local/courier-imap --with-trashquota --without-ipv6 --with-redhat \
--enable-unicode=utf-8,iso-8859-1,gb2312,big5 --disable-root-check \
CPPFLAGS='-I/usr/include/openssl -I/usr/local/courier-authlib/include' \
LDFLAGS='-L/usr/local/courier-authlib/lib -L/usr/lib' \
COURIERAUTHCONFIG='/usr/local/courier-authlib/bin/courierauthconfig' \
CFLAGS="-march=i686 -O2 -fexpensive-optimizations" CXXFLAGS="-march=i686 -O2 -fexpensive-optimizations"
make
make install
make install-configure
配置Courier-IMAP,为用户提供pop3服务:
vi /usr/local/courier-imap/etc/pop3d
POP3DSTART=yes
设置Courier-IMAP开机自动运行:
cp courier-imap.sysvinit /etc/rc.d/init.d/imap
chmod +x /etc/rc.d/init.d/imap
chkconfig --add imap

8、安装Zlib
从下面的URL下载zlib 1.2.3的源代码:http://www.zl

/
安装zlib
tar jvxf zlib-1.2.3.tar.bz2
cd zlib-1.2.3
./configure --prefix=/usr \
CFLAGS="-march=i686 -O2 -fexpensive-optimizations" CXXFLAGS="-march=i686 -O2 -fexpensive-optimizations"
make
make test
make install

9、安装Clam AntiVirus
从下面的URL下载clamav-0.87的源代码:/stable.php
增加Clam AntiVirus运行所需的用户和组:
groupadd clamav
useradd clamav -g clamav -c "Clam AntiVirus" -d /dev/null
安装Clam AntiVirus:
tar zvxf clamav-0.87.tar.gz
cd clamav-0.87
./configure --prefix=/usr/local/clamav CFLAGS="-march=i686 -O2 -fexpensive-optimizations" CXXFLAGS="-march=i686 -O2 -fexpensive-optimizations"
make
make install
配置Clam AntiVirus:
vi /usr/local/clamav/etc/clamd.conf
# Example
LogFile /var/log/clamd.log
DatabaseDirectory /usr/local/clamav/share/clamav
LocalSocket /var/run/clamav/clamd

vi /usr/local/clamav/etc/freshclam.conf
# Example
DatabaseDirectory /usr/local/clamav/share/clamav
UpdateLogFile /var/log/freshclam.log
注:你需要注释clamd.conf和freshclam.conf文件开头部分的“Example”。
建立clamd和freshclam的log文件,并让它们属于clamav用户:
touch /var/log/clamd.log
chown clamav:root /var/log/clamd.log
touch /var/log/freshclam.log
chown clamav:root /var/log/freshclam.log
mkdir -p /var/run/clamav
配置crontab,让Clam AntiVirus每天7点自动升级病毒库:
crontab -e
0 7 * * * /usr/local/clamav/bin/freshclam
设置Clam AntiVirus开机自动运行,在/etc/rc.local中增加:
/usr/local/clamav/sbin/clamd&

10、安装amavisd-new
在安装amavisd-new之前要安装amavisd-new运行所需的perl模块,你可以使用cpan命令安装所需要的模块,但是那样需要你的服务器在安装软件时可以连接到Internet,所以我选择一个比较笨的方法,先使用wget命令下载所需的模块,然后再手动安装:
wget /CPAN/authors/id/T/TO/TOMHUGHES/IO-Zlib-1.04.tar.gz
wget /CPAN/authors/id/K/KA/KANE/Archive-Tar-1.26.tar.gz
wget /CPAN/authors/id/S/SM/SMPETERS/Archive-Zip-1.16.tar.gz
wget /CPAN/authors/id/P/PM/PMQS/Compress-Zlib-1.41.tar.gz
wget /CPAN/authors/id/D/DO/DOUGW/Convert-TNEF-0.17.tar.gz
wget /CPAN/authors/id/M/ML/MLEHMANN/Convert-UUlib-1.051.tar.gz
wget /CPAN/authors/id/G/GA/GAAS/MIME-Base64-3.05.tar.gz
wget /CPAN/authors/id/D/DS/DSKOLL/MIME-tools-5.418.tar.gz
wget /CPAN/authors/id/M/MA/MARKOV/MailTools-1.67.tar.gz
wget /CPAN/authors/id/R/RH/RHANDOM/Net-Server-0.88.tar.gz
wget /CPAN/authors/id/G/GB/GBARR/libnet-1.19.tar.gz
wget /CPAN/authors/id/G/GA/GAAS/Digest-MD5-2.33.tar.gz
wget /CPAN/authors/id/D/DS/DSKOLL/IO-stringy-2.110.tar.gz
wget http://search.

/CPAN/authors/id/J/JH/JHI/Time-HiRes-1.76.tar.gz
wget /CPAN/authors/id/M/MH/MHARNISCH/Unix-Syslog-0.100.tar.gz
wget /CPAN/authors/id/P/PM/PMQS/BerkeleyDB-0.26.tar.gz
wget /CPAN/authors/id/G/GA/GAAS/IO-String-1.07.tar.gz
首先使用“tar zvxf”命令解开压缩文件,然后使用下面的命令安装perl模块:
perl Makefile.PL
make
make install
安装RAR for linux:
wget /rar/rarlinux-3.5.1.tar.gz
tar zvxf rarlinux-3.5.1.tar.gz
cd rar
make install
从下面的URL下载amavisd-new-2.3.3的源代码:http://www.ijs.si/software/amavisd/
增加amavisd-new运行所需要的用户:useradd amavis -g clamav -c "Amavisd" -d /var/amavis
安装amavisd-new:
tar zvxf amavisd-new-2.3.3.tar.gz
cd amavisd-new-2.3.3
mkdir /var/amavis
mkdir /var/amavis/tmp /var/amavis/var /var/amavis/db
chown -R amavis:clamav /var/amavis
chmod -R 750 /var/amavis
cp amavisd /usr/local/sbin/
chown root /usr/local/sbin/amavisd
chmod 755 /usr/local/sbin/amavisd
cp amavisd.conf /etc/
chown root /etc/amavisd.conf
chmod 644 /etc/amavisd.conf
mkdir /var/virusmails
chown amavis:clamav /var/virusmails
chmod 750 /var/virusmails
配置amavisd-new,使用Clam AntiVirus作为病毒过滤程序,bypass垃圾邮件过滤,你需要去掉第14、288、289、290、291前面的注释,#号之后是注释文本:
vi /etc/amavisd.conf
@bypass_spam_checks_maps = (1); #14
$max_servers = 10 #16
$daemon_user = 'amavis' #17
$daemon_group = 'clamav'; #18
['Clam Antivirus-clamd', #288
\&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd"],
qr/\bOK$/, qr/\bFOUND$/,
qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],

修改Postfix的配置,让它使用amavisd-new作内容过滤:
在master.cf的最后增加下面的内容:
vi /etc/postfix/master.cf
smtp-amavis unix - - n - 3 smtp
-o smtp_data_done_timeout=1200
-o disable_dns_lookups=yes
127.0.0.1:10025 inet n - n - - smtpd
-o content_filter=
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_restriction_classes=
-o smtpd_client_restrictions=
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks=127.0.0.0/8
-o strict_rfc821_envelopes=yes
在main.cf文件的最后增加下面的内容:
vi /etc/postfix/main.cf
content_filter = smtp-amavis:[127.0.0.1]:10024
设置amavisd-new开机自动运行,在/etc/rc.local中增加:
/usr/local/sbin/amavisd&

11、安装Postfix Admin
从下面的URL下载postfixadmin-2.1.0:/postfixadmin/
安装Postfix Admin:
tar zvxf postfixadmin-2.1.0.tgz -C /usr/local/httpd/htdocs/
mv /usr/local/httpd/htdocs/postfixadmin-2.1.0 /usr/local/httpd/htdocs/postfixadmin
cd /usr/local/httpd/htdocs/postfixadmin
mv setup.php setup.php.old
chown -R httpd:root *
chmod

640 *.php *.css
cd /usr/local/httpd/htdocs/postfixadmin/admin/
chmod 640 *.php .ht*
cd /usr/local/httpd/htdocs/postfixadmin/images/
chmod 640 *.gif *.png
cd /usr/local/httpd/htdocs/postfixadmin/languages/
chmod 640 *.lang
cd /usr/local/httpd/htdocs/postfixadmin/templates/
chmod 640 *.tpl
cd /usr/local/httpd/htdocs/postfixadmin/users/
chmod 640 *.php
建立Postfix Admin所需的MySQL数据库,在建立数据库之前需要修改DATABASE_MYSQL.TXT文件,其中第27行的“Postfix user & password”应当与你安装Postfix时的MySQL用户名和密码相同,为了安全你也应当修改postfixadmin用户的密码:
mysql -u root -p < DATABASE_MYSQL.TXT
配置Postfix Admin:
cp config.inc.php.sample config.inc.php
vi config.inc.php
$CONF['domain_path'] = 'YES';
$CONF['show_footer_text'] = 'NO';
$CONF['domain_in_mailbox'] = 'NO';
$CONF['database_type'] = 'mysqli';
注:你需要修改配置文件中postfixadmin用户的口令和DATABASE_MYSQL.TXT文件中的保持一致。
修改Apache的设置,增加对“/usr/local/httpd/htdocs/postfixadmin/admin”目录的访问控制:
vi /usr/local/httpd/conf/httpd.conf

AuthType Basic
AuthName "Welcome to Postfix Admin"
AuthUserFile /usr/local/httpd/conf/postfix
Require valid-user

/usr/local/httpd/bin/htpasswd -c /usr/local/httpd/conf/postfix admin

12、安装Extmail
从下面的URL下载extmail-0.20和enhanced-template-0.51:/cgi-bin/download.cgi
安装Extmail所需要的perl模块,安装的方法同上面的一样:
wget /CPAN/authors/id/T/TI/TIMB/DBI-1.48.tar.gz
wget /CPAN/authors/id/C/CA/CAPTTOFU/DBD-mysql-3.0002.tar.gz
wget /CPAN/authors/id/K/KA/KASPER/HTML-KTemplate-1.33.tar.gz
安装Extmail:
tar zxvf extmail-0.20.tar.gz
mv extmail-0.20 /usr/local/httpd/htdocs/extmail
cd /usr/local/httpd/htdocs/extmail
chown -R postfix.postfix cgi
配置Extmail,因为Extmail的Config.pm模块还不是很完善,在参数的后边一定不要有多余的空格:
cp webmail.cf.default webmail.cf
vi webmail.cf
SYS_CONFIG = /usr/local/httpd/htdocs/extmail/
SYS_LANGDIR = /usr/local/httpd/htdocs/extmail/lang
SYS_TEMPLDIR = /usr/local/httpd/htdocs/extmail/html
SYS_USER_LANG = zh_CN
SYS_USER_CHARSET = gb2312
SYS_MAILDIR_BASE = /home/mail
SYS_CRYPT_TYPE = md5
SYS_MYSQL_USER = postfixadmin
SYS_MYSQL_PASS = mysql_password
SYS_MYSQL_DB = postfix
SYS_MYSQL_HOST = localhost
# table name
SYS_MYSQL_TABLE = mailbox
SYS_MYSQL_ATTR_USERNAME = username
SYS_MYSQL_ATTR_PASSWD = password
SYS_MYSQL_ATTR_QUOTA = quota
SYS_MYSQL_ATTR_HOME = maildir
SYS_MYSQL_ATTR_MAILDIR = maildir

配置Apache:
vi /usr/local/httpd/conf/httpd.conf
AddHandler cgi-script .cgi
NameVirtual *:80

Options +ExecCGI



Serve

rAdmin webmaster@
DocumentRoot /usr/local/httpd/htdocs/extmail/html
Alias /extmail/cgi/ /usr/local/httpd/htdocs/extmail/cgi/
Alias /extmail/ /usr/local/httpd/htdocs/extmail/html/
Alias /admin/ /usr/local/httpd/htdocs/postfixadmin/
ScriptAlias /extmail/cgi/ /usr/local/httpd/cgi-bin/extmail/cgi/
SuexecUserGroup postfix postfix
ServerName
ErrorLog logs/-error_log
CustomLog logs/-access_log common



Options +ExecCGI

安装Extmail的高级模板:
tar zvxf enhanced-template-0.51.tar.gz -C /usr/local/httpd/htdocs/extmail/html
注:“”是你的域名。
你可以从上面看到Extmail的演示。

重新启动服务器,检查是不是所有的服务都正常启动!如果有什么问题请首先查看系统的日志,因为80%以上的问题都可以从日志中找到错误原因。


[ 此贴被wangmingda在2005-11-03 19:53重新编辑 ]

相关文档
最新文档