一、基本系统准备
1、安装freebsd4.10
选择全部安装,设置网卡地址:192.168.0.88,网关:192.168.0.1,dns:202.102.192.68,本机名:mail,域名:chinake.com,开通ftp,增加一个用户:chaohu,密码:123456用户组:wheel,目录选根目录/,安装完成后添加cvsup和portupgrade,重启。
注:增加用户是因为ports安装下载太慢,将需要的软件在windows下使用下载工具下一来后上传,另外可以用SSH登入主机,这样象我等windows用户也可熟练使用ee等编辑。
2、使用SecureCRT或者putty.exe登入,并su root用户。
#chmod 777 /usr/ports/distfiles
现假设你已经将需要的软件下载了,打开ftp工具(如leaftp),登入192.168.0.88,用户名chaohu和123456,上传文件。
3、更新ports
#cd /usr/share/examples/cvsup/
#/usr/local/bin/cvsup -g -L2 -h ftp.freebsdchina.org ports-supfile
同样可以更新stable-supfile和standard-supfile
到此基本系统安装结束。
二、web服务器准备
1、安装Apache-modssl
#cd /usr/ports/www/apache13-modssl/
#make install
根据提示:
#ee /etc/rc.conf
增加:apache_enable=YES
如果想要自己制定SSL证书,先别make clean
增加php支持
#cd /usr/ports/lang/php4
#make install
根据提示
#ee /usr/local/etc/apache/httpd.conf
增加:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#cd /usr/local/etc
#cp php.ini-dist php.ini
增加Zend支持,只能手动安装,不过很简单,到Zend网站将其下载后
#tar zxvf ZendOptimizer-2.5.5-freebsd4.3-i386.tar.gz
#cd ZendOptimizer-2.5.5-freebsd4.3-i386
#chmod 755 install.sh
#./install .sh UNix下不允许在当前目录下运行程序的,所以要加./,按照提示,几个回车就行了。
2、安装mysql
# cd /usr/ports/databases/mysql323-server
# make WITH_OPENSSL=yes WITH_LINUXTHREADS=yes BUILD_OPTIMIZED=yes
install clean
3、用ports 来安装phpmyadmin
#cd /usr/ports/databases/phpmyadmin
# ee Makefile,将默认的安装路径改为www/data,
以后的sqwebmail,qmailadmin,vqregister等软件请自行检查默认web的cgi-bin路径
#make install clean
#cd /usr/local/www/data/phpMyAdmin
#chmod 755 config.inc.php
#ee config.inc.php
将
$cfg['Servers'][$i]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)?
改成
$cfg['Servers'][$i]['auth_type'] = 'http'; // Authentication method (config, http or cookie based)?
4、增加expect的支持(sqwebmail修改密码要用的)
#cd /usr/ports/lang/expect
#make install clean
到此,web系统建成,如果还要优化,请参考有关mysql、apache网站,修改连接数,新建立虚拟主机等,修改php.ini中有关参数。
#reboot
三、qmail的安装
1、qmail
#cd /usr/ports/mail/qmail
#make WITH_BIG_TODO_PATCH=yes
#make disable-sendmail
#make enable-qmail
#cd /var/qmail/configure
#./config-fast mail.chinake.com
请将mail.chinake.com改成你自己的
#ee /etc/rc.conf
检查增加
sendmail_enable="NONE"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
2、vpopmail
#cd /usr/ports/mail/vpopmail
#make WITH_MYSQL=yes WITH_MYSQL_SERVER=localhost WITH_MYSQL_USER=vpopmail WITH_MYSQL_PASSWD=vpopmail WITH_MYSQL_DB=vpopmail install clean
请自行修改其中的vpopmail为你自己的,通过http://192.168.0.88/phpmyadmin/中的权限修改root用户密码,增加vpopmail数据库,增加vpopmail用户及密码,并给vpopmail对数据库vpopmail所有权限。其命令模式为:
#mysql
mysql>SET PASSWORD FOR root=PASSWORD('password');(修改root的密码)
mysql>CREATE DATABASE vpopmail;
mysql>use mysql;
mysql>GRANT USAGE ON * . * TO "vpopmail"@"localhost"IDENTIFIED BY "****";
mysql>GRANT ALL PRIVILEGES ON `vpopmail` . * TO "vpopmail"@"localhost"WITH GRANT OPTION ;
mysql>bye
3、ispell
#cd /usr/ports/german/ispell-neu
#make install clean
4、sqwebmail
#cd /usr/ports/mail/sqwebmail
#make WITH_VCHKPW=YES WITH_ISPELL=YES install
根据提示:
#make configure
#make clean
#ee /etc/crontab
增加以下:
40 * * * * root /usr/local/share/sqwebmail/cleancache.pl
#cd /usr/local/share/sqwebmail/
#cp authdaemonrc.dist authdaemonrc
#/usr/local/libexec/sqwebmail/authlib/authdaemond start
5、qmailadmin
#cd /usr/ports/mail/qmailadmin
#make install clean
好了,qmail前期准备工作就绪了,重启一服务器,看看authdaemond sqwebmaild有没有正常启动,如果没有,请检查上述步骤,下面准备配置。
四、配置qmail服务器
1、测试vpopmail
#cd /usr/local/vpopmail/bin
#./vadddomain test.com
#./vadduser test@test.com
如果没有任何提示的话,那么就对了。
2、安装daemontools
#cd /usr/ports/sysutils/daemontools
#make install clean
3、配置daemontools
3.1建立路径并设置权限
#mkdir -p /var/log/qmail/qmail-smtpd
#mkdir -p /var/log/qmail/qmail-pop3d
#mkdir -p /var/log/qmail/qmail-send
#chmod -R 755 /var/log/qmail
#chown -R qmaill:wheel /var/log/qmail
3.2 Svscan 启动
mkdir /service
chmod 755 /service
mkdir /var/qmail/supervise
chmod 755 /var/qmail/supervise
mkdir /var/qmail/supervise/qmail-smtpd
mkdir /var/qmail/supervise/qmail-smtpd/log
chmod +t /var/qmail/supervise/qmail-smtpd
mkdir /var/qmail/supervise/qmail-send
mkdir /var/qmail/supervise/qmail-send/log
chmod +t /var/qmail/supervise/qmail-send
mkdir /var/qmail/supervise/qmail-pop3d
mkdir /var/qmail/supervise/qmail-pop3d/log
chmod +t /var/qmail/supervise/qmail-pop3d
ln -s /var/qmail/supervise/* /service/
启动文件配置Qmail Control-File:
#ee /var/qmail/rc
env env - PATH="/var/qmail/bin:/usr/local/bin"
qmail-start ./Maildir/
POP3D:
#ee /var/qmail/supervise/qmail-pop3d/run
#!/bin/sh
exec /usr/local/bin/tcpserver -H -R -v -c100 0 110 /var/qmail/bin/qmail-popup mail.chinake.com /usr/local/vpopmail/bin/vchkpw /var/qmail/bin/qmail-pop3d Maildir 2>&1
#chmod 755 /var/qmail/supervise/qmail-pop3d/run
#ee /var/qmail/supervise/qmail-pop3d/log/run
#!/bin/sh
exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t s100000 n20 /var/log/qmail/qmail-pop3d 2>&1
#chmod 755 /var/qmail/supervise/qmail-pop3d/log
#chmod 755 /var/qmail/supervise/qmail-pop3d/log/run
收信
#ee cd /var/qmail/supervise/qmail-smtpd/run
#!/bin/sh
exec /usr/local/bin/tcpserver -p -R -x /etc/tcp.smtp.cdb -u92 -g91 -v -c100 0 smtp rblsmtpd /var/qmail/bin/qmail-smtpd 2>&1
#chmod 755 /var/qmail/supervise/qmail-smtpd/run
#ee /var/qmail/supervise/qmail-smtpd/log/run
#!/bin/sh
exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t s100000 n20 /var/log/qmail/qmail-smtpd 2>&1
#chmod 755 /var/log/qmail/qmail-smtpd/log
#chmod 755 /var/log/qmail/qmail-smtpd/log/run
发信
#ee /var/qmail/supervise/qmail-send/run
#!/bin/sh
exec /var/qmail/rc
#chmod 755 /var/qmail/supervise/qmail-send/run
#cd /var/qmail/supervise/qmail-send/log/run
#!/bin/sh
exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t s100000 n20 /var/log/qmail/qmail-send 2>&1
#chmod 755 /var/qmail/supervise/qmail-send/log/
#chmod 755 /var/qmail/supervise/qmail-send/log/run
#rm /usr/local/etc/rc.d/qmail.sh
#ee /usr/local/etc/rc.d/qmail.sh
#!/bin/sh
case "$1" in
start)
echo -n "Starting qmail: svscan"
if cd /var/qmail/supervise; then
env - PATH="/var/qmail/bin:/usr/local/bin:/usr/bin:/bin" svscan &
echo $! > /var/run/svscan.pid
fi
echo "."
;;
stop)
echo -n "Stopping qmail: svscan"
kill `cat /var/run/svscan.pid`
echo -n " qmail"
svc -dx /var/qmail/supervise/*
echo -n " logging"
svc -dx /var/qmail/supervise/*/log
echo "."
;;
stat)
cd /var/qmail/supervise
svstat * */log
;;
doqueue|alrm)
echo "Sending ALRM signal to qmail-send."
svc -a /var/qmail/supervise/qmail-send
;;
queue)
qmail-qstat
qmail-qread
;;
reload|hup)
echo "Sending HUP signal to qmail-send."
svc -h /var/qmail/supervise/qmail-send
echo "Sending HUP signal to qmail-pop3d."
svc -h /var/qmail/supervise/qmail-pop3d
;;
pause)
echo "Pausing qmail-send"
svc -p /var/qmail/supervise/qmail-send
echo "Pausing qmail-smtpd"
svc -p /var/qmail/supervise/qmail-smtpd
echo "Pausing qmail-pop3d"
svc -p /var/qmail/supervise/qmail-pop3d
;;
cont)
echo "Continuing qmail-send"
svc -c /var/qmail/supervise/qmail-send
echo "Continuing qmail-smtpd"
svc -c /var/qmail/supervise/qmail-smtpd
echo "Continuing qmail-pop3d"
svc -c /var/qmail/supervise/qmail-pop3d
;;
restart)
echo "Restarting qmail:"
echo "* Stopping qmail-smtpd."
svc -d /var/qmail/supervise/qmail-smtpd
echo "* Sending qmail-send SIGTERM and restarting."
svc -t /var/qmail/supervise/qmail-send
echo "* Restarting qmail-smtpd."
svc -u /var/qmail/supervise/qmail-smtpd
echo "* Sending qmail-pop3d SIGTERM and restarting."
svc -t /var/qmail/supervise/qmail-pop3d
;;
cdb)
tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp
chmod 644 /etc/tcp.smtp*
echo "Reloaded /etc/tcp.smtp."
;;
*)
echo "Usage: $0 {start|stop|restart|doqueue|reload|stat|pause|cont|cdb|queue}"
exit 1
esac
exit 0
#chmod 755 /usr/local/etc/rc.d/qmail.sh
#ee /etc/tcp.smtp
127.0.0.1:allow,RELAYCLIENT=""
198.168.1.:allow,RELAYCLIENT=""
200.200.200.:allow,RELAYCLIENT=""
:allow
#/usr/local/bin/tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp
#chmod 644 /etc/tcp.smtp.cdb
启动qmail
#/usr/local/etc/rc.d/qmail.sh start
如果没有错误的话,那么你成功了,如何有错误码,请检查以上编辑的文件,是否有空格或者其它格上的错误。
选择Qmail的主要原因是因为有用户注册,下面我们来安装它
1、安装qmailadmin
cd /usr/ports/mail/qmailadmin
make -DWITH_MODIFY_QUOTA
make install clean
2、安装vqregister
#cd /usr/ports/mail/vqregister
#make install clean
#ee /usr/local/www/cgi-bin-dist/vqregister/vqregister.conf
# vQregister configuration file
# ADMINEMAIL
#AdminEmail mh@myfreebsd.org
# REGISTERUSER
# Syntax: RegisterUser <username>
#RegisterUser emaildomain
# SUBJECT
#
# Syntax: Subject <subject>
#
Subject Your new email account at emaildomain
# VERIFY
#
# Syntax: Verify <on/off>
# Default: off
#
Verify off
# ALLOWPASSWORD
#
# Syntax: AllowPassword <on/off>
# Default: off
#
AllowPassword on
# ALLOWDOMAIN
#
# Syntax: AllowDomain <domain.tld>
#
AllowDomain chinake.com
# REDIRECT
#
# Syntax: Redirect <URL>
#
Redirect http://mail.chinake.com/cgi-bin/sqwebmail/sqwebmail
# PASSWORD
#
# Syntax: Password <password>
#
# PASSWORDLEN
#
# Syntax: PasswordLen <number>
# Default: 8
#
PasswordLen 8
# BADHOSTS
#
#BadHosts badhosts
# DB_Host <host>
#
# Syntax: DB_Host <hostname>
#
DB_Host localhost
# DB_Name
#
# Syntax: DB_Name <database>
#
DB_Name vpopmail
# DB_USER
#
# Syntax: DB_User <username>
#
DB_User vpopmail
# DB_PASSWORD
#
# Syntax: DB_Password <password>
#
DB_Password vpopmail
# DB_FIELDS
#
# Syntax: DB_Fields <table> <field>[,<field>[,<etc>]]
#
DB_Fields user_info user,dom,pass,cemail,fname
# ADVERTISE
#
# Syntax: Advertise <on/off>
#
Advertise off
安装杀毒软件
FreeBSD下的杀病毒软件很少,但是McAfee却一直为FreeBSD的stable版本(包括3.x和4.x)提供了McAfee VirusScan Command Line版本进行病毒防护。 安装也非常的简单:
cd /usr/ports/security/vscan
make install clean
到此,Qmail系统就安装成功了,
http://192.168.0.88/cgi-bin/qmailadmin/qmailadmin
输入域名和密码,可以进行管理,
http://192.168.0.88/cgi-bin/vqregister/vqregister.cgi
进行注册新用户,
http://192.168.0.88/cgi-bin/sqwebmail/sqwebmail
输入邮箱全称和密码,如test@chinake.com test,可以进行收发信,使用outlook发信需要stmp认证。
比较不满意的是sqwebmail界面太难看了,且不是中文的,哪位有心将它美化一下,汉化一下,如果你汉化了,请通知我,我也想要。
有什么问题到http://bbs.chinake.com来讨论,QQ:93606088,
----
最终找到一个中文的了,那就是wmail,它就是sqwebmail汉化的,安装非常简单。
1、tar zxvf wmail-1.00rc1.20030724.tar.gz
2、cd wmail-1.00rc1.20030724
3、chmod 755 install
4、./install /usr/local/share #改变安装路径到/usr/local/share
然后将/usr/local/share/wmail/www/cgi-bin/wmail复制到/usr/local/www/cgi-bin/
将/usr/local/share/wmail/www/下的image和index.html复制到/usr/local/www/data/下
最后修改 /usr/local/share/wmail/html/zh-cn下的index.html和invalid.html,将
<input type="hidden" name="domain" value="lfan.net">中的lfan.net
修改为自己的域名就可以了。
访问:http://192.168.0.88/ ,
原文URL: http://www.5dmail.net/html/2004-10-26/20041026163440.htm