在fc4上安装vhcs2.4.7
今天忽然有网友请我安装vhcs,我记得我当时安装是好久以前的事情了,找了以前整理的文档,贴出来给大家看看,自己以前好多文档都丢了。
在fc4上安装vhcs2.4.7.tar.bz2
只需要fc4一张光盘就可以了
安装过程中
1.choose "server" option during install,or just grab the "Fedora-Server" CD.
2.firewall: open ssh/http/https/ftp/smtp ports
3.selinux: disable
4.select minimum install
分区步骤分为:
/ 3GB
/tmp 1GB
swap 1GB
/var 剩余所有空间
如果有日志最好有个
/var/log
磁盘配额:
# vi /etc/fstab
add ",usrquota" after the line for "/var" volume
# touch /var/aquota.user
# chmod 600 /var/aquota.user
# mount -o remount,usrquota /var
# quotacheck -avugm
卸载掉不需要的包
# yum remove apmd autofs bluez-utils cups irda-utils \
iiimf-server iiimf-libs iiimf-csconv iiimf-docs \
isdn4k-utils pcmcia-cs sendmail \
xorg-x11-xfs ypbind xinetd
安装一些perl的包
# yum install perl-libwww-perl perl-HTML-Parser perl-HTML-Tagset perl-URI \
perl-Crypt-Blowfish perl-Crypt-CBC perl-Date-Calc perl-MIME-tools \
perl-Convert-BinHex perl-IO-stringy perl-MailTools perl-TimeDate rpm-build
# wget http://easynews.dl.sourceforge.net/sourceforge/cpan2rpm/cpan2rpm-2.027-1.noarch.rpm
# rpm -Uvh cpan2rpm-2.028-1.noarch.rpm
# cpan
cpan> reload index
# cpan2rpm -i Term::ReadPassword
# cpan2rpm -i Crypt::PasswdMD5
开始安装一些rpm包
# rpm --import ftp://ultra.linux.cz/pub/fedora/4/i386/os/RPM-GPG-KEY
# yum install \
bison bzip2-devel cyrus-sasl cyrus-sasl-plain \
expect fam-devel flex freetype-devel \
gcc gcc-c++ gdbm-devel httpd httpd-devel \
iptables libc-client-devel libjpeg-devel \
libmcrypt libmcrypt-devel libpng-devel libtool \
libxslt-devel make mod_ssl \
mysql mysql-devel mysql-server \
ncurses-devel net-snmp-devel \
openssl openssl-devel openssl-perl \
pam-devel php php-imap \
php-mysql php-pgsql php-snmp \
pkgconfig postgresql-devel zlib-devel \
libtool-ltdl php-gd libtool-libs libtool-ltdl-devel php-mcrypt
# yum update
开始安装proftpd
下载 proftpd-1.2.10.tar.bz2
# tar -xjf proftpd-1.2.10.tar.bz2
# cd proftpd-1.2.10
需要修改proftpd代码,否则编译错误
修改文件 contrib/mod_quotatab_sql.c
tab->tab_data = pcalloc(tab->tab_pool, sizeof(char));
((char *) tab->tab_data) = pstrdup(tab->tab_pool, select_query);
改为:
tab->tab_data = (void *) pstrdup(tab->tab_pool, select_query);
# ./configure --with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql \
--with-includes=/usr/include/mysql --with-libraries=/usr/lib/mysql \
--sysconfdir=/etc --localstatedir=/var
# make
# make install
# service iptables stop
安装 PostFix
# wget http://ftp.wl0.org/official/2.2/SRPMS/postfix-2.2.5-1.src.rpm
# rpm -ivh postfix-2.2.5-1.src.rpm
# cd /usr/src/redhat/SOURCES
# chmod +x make-postfix.spec
# POSTFIX_TLS=1 POSTFIX_VDA=1 POSTFIX_SASL=2 ./make-postfix.spec
# cd ../SPECS/
# perl -pi -e "s#%define with_alt_prio 30#%define with_alt_prio 100#" postfix.spec
# rpmbuild -bb postfix.spec
# rpm -Uvh /usr/src/redhat/RPMS/i386/postfix-*.i386.rpm
安装 Courier
先建立一个普通用户
# useradd tino
# su tino
# wget http://unc.dl.sourceforge.net/courier/courier-0.51.0.tar.bz2
# wget http://unc.dl.sourceforge.net/courier/courier-authlib-0.57.tar.bz2
# mkdir $HOME/rpm $HOME/rpm/SOURCES $HOME/rpm/SPECS $HOME/rpm/BUILD \
$HOME/rpm/SRPMS $HOME/rpm/RPMS $HOME/rpm/RPMS/i386
# echo "%_topdir $HOME/rpm" >> $HOME/.rpmmacros
# rpmbuild -ta courier-authlib-0.57.tar.bz2
# su
# rpm -Uvh rpm/RPMS/i386/courier-authlib-0.57-1.i386.rpm
# rpm -Uvh rpm/RPMS/i386/courier-authlib-userdb-0.57-1.i386.rpm
# rpm -Uvh rpm/RPMS/i386/courier-authlib-devel-0.57-1.i386.rpm
# exit
# mv courier-0.51.0.tar.bz2 rpm/SOURCES/
# tar -xvjf rpm/SOURCES/courier-0.51.0.tar.bz2 *courier.spec
# perl -pi -e "s#_unpackaged_files_terminate_build 1#_unpackaged_files_terminate_build 0#" courier-0.51.0/courier.spec
# mv courier-0.51.0/courier.spec rpm/SPECS
# rmdir courier-0.51.0
# rpmbuild -bb --without fax --without ldap rpm/SPECS/courier.spec
# cd $HOME/rpm/RPMS/i386
# su
# rpm -Uvh courier-0*.rpm courier-imapd-0*.rpm courier-pop3d-0*.rpm
# exit
如果是编译好的,那么先 rpm -Uvh courier-authlib-*.rpm;
After installing Courier RPMs, make sure Postfix is still considered the "active" MTA:
# /usr/sbin/alternatives --config mta
# vi /etc/postfix/main.cf
增加 myhostname = 您的机器名字
# vi /etc/httpd/conf/httpd.conf
ServerName srv180.capno.com:80
# useradd courier
# mkdir /var/run/courier && chown courier:courier /var/run/courier
开始 Configure & Start Services
# chkconfig --add courier
# service courier start
# chkconfig --add courier-authlib
# service courier-authlib start
# chkconfig postfix on
# service postfix start
# /usr/local/sbin/proftpd
# service mysqld start
# service httpd start
# service named start
# /bin/sh /usr/share/doc/postfix-2.2.5-documentation/examples/chroot-setup/LINUX2
# mysql
mysql> create database vhcs2;use mysql;
mysql> update user set password=password('DB_PASSWORD') where User='root';
mysql> flush privileges;
开始安装 VHCS2
# tar -xjpvf vhcs-x.x.x.tar.bz2
# cd vhcs-x.x.x
Edit configs/vhcs2.conf before install (only differences are shown)
SERVER_HOSTNAME = ****
BASE_SERVER_IP = X.X.X.X
MR_LOCK_FILE = /var/run/vhcs2.lock
DATABASE_NAME = vhcs2
DATABASE_PASSWORD = ****
BIND_CONF_FILE = /etc/named.conf
BIND_DB_DIR = /var/named/chroot/var/named
APACHE_CMD = /etc/init.d/httpd
APACHE_NAME = httpd
APACHE_LOG_DIR = /var/log/httpd
APACHE_USERS_LOG_DIR = /var/log/httpd/users
APACHE_BACKUP_LOG_DIR = /var/log/httpd/backup
APACHE_CONF_FILE = /etc/httpd/conf.d/vhcs2.conf
APACHE_USER = apache
APACHE_GROUP = apache
AUTHLIB_CONF_DIR = /etc/courier
CMD_NAMED = /etc/init.d/named
CMD_HTTPD = /usr/sbin/apachectl
CMD_AUTHD = /etc/init.d/courier-authlib
CMD_IMAP = /etc/init.d/courier
CMD_POP = /etc/init.d/courier
CMD_VHCS2D = /etc/init.d/vhcs2
MAIL_TRAFF_LOG = maillog
编辑完保存
# sed -i "s#/usr/lib/postfix#/usr/libexec/postfix#g" configs/postfix/main.cf
# sed -i "s#nogroup#nobody#g" configs/proftpd/proftpd.conf
# make install
# mkdir -p /var/named/chroot/var/named
# chown -R named:named /var/named/chroot
# cp --reply=yes -R /tmp/vhcs-2.4.7/* /
# cp -pR /tmp/vhcs-2.4.7/var/mail/* /var/mail/
# cp -pR /tmp/vhcs-2.4.7/etc/init.d/vhcs2_* /etc/init.d
# rmdir /etc/courier/userdb
# touch /etc/courier/userdb
# chmod 600 /etc/courier/userdb
# cp -p /etc/courier/userdb /etc/authlib/userdb
# makeuserdb
修改 /var/www/vhcs2/engine/vhcs2_common_code.pl 1443行 还有一行
'keysize'=>32,
# cd /var/www/vhcs2/engine/setup/
# ./vhcs2-setup
按照提示输入结束
# sed -i "s/nogroup/nobody/" /etc/proftpd.conf
# chmod u+w -R /var/www/vhcs2/gui/tools/webmail/
# cd /etc/vhcs2/bind/parts/
# cp -p cfg_entry.tpl cfg_entry.tpl.bak
# vi cfg_entry.tpl
Original line:
file "{DB_DIR}/{DMN_NAME}.db";
Replacement line:
file "{DMN_NAME}.db";
# sed -i "s/0700/0755/" /var/www/vhcs2/engine/vhcs2-*
编辑文件 /etc/vhcs2/vhcs2.conf
AUTHLIB_CONF_DIR = /etc/authlib
这个应该最后改的 ETC_SASLDB_FILE = /var/spool/postfix/etc/sasldb2
# touch /etc/sasldb2
(test with /usr/sbin/sasldblistusers2)
# vi /etc/init.d/vhcs2
内容如下
#!/bin/sh
#
# vhcs2 Start or stop the vhcs2 daemon
#
# chkconfig: - 95 5
# processname: vhcs2
# description: Start or stop the vhcs2 daemon
#
name=vhcs2
lockfile=/var/lock/subsys/vhcs2
pidfile=/var/run/vhcs2.pid
progname=/var/www/vhcs2/daemon/vhcs2_daemon
. /etc/rc.d/init.d/functions
start() {
echo -n Starting $name:
daemon $progname -p $pidfile
RETVAL=$?
if [ "$RETVAL" = "0" ]; then
touch $lockfile >/dev/null 2>&1
fi
echo
}
stop() {
echo -n Stopping $name:
killproc $progname
RETVAL=$?
if [ "$RETVAL" = "0" ]; then
rm -f $lockfile
fi
echo
}
status() {
if [ -s $pidfile ]; then
pid=`cat $pidfile`
kill -0 $pid >/dev/null 2>&1
if [ "$?" = "0" ]; then
echo "$name (pid $pid) is running"
RETVAL=0
else
echo "$name is stopped"
RETVAL=1
fi
else
echo "$name is stopped"
RETVAL=1
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status rhnsd
RETVAL=$?
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
;;
esac
exit $RETVAL
# chmod +x /etc/init.d/vhcs2
# chkconfig --add vhcs2
# service vhcs2 start
# vi /etc/httpd/conf/httpd.conf
注释掉 AddDefaultCharset UTF-8
# service httpd restart
安装完成
http://your_server_ip/vhcs2/
#################################################################################33
以前是修改webmail登录不了的问题
http://vhcs.net/new/modules/newbb/viewtopic.php?viewmode=flat&topic_id=6097&forum=2
To make webmail work on a FC5 system with PHP 5.1.6-1.1 required 3 actions.
Patch webmail's lib.php - fixes immediate autologout
Patch webmail's inc.php - fixes newline header error see patch: http://vhcs.net/new/modules/mantis/bug_view_page.php?bug_id=0000379
both files to be patched are in /var/www/vhcs2/gui/tools/webmail/inc
Change php.ini setting: allow_call_time_pass_reference
Fixes log spam ie: PHP Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of get_reseller_prop().
; allow_call_time_pass_reference = Off
; On for vhcs webmail
allow_call_time_pass_reference = On
[root@foo inc]# pwd
/var/www/vhcs2/gui/tools/webmail/inc
[root@foo inc]# diff inc.php inc.php~
153,159c153,155
< //Header("Expires: Wed, 11 Nov 1998 11:11:11 GMT
".
< //"Cache-Control: no-cache
".
< //"Cache-Control: must-revalidate");
<
< Header("Expires: Wed, 11 Nov 1998 11:11:11 GMT");
< Header("Cache-Control: no-cache");
< Header("Cache-Control: must-revalidate");
---
> Header("Expires: Wed, 11 Nov 1998 11:11:11 GMT
".
> "Cache-Control: no-cache
".
> "Cache-Control: must-revalidate");
[root@foo inc]# diff lib.php lib.php~
83,85c83
< if($phpver <= 5.0) {
< $ENV_SESSION = $_SESSION;
< }
---
> $ENV_SESSION = $_SESSION;
如果发送邮件失败,要查看日志 /var/log/maillog
webmail端发送邮件失败:
检查 vi /etc/postfix/main.cf 看 alias_database = hash:/etc/postfix/vhcs2/aliases
客户端发送邮件失败:
check the following:
the content of /usr/lib/sasl2/smtpd.conf
should look like this (replace saslauthd with auxprop)
pwcheck_method: auxprop
mech_list: plain login
and check that /etc/sasldb2 is readable by postfix (chown postfix:mail /etc/sasldb2)
2008-06-17 11:50:13
我现在的VHCS遇到一个问题 发送本地设置的多个虚拟域可以正常 但是发送外面 比如象 163.com 还有其他的就不行 是怎么回事 MAIL。CF 是按照VHCS默认安装出来的
2008-07-04 01:09:13
Paris-Hilton.wikidot.com
2008-07-04 01:09:18
Paris-Hilton.wikidot.com