• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: | 推荐给好友 上一篇 | 下一篇

freebsd+qmail+mysql+vpopmail之完全ports安装

发布: 2007-5-25 23:49 | 作者: 未知 | 来源: Blog.ChinaUnix.net | 查看: 18次 | 进入软件测试论坛讨论

领测软件测试网 freebsd+qmail+mysql+vpopmail之完全ports安装


一、基本系统准备
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-smtp_auth+tls/
#make WITH_QMAILQUEUE_PATCH=yes WITH_BIG_TODO_PATCH=yes install clean
#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
5、cd /usr/ports/sysutils/daemontools
make install clean
#ee /etc/crontab
增加以下:
40      *      *      *      *       root      /usr/local/share/sqwebmail/cleancache.pl

#cd /usr/local/share/sqwebmail/
#/usr/local/libexec/sqwebmail/authlib/authdaemond start

好了,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/qmail/supervise/qmail-smtpd/log
#chmod 755 /var/qmail/supervise/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 "" 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: "
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=""
: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>
#
到此,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界面太难看了,且不是中文的,最终找到一个中文的了,那就是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/





有什么问题到http://bbs.chinake.com来讨论,QQ:93606088
E-mail:chaohunw@sohu.com
本文可以任意转载,转载请注明出处。

延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:info@testage.com.cn 电话:010-51297073

软件测试 | 领测国际ISTQBISTQB官网TMMiTMMi认证国际软件测试工程师认证领测软件测试网