- 论坛徽章:
- 0
|
我的环境是 FC5+Mysql+Apache+PHP+Postfix+Cyrus-Sasl+Courier-authlib+Courier-imap
下面是我的配置文档,麻烦大家帮我看一下有没有什么问题:
1、 安装mysql
[root @ test root] # groupadd mysql
[root @ test root] # useradd -g mysql mysql
[root @ test root] # tar xzvf mysql-5.0.45.tar.gz
[root @ test root] # cd mysql-5.0.45
[root @ test mysql-5.0.45] # ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --with-charset=gbk
[root @ test mysql-5.0.45] # make
[root @ test mysql-5.0.45] # make install
[root @ test mysql-5.0.45] # cp support-files/my-medium.cnf /etc/my.cnf
设置自启动
[root @ test mysql-5.0.45] # cp support-files/mysql.server /etc/rc.d/init.d/mysqld
[root @ test mysql-5.0.45] # chmod 755 /etc/rc.d/init.d/mysqld
[root @ test mysql-5.0.45] # chkconfig —add mysqld
[root @ test mysql-5.0.45] # chkconfig --level 35 mysqld on
初始化数据库
[root @ test mysql-5.0.45] # cd /usr/local/mysql
[root @ test mysql] # /usr/local/mysql/bin/mysql_install_db —user=mysql
[root @ test mysql] # chown -R root .
[root @ test mysql] # chown -R mysql var
[root @ test mysql] # chgrp -R mysql .
安装 openssl
[root @ test root] # tar xzvf openssl-0.9.8d.tar.gz
[root @ test root] # cd openssl-0.9.8d
[root @ test openssl-0.9.8d] # ./config shared zlib
[root @ test openssl-0.9.8d] # make
[root @ test openssl-0.9.8d] # make install
[root @ test openssl-0.9.8d] # mv /usr/bin/openssl /usr/bin/openssl.OFF
[root @ test openssl-0.9.8d] # mv /usr/include/openssl /usr/include/openssl.OFF
[root @ test openssl-0.9.8d] # mv /usr/lib/libssl.so /usr/lib/libssl.so.OFF
[root @ test openssl-0.9.8d] # ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
[root @ test openssl-0.9.8d] # ln -s /usr/local/ssl/include/openssl /usr/include/openssl
[root @ test openssl-0.9.8d] # ln -sv /usr/local/ssl/lib/libssl.so.0.9.8 /usr/lib/libssl.so
[root @ test openssl-0.9.8d] # vi /etc/ld.so.conf
在最后一行添加下面这一句
/usr/lcoal/ssl/lib
[root @ test openssl-0.9.8d] # ldconfig -v
验证 openssl 的安装
[root @ test openssl-0.9.8d] # openssl version
[root @ test openssl-0.9.8d] # rm -rf /usr/local/lib/sasl2/
[root @ test openssl-0.9.8d] # rm -rf /usr/lib/sasl2
2、安装 cyrus-sasl
[root @ test root] # tar xzvf cyrus-sasl-2.1.22.tar.gz
[root @ test root] # cd cyrus-sasl-2.1.22
[root @ test cyrus-sasl-2.1.22] # ./configure --prefix=/usr/local/sasl2 --disable-gssapi --disable-anon --disable-sample --disable-digest --disable-plain --disable-login --enable-sql --with-mysql=/usr/local/mysql --with-mysql-includes=/usr/local/mysql/include/mysql --with-mysql-libs=/usr/local/mysql/lib/mysql --with-authdaemond=/usr/local/var/spool/authdaemon/socket
[root @ test cyrus-sasl-2.1.22] # make
[root @ test cyrus-sasl-2.1.22] # make install
[root @ test cyrus-sasl-2.1.22] # ln -sv /usr/local/sasl2/lib/* /usr/lib
[root @ test cyrus-sasl-2.1.22] # ln -sv /usr/local/sasl2/lib/* /usr/local/lib
[root @ test cyrus-sasl-2.1.22] # ln -sv /usr/local/sasl2/include/sasl/* /usr/local/include
[root @ test cyrus-sasl-2.1.22] # mkdir -pv /var/state/saslauthd
[root @ test cyrus-sasl-2.1.22] # /usr/local/sasl2/sbin/saslauthd -a shadow pam -d
[root @ test cyrus-sasl-2.1.22] # echo "/usr/local/sasl2/lib" >> /etc/ld.so.conf
[root @ test cyrus-sasl-2.1.22] # echo "/usr/local/sasl2/lib/sasl2" >> /etc/ld.so.con
[root @ test cyrus-sasl-2.1.22] # ldconfig
开机自启动
[root @ test cyrus-sasl-2.1.22] # echo "/usr/local/sasl2/sbin/saslauthd -a shadow pam" >> /etc/rc.local
3、安装BerkeleyDB
[root @ test root] # tar xzvf db-4.5.20.tar.gz
[root @ test root] # cd db-4.5.20/build_unix
[root @ test build_unix] # ../dist/configure —prefix=/usr/local/BerkeleyDB
[root @ test build_unix] # make
[root @ test build_unix] # make install
[root @ test build_unix] # mv /usr/include/db4 /usr/include/db4.OFF
[root @ test build_unix] # rm /usr/include/db_cxx.h
[root @ test build_unix] # rm -rf /usr/include/db.h
[root @ test build_unix] # rm -rf /usr/include/db_185.h
[root @ test build_unix] # ln -s /usr/local/BerkeleyDB/include /usr/include/db4
[root @ test build_unix] # ln -s /usr/local/BerkeleyDB/include/db.h /usr/include/db.h
[root @ test build_unix] # ln -s /usr/local/BerkeleyDB/include/db_cxx.h /usr/include/db_cxx.h
[root @ test build_unix] # echo "/usr/local/BerkeleyDB/lib/" >> /etc/ld.so.conf
[root @ test build_unix] # ldconfig
4、安装Apache
[root @ test root] # tar xzvf httpd-2.2.4.tar.gz
[root @ test root] # cd httpd-2.2.4
[root @ test httpd-2.2.4] # ./configure --prefix=/usr/local/apache --enable-so --enable-ssl --with-ssl --with-ssl=/usr/local/ssl --enable-track-vars --enable-rewrite --with-zlib --enable-mods-shared=most --enable-suexec --with-suexec-caller=daemon
[root @ test httpd-2.2.4] # make
[root @ test httpd-2.2.4] # make install
设置开机自启动
[root @ test httpd-2.2.4] # echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.local
5、安装 php
[root @ test root] # tar xzvf php-5.2.3.tar.gz
[root @ test root] # cd php-5.2.3
[root @ testphp-5.2.3] # ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-xml --with-png --with-jpeg --with-zlib --with-freetype --with-gd --enable-track-vars --enable-mbstring=all
[root @ testphp-5.2.3] # make
[root @ testphp-5.2.3] # make install
[root @ testphp-5.2.3] # cp php.ini-dist /usr/local/php/lib/php.in
[root @ testphp-5.2.3] # vi /usr/local/apache/conf/httpd.conf
将DocumentRoot "/usr/local/apache/htdocs”
改成
DocumentRoot "/var/www"
将DocumentRoot "/usr/local/apache/htdocs"
改成
DocumentRoot "/var/www"
在<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
添加 index.php
在AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
6、安装postfix
[root @ test root] # tar xzvf postfix-2.4.5.tar.gz
[root @ test root] # cd postfix-2.4.5
[root @ test postfix-2.4.5] # make makefiles 'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include/mysql -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/local/sasl2/include/sasl -I/usr/local/BerkeleyDB/include -DUSE_TLS -I/usr/local/ssl/include/openssl' 'AUXLIBS=-L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lm -L/usr/local/sasl2/lib -lsasl2 -L/usr/local/BerkeleyDB/lib -L/usr/local/ssl/lib -lssl -lcrypto'
[root @ test postfix-2.4.5] # make
[root @ test postfix-2.4.5] # make install
[root @ test postfix-2.4.5] # vi /etc/postfix/main.cf
#=======================Virtual settings=============================
virtual_mailbox_base = /var/mailbox
virtual_mailbox_maps = mysql:/etc/postfix/mysql/mysql_virtual_mailbox_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql/mysql_virtual_domains_maps.cf
virtual_alias_domains =
virtual_alias_maps = mysql:/etc/postfix/mysql/mysql_virtual_alias_maps.cf
virtual_uid_maps = static:503
virtual_gid_maps = static:503
virtual_transport = virtual
maildrop_destination_recipient_limit = 1
maildrop_destination_concurrency_limit = 1
#=============================QUOTA====================================
message_size_limit = 14336000
virtual_mailbox_limit = 20971520
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
#============================SASL=======================================
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions =
permit_mynetworks, permit_sasl_authenticated, reject_invalid_hostname, reject_non_fqdn_hostname, reject_unknown_sender_domain,
reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_pipelining,
reject_unauth_destination, permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
smtpd_sasl_application_name = smtpd
smtpd_banner = $myhostname ESMTP "Version not Available"
[root @ test postfix-2.4.5] # vi /etc/postfix/mysql/mysql_virtual_alias_maps.cf
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = alias
select_field = goto
where_field = address
[root @ test postfix-2.4.5] # vi /etc/postfix/mysql/mysql_virtual_domains_maps.cf
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = domain
select_field = description
where_field = domain
#additional_conditions = and backupmx = '0' and active = '1'
[root @ test postfix-2.4.5] # vi /etc/postfix/mysql/mysql_virtual_mailbox_limit_maps.cf
user = extmail
password = extmail
hosts = localhost
dbname = extmail
tables = mailbox
select_field = quota
where_field = username
#additional_conditions = and active = '1'
[root @ test postfix-2.4.5] # vi /etc/postfix/mysql/mysql_virtual_mailbox_maps.cf
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = mailbox
select_field = maildir
where_field = username
#additional_conditions = and active = '1'
[root @ test postfix-2.4.5] # vi /usr/local/etc/authlib/authmysqlrc
MYSQL_SERVER localhost
MYSQL_USERNAME extamail
MYSQL_PASSWORD extmail
MYSQL_SOCKET /tmp/mysql.sock
MYSQL_DATABASE extmail
MYSQL_USER_TABLE mailbox
MYSQL_CRYPT_PWFIELD password
MYSQL_UID_FIELD '503"
MYSQL_GID_FIELD '503""
MYSQL_LOGIN_FIELD username
MYSQL_HOME_FIELD concat('/var/mailbox/',maildir)
MYSQL_NAME_FIELD name
MYSQL_MAILDIR_FIELD concat('/var/mailbox/',maildir)
[root @ test postfix-2.4.5] # vi /usr/local/etc/authlib/authdaemonrc
authmodulelist="authmysql"
authmodulelistorig="authmysql"
daemons=10
配置 smtp 论证
[root @ test postfix-2.4.5] # vi /usr/local/lib/sasl2/smtpd.conf
pwcheck_method: authdaemond
log_level: 3
mech_list: PLAIN LOGIN
authdaemond: /usr/local/var/spool/authdaemon/socket
7、安装 extmail
[root @ test root] # tar xzvf extmail-1\[1\].0.2.tar.gz
[root @ test root] # mkdir -p /var/www/extsuite
[root @ test root] # mv extmail-1.0.2 /var/www/extsuite/extmail
[root @ test root] # cp /var/www/extsuite/extmail/webmail.cf.default /var/www/extsuite/extmail/webmail.cf
修改主配置文件
[root @ test root] #
将 SYS_USER_LANG = us_EN
改成
SYS_USER_LANG = zh_CN
将SYS_MAILDIR_BASE = /home/domains
改成
SYS_MAILDIR_BASE = /var/mailbox
将
SYS_MYSQL_USER = db_user
SYS_MYSQL_PASS = db_pass
改成
SYS_MYSQL_USER = extmail
SYS_MYSQL_PASS = extmail
将
SYS_MYSQL_SOCKET = /var/lib/mysql/mysql.sock
改成
SYS_MYSQL_SOCKET = /tmp/mysql.sock
将
SYS_AUTHLIB_SOCKET = /var/spool/authdaemon/socket
改成
SYS_AUTHLIB_SOCKET = /usr/local/var/spool/authdaemon/socket
[root @ test root] # vi /usr/local/apache/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot /var/www/extsuite/extmail/html
ServerName mail.test.com
Alias /extmail /var/www/extsuite/extmail/html
ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi
SuexecUserGroup postfix postfix
</VirtualHost>
[root @ test root] # chown -R postfix:postfix /var/www/extsuite/extmail/cgi
[root @ test root] # vi /usr/local/apache/conf/httpd.conf
将
User daemon
Group daemon
修改成
User postfix
Group postfix
[root @ test root] # tar xzvf Desktop/Unix-Syslog-0.100.tar.gz
[root @ test root] # cd Unix-Syslog-0.100
[root @ test Unix-Syslog-0.100] # perl Makefile.PL
[root @ test Unix-Syslog-0.100] # make
[root @ test Unix-Syslog-0.100] # make install
[root @ test root] # tar Desktop/DBD-mysql-3.0002_5.tar.gz
[root @ test root] # cd DBD-mysql-3.0002_5
[root @ test DBD-mysql-3.0002_5] # perl Makefile.PL
[root @ test DBD-mysql-3.0002_5] # make
[root @ test DBD-mysql-3.0002_5] # make install
安装 courier-authlib
[root @ test root] # tar xvf courier-authlib-0.58.tar.tar
[root @ test root] # cd courier-authlib-0.58
[root @ test courier-authlib-0.58] # ./configure --without-authpam --without-authldap --without-authpwd --without-authshadow --without-authvchkpw --without-authpgsql --with-authmysql --with-mysql-libs=/usr/local/mysql/lib/mysql --with-mysql-includes=/usr/local/mysql/include/mysql --with-redhat
[root @ test courier-authlib-0.58] # make
[root @ test courier-authlib-0.58] # make install
[root @ test courier-authlib-0.58] # cd /usr/local/courier-authlib/etc/authlib/
[root @ test authlib] # cp authdaemonrc.dist authdaemonrc
[root @ test authlib] # cp authmysqlrc.dist authmysqlrc
[root @ test authlib] # vi authmysqlrc
MYSQL_SERVER localhost
MYSQL_USERNAME extmail
MYSQL_PASSWORD extmail
MYSQL_SOCKET /tmp/mysql.sock
MYSQL_DATABASE extmail
MYSQL_USER_TABLE mailbox
MYSQL_CRYPT_PWFIELD password
MYSQL_UID_FIELD '503'
MYSQL_GID_FIELD '503'
MYSQL_LOGIN_FIELD username
MYSQL_HOME_FIELD concat('/var/mailbox/',maildir)
MYSQL_NAME_FIELD name
MYSQL_MAILDIR_FIELD concat('/var/mailbox/',maildir)
[root @ test authlib] # vi authdaemonrc
authmodulelist="authmysql"
authmodulelistorig="authmysql"
daemons=10
[root @ test authlib] # cd /root/coureier-authlib-0.58
[root @ test courier-authlib-0.58] # cp courier-authlib.sysvinit /etc/init.d/courier-authlib
[root @ test courier-authlib-0.58] # chmod 755 /etc/init.d/courier-authlib
[root @ test courier-authlib-0.58] # echo "/usr/local/courier-authlib/lib/courier-authlib" >> /etc/ld.so.conf
[root @ test courier-authlib-0.58] # ldconfig
安装 courier-imap
[root @ test root] # tar jxvf courier-imap-4.1.3.tar.bz2
[root @ test root] # cd courier-imap-4.1.3
[root @ test courier-imap-4.1.3] # ./configure --prefix=/usr/local/imap --with-redhat --enable-unicode --disable-root-check --with-trashquota --without-ipv6 CPPFLAGS='-I/usr/local/ssl/include/openssl -I/usr/local/courier-authlib/include'
[root @ test courier-imap-4.1.3] # make
[root @ test courier-imap-4.1.3] # make install
[root @ test courier-imap-4.1.3] # cd /usr/local/imap/etc
[root @ test etc] # cp imapd.dist imapd
[root @ test etc] # p imapd-ssl.dist imapd-ssl
[root @ test etc] # cp pop3d.dist pop3d
[root @ test etc] # cp pop3d.dist pop3d
[root @ test etc] # vi pop3d
POP3DSTART=YES
[root @ test etc] # vi imapd
[root @ test etc] # cd /root/courier-imap-4.1.3
[root @ test courier-imap-4.1.3] # cp courier-imap.sysvinit /etc/rc.d/init.d/courier-imapd
[ 本帖最后由 liheng 于 2007-9-14 18:48 编辑 ] |
|