chaohu 发表于 2004-10-25 10:51:12

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

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

samfan 发表于 2004-10-25 15:54:19

re:good!

good!

chaohu 发表于 2004-10-26 11:46:48

re:最终找到一个中文的了,那就是wmail,...

最终找到一个中文的了,那就是wmail,它就是sqwebmail汉化的,安装非常简单。 <br>
<br>
1、tar zxvf wmail-1.00rc1.20030724.tar.gz <br>
2、cd wmail-1.00rc1.20030724 <br>
3、chmod 755 install <br>
4、./install /usr/local/share #改变安装路径到/usr/local/share <br>
然后将/usr/local/share/wmail/www/cgi-bin/wmail复制到/usr/local/www/cgi-bin/ <br>
将/usr/local/share/wmail/www/下的image和index.html复制到/usr/local/www/data/下 <br>
最后修改 /usr/local/share/wmail/html/zh-cn下的index.html和invalid.html,将 <br>
<input type="hidden" name="domain" value="lfan.net">中的lfan.net <br>
修改为自己的域名就可以了。 <br>
访问:<a target=_blank href=http://192.168.0.88/>http://192.168.0.88/</a> <br>

flb_2001 发表于 2005-8-5 10:03:15

re:你们这帮垃圾,你看看文章中有多少漏掉的,...

你们这帮垃圾,你看看文章中有多少漏掉的,这些都是故意漏的,还在说好呢!抄人家的东西也要自己试了可以再拿出来嘛,这样不是给人误区了吗?<br>
如果都是这样的话,那你们的网站也没有存在的必要了!
页: [1]
查看完整版本: freebsd+qmail+mysql+vpopmail之完全ports安装