VHCS install @ CentOS 4.2

作者: csbde 分类: Server 发布时间: 2007-12-11 04:16

空闲的时间安装VHCS,这个是用来做虚拟主机管理的,和CPANEL相比,VHCS是开源的,阿建用得着。 根据VHCS的安装文档重写如下,以方便安装 1. 安装OS choose "server" option during install firewall: open ssh/http/https/ftp/smtp ports selinux: disable (warn still generates errors in VHCS) select minimum install 安装类型选“自定义” 手动分区(4G虚拟硬盘) / ext3 2000M  swap 2*mem /var ext3 剩余空间(用户数据在此分区上) eth0 关闭DHCP,10.10.10.180/255.255.255.0 hostname: srv180.capno.com gateway: 10.10.10.1 dns: 202.106.0.20/202.106.196.115 Enable firewall,默认的四个服务全允许(SSH/HTTP,HTTPS/FTP/SMTP) SELinux: Disable 安装包选择:Minimal最小化安装(676M) 2. 基本配置 # useradd admin;passwd admin(以下操作凡未说明的都以root身份执行) 使用ssh客户端连接server # vi /etc/fstab LABEL=/var              /var                    ext3    defaults,usrquota        1 2 # touch /var/aquota.user;   chmod 600 /var/aquota.user;   mount -o remount /var;   quotacheck -avugm # server iptables stop; mv /etc/rc.d/rc3.d/S08iptables /etc/rc.d/rc3.d/K08iptables # vi /etc/grub.conf timeout=1 删除以下无用的软件包(iiimf-server,iiimf-csconv,iiimf-docs,iiimf-libs,xorg-x11-xfs并未安装) # yum remove apmd autofs bluez-utils cups irda-utils isdn4k-utils pcmcia-cs sendmail ypbind xinetd 上传需要的软件包VHCS至/home/admin/ 包含vhcs安装包,yum安装和升级包(节约yum升级时间),编译好的包(节约编译时间,第一次需要按官方文档自行编译) # cd /home/admin/VHCS/; cp -p yum_base/* /var/cache/yum/base/packages/; cp -p yum_update/* /var/cache/yum/update/packages/ # rpm --import http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt # vi /etc/yum.repos.d/CentOS-Base.repo的[base]和[update]项,设置为较快的镜象,如: baseurl=http://mirror.secuidc.com/centos/$releasever/os/$basearch/ baseurl=http://mirror.secuidc.com/centos/$releasever/update/$basearch/ # cat <<EOF > /etc/yum.repos.d/dag.repo [dag] name=Dag RPM Repository for Red Hat Enterprise Linux baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag gpgcheck=1 enabled=1 exclude=proftpd* EOF # 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 # yum install rpm-build bind # rpm -Uvh cpan2rpm-2.028-1.noarch.rpm # tar vxfz Crypt-PasswdMD5-1.3.tgz; cd Crypt-PasswdMD5-1.3; perl Makefile.PL; make; make install; cd .. # tar vxfz Term-ReadPassword-0.07.tgz; cd Term-ReadPassword-0.07; perl Makefile.PL; make; make install; cd .. # rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-4 # 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-gd php-mysql php-pgsql php-snmp pkgconfig postgresql-devel zlib-devel (删掉了mysql-admin这个包,不存在。) # ln -s /usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE/libperl.so /lib/ # rpm -Uvh proftpd-1.2.10-8_mysql.dag.i386.rpm; rpm -Uvh postfix-2.2.5-1.mysql.sasl2.vda.rhel4.i386.rpm; rpm -Uvh courier-authlib-*.rpm; rpm -Uvh courier-mysql-0*.rpm courier-0*.rpm courier-imapd-0*.rpm courier-pop3d-0*.rpm; rpm -Uvh php-mcrypt-4.3.9-3.1.1.i386.rpm # vi /etc/postfix/main.cf myhostname = srv180.capno.com # vi /etc/httpd/conf/httpd.conf ServerName srv180.capno.com:80 # chkconfig --add courier; service courier start; chkconfig proftpd on; service proftpd start; service mysqld start; service httpd start; service named start # mysql mysql> create database vhcs2;use mysql; mysql> update user set password=password('DB_PASSWORD') where User='root'; mysql> flush privileges; # cd /home/admin/VHCS/; tar -xjpvf vhcs2-2.4.7.1.tar.bz2; cd vhcs2-2.4.7.1/configs/vhcs2.conf SERVER_HOSTNAME = srv180 BASE_SERVER_IP = 10.10.10.180 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 MTA_SASLDB_FILE = /etc/sasldb2 CMD_NAMED = /etc/init.d/named CMD_HTTPD = /etc/init.d/httpd 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" /home/admin/VHCS/vhcs2-2.4.7.1/configs/postfix/main.cf # cd /home/admin/VHCS/vhcs2-2.4.7.1; make install # mkdir /var/named/chroot; mkdir /var/named/chroot/var; mkdir /var/named/chroot/var/named; chown -R named:named /var/named/chroot # cp --reply=yes -R /tmp/vhcs-2.4.7.1/* /; cp -pR /tmp/vhcs-2.4.7.1/var/mail/* /var/mail/; cp -pR /tmp/vhcs-2.4.7.1/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 # cd /var/www/vhcs2/engine/setup/ # ./vhcs2-setup hostname: srv180 system network address: 10.10.10.180 SQL server host: localhost SQL database: vhcs2 SQL user: root SQL password: ******* VHCS ftp SQL user: vftp admin name: admin admin password: ******* admin e-mail: [email protected] # 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-* # 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 confFile=/etc/vhcs2/vhcs2.conf pidFile=/var/log/vhcs2/vhcs2.pid daemon=/var/www/vhcs2/daemon/vhcs2_daemon name=vhcs2_daemon case "$1" in     'start')     $daemon >/dev/null 2>&1 </dev/null     RETVAL=$?     if [ "$RETVAL" = "0" ]; then         touch $lockfile >/dev/null 2>&1     fi ;; 'stop') pidfile=`grep "^pidfile=" $confFile | sed -e 's/pidfile=//g'` kill `cat $pidfile` RETVAL=$? if [ "$RETVAL" = "0" ]; then     rm -f $lockfile fi ;; 'status') pidfile=`grep "^pidfile=" $confFile | sed -e 's/pidfile=//g'` if [ "$pidfile" = "" ]; then     pidfile=$pidFile fi 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 ;; 'restart') $stop && $start RETVAL=$? ;; *) echo "Usage: $0 { start | stop | restart }" RETVAL=1 ;; esac exit $RETVAL # chmod +x /etc/init.d/vhcs2 # chkconfig --add vhcs2 # cd /etc/rc.d/rc3.d # mv S35courier K35courier; mv S13portmap K13portmap; mv S14nfslock K14nfslock; mv S18rpcidmapd K18rpcidmapd; mv S19rpcgssd K19rpcgssd; mv S25netfs K25netfs; mv S40smartd K40smartd; mv S44acpid K44acpid; mv S80proftpd K80proftpd; mv S85gpm K85gpm; mv S95anacron K95anacron; mv S95atd K95atd; mv S97messagebus K97messagebus; mv S98haldaemon K98haldaemon # service httpd stop; service mysqld stop; service proftpd stop; service courier stop; service named stop; # service named start; service courier start; service proftpd start; service mysqld start; service httpd start; service vhcs2 start 访问http://10.10.10.180/vhcs2 admin登录后修改默认语言 Genaral -> Muiltlanguage -> Chinese, Save 修改/etc/php.ini, defaultcharset = "gb2312", 重启httpd ]]>

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!

发表评论

电子邮件地址不会被公开。 必填项已用*标注