pico /etc/apt/sources.list (add the following sources)
Code:
deb ftp://ftp.jp.debian.org/debian/ stable main
deb-src ftp://ftp.jp.debian.org/debian/ stable main
deb http://security.debian.org/ stable/updates main
apt-get update
apt-get install ssh openssh-server
apt-get install postfix postfix-tls proftpd-mysql courier-authdaemon courier-base courier-imap courier-maildrop courier-pop libberkeleydb-perl libc-dev libcrypt-blowfish-perl libcrypt-cbc-perl libcrypt-passwdmd5-perl libdate-calc-perl libdate-manip-perl libdbd-mysql-perl libdbi-perl libio-stringy-perl libmail-sendmail-perl libmailtools-perl libmd5-perl libmime-base64-perl libmime-perl libnet-dns-perl libnet-netmask-perl libnet-perl libnet-smtp-server-perl libperl5.8 libsnmp-session-perl libterm-readkey-perl libtimedate-perl perl perl-base perl-modules bind9 diff gzip iptables libmcrypt4 mysql-client-4.1 mysql-common-4.1 mysql-server-4.1 patch php4 php4-mcrypt php4-mysql php4-pear php4-dev procmail libterm-readpassword-perl libsasl2-modules libsasl2 sasl2-bin apache2 apache2-mpm-prefork libapache2-mod-php4 gawk libgd1g bzip2 gcc rpm subversion wget make
** บรรทัดเดียว
mysql -u root
create database vhcs2;
use vhcs2;
grant all privileges on *.* to 'vhcs2'@'localhost' identified by 'vhcs2' with grant option;
\q (quit program)
1). wget http://ufpr.dl.sourceforge.net/sourceforge/vhcs/vhcs2.4.6.2.tar.bz2
or wget http://nchc.dl.sourceforge.net/sourceforge/vhcs/vhcs2.4.6.2.tar.bz2
or wget http://jaist.dl.sourceforge.net/sourceforge/vhcs/vhcs2.2.tar.bz2
or wget http://nchc.dl.sourceforge.net/sourceforge/vhcs/vhcs2-2.4.7.1.tar.bz2
2). แตกไฟล์ tar
#tar -xjvf vhcs2-2*
3). cd เข้าไปแก้ไขไฟล์ configs
#cd vhcs*/configs
#pico vhcs2.conf
BASE_SERVER_IP = 203.146.252.146
FTPD_CONF_FILE = /etc/proftd.conf/proftpd.conf
DATABASE_PASSWORD =
#pico proftpd/proftpd.conf
Include /etc/proftpd/modules.conf
SystemLog /var/log/proftpd/proftpd.log
SQLBackend mysql
#pico apache/httpd.conf
Alias /babe /var/www/virtual
<Directory /var/www/virtual>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
ErrorDocument 404 /vhcs2/errordocs/index.php
DirectoryIndex index.html index.php
RedirectMatch ^/babe/(.*) /~/$1/htdocs
</Directory>
Alias /webmail /var/www/vhcs2/gui/tools/webmail/
<Directory /var/www/vhcs2/gui/tools/webmail>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Alias /websql /var/www/vhcs2/gui/tools/pma/
<Directory /var/www/vhcs2/gui/tools/pma/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
4). ย้อนกลับไปที่ vhcs folder แล้วใช้คำสั่ง make install
#cd ..
#make install
5). จากนั้นไปที่ foder vhcs ที่อยู่ใน /tmp
#cd /tmp/vhcs-2*
6). ทำการ copy ไฟล์ vhcs ไปยัง var root และทำการติดตั้ง
#cp -R * /
#cd /var/www/vhcs2/engine/setup
#./vhcs2-setup
7). include ไฟล์ configs เข้า apache และปรับแต่ง folder ให้สมบูรณ์พร้อมใช้
#echo "Include /etc/apache2/sites-available/vhcs2.conf" >> /etc/apache2/httpd.conf
#ln -s /etc/init.d/vhcs2_daemon /etc/rc2.d/S98vhcs
#chmod -R 766 /var/www/vhcs2/gui/tools
8). ตรวจสอบค่าต่าง ๆ
#pico /etc/hosts
#pico /etc/hostsname
#pico /etc/resolv.conf
#pico /etc/apache2/sites-available/vhcs2.conf
#pico /etc/proftpd/proftpd.conf
-------ปรับตั้งค่า สำหรับใช้งาน FTP โดยใส่ คำสั่ง ทั้ง 3 แถว ไว้บนสุด
#pico /etc/proftpd/proftpd.conf
Include /etc/proftpd/modules.conf
SystemLog /var/log/proftpd/proftpd.log
SQLBackend mysql
-------ตั้งค่า Charset ของ Apache2
#pico /etc/apache2/conf.d/charset
AddDefaultCharset tis620
-------- ตั้งค่า Charset ของ Mysql
#pico /etc/mysql/my.cnf
เพิ่ม code เข้าไปตาม [client], [mysqld] และ [mysql]
[client]
default-character-set = tis620
[mysqld]
init_connect = 'SET collation_connection = tis620_thai_ci'
init_connect = 'SET NAMES tis620'
default-character-set = tis620
character-set-server = tis620
collation-server = tis620_thai_ci
[mysql]
default-character-set = tis620
*** สำหรับใช้กับ php code
mysql_query("SET NAMES 'tis620' ");
mysql_query("SELECT * FROM TEST");
mysql_query("SELECT * FROM TEST ORDER BY idRec COLLATE tis620_thai_ci");
---------- แก้ไข Webmail Error
ERROR (2): Header may not contain more than a single header, new line detected. (/var/www/vhcs2/gui/tools/webmail/inc/inc.php:155)
โดยค้นหา คำว่า Header แล้วจะเจอบรรทัดที่ 155
Header("Expires: Wed, 11 Nov 1998 11:11:11 GMT\r\n".
"Cache-Control: no-cache\r\n".
"Cache-Control: must-revalidate");
ให้เปลี่ยนเป็น
Header("Expires: Wed, 11 Nov 1998 11:11:11 GMT");
Header("Cache-Control: no-cache");
Header("Cache-Control: must-revalidate");
9). Restart Apache
#/etc/init.d/apache2 restart
หรือ reboot ระบบ เพื่อความชัวร์ก็เสร็จสิ้นกระบวนการ
---------------------------------------------------------------------------------
ปัญหาที่เจอ และแก้ไขได้
# Add User แล้ว ขึ้น Status เป็นสีแดง และไม่สามารถ login ได้
ให้ลองเข้าไปดูที่ folder /var/www/virtual ดูว่ามีการสร้าง folder สำหรับ domain ที่ add ไปหรือเปล่า
แก้ไข โดยลอง restart apache ด้วยคำสั่ง /etc/init.d/apache2 restart
# Add FTP Account แล้วนำไปใช้งานไม่ได้
ตรวจสอบ ไฟล์ /etc/proftpd/proftpd.conf ว่าเป็นของ VHCS หรือเปล่า และมีคำสั่ง Include Module หรือเปล่า
#pico proftpd/proftpd.conf
Include /etc/proftpd/modules.conf
SystemLog /var/log/proftpd/proftpd.log
SQLBackend mysql
#แก้ภาษาไทยบน Apache2
pico /etc/apache2/conf.d/charset
AddDefaultCharset tis620
#แก้ปัญหาการลง VHCS ซ้ำหรือ Key ซ้ำ
error : If specified by -literal_key, then the key length must be equal to the chosen cipher's key length of 56 bytes at /var/www/vhcs2/engine/setup/../vhcs2_common_code.pl line 1408
#pico /var/www/vhcs2/engine/vhcs2_common_code.pl
'keysize' => 32,
'key' => $main::db_pass_key,
*** จะมีอยู่ สองตำแหน่งให้ใช้ Ctrl+W เพื่อค้นหาคำว่า 'key'
#วิธีแก้ปัญหามี 2 อย่างคือ เขียนโปรแกรมเข้าไป INSERT user กับ db เอง
หรือใช้วิธีง่าย ๆ ดังต่อไปนี้ ..
# /usr/bin/mysqld_safe --skip-grant-tables&
จากนั้นเข้า MySQL ..
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 8005 to server version: 4.0.24_Debian-10-log
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
mysql> use mysql;
mysql> update user set password = password('new password') where user = 'root' and host='localhost';
mysql> update user set password = password('new password') where user = 'debian-sys-maint' and
host='localhost';
mysql> flush privileges;
จากนั้นแก้ไข /etc/mysql/debian.cnf ใส่ password ให้ตรงกับที่ใส่ตอนแรก (whatever)
# vi /etc/mysql/debian.cnf
จากนั้น Stop - Start MySQL ขึ้นมาใช้งานได้ตามปกติ
# /etc/init.d/mysql stop
# /etc/init.d/mysql start
============================================
PHP config Step
pico /etc/php4/apache2/php.ini
;disable error
;error_reporting = E_ALL & ~E_NOTICE
;change register_global to on
;error_reporting = E_ALL & ~E_NOTICE
register_global=on
disable_functions = system, exec, shell_exec, passthru, pcntl_exec, putenv, proc_close, proc_get_status, proc_nice, proc_open, proc_terminate, popen, pclose, set_time_limit, ini_alter, virtual, openlog, escapeshellcmd
===================================
กรณี Network หาย
#ifconfig eth0 <IP address> netmask <subnet mask>
#route add default gw <router's IP>
ไม่มีความเห็น