แสดงกระทู้

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - golfreeze

Pages: 1 ... 143 144 [145] 146
2161
ใช้ OS Debian 3.1
1.สั่งโหลด จาก mirror ในไทยครับ
โดยเพิ่มไปที่ /etc/apt/sources.list
แล้วสั่ง apt-get update แล้ว

#aptitude install snmpd
#aptitude install mrtg

แล้วมา config

#/etc/snmp/snmpd.conf

ให้เอา # ใส่หน้า คำสั่ง

com2sec paranoid default public

แล้วเอาเครื่องหมาย # ออกจากคำสั่ง

com2sec readonly default public

แล้วสั่ง daemon start

#/etc/init.d/snmpd restart

แล้วต่อไปมา config ไฟส์ mrtg บ้าง

แล้วพิมพ์ ตามนี้เพื่อทำการ สั่งให้สร้าง config


#cfgmaker --global 'options[_]: growright,bits' --global 'WorkDir: /home/golf/xxx' --output=/etc/mrtg.cfg public@127.0.0.1

การเพิ่มกราฟ นั้นไม่จำต้องลบไฟส์ในห้อง DocumentRoot ออกก็ได้น่ะครับแต่เพิ่มกราฟ establish กับ tcp
connection ดังนี้ในไฟส์ดังนี้ (ผมใช้เป็น OS Debian 3.1 ครับ)

#vi /etc/mrtg,cfg

โดยเพิ่ม

### Load Average ###
Target[cpu]: .1.3.6.1.4.1.2021.10.1.5.1&.1.3.6.1.4.1.2021.10.1.5.2: public@127.0.0.1
MaxBytes[cpu]: 100
Unscaled[cpu]: dwmy
Options[cpu]: gauge, absolute, growright, noinfo, nopercent
YLegend[cpu]: CPU Load(%)
ShortLegend[cpu]: (%)
LegendI[cpu]:   CPU System
LegendO[cpu]:   CPU User
Title[cpu]: CPU Analysis
PageTop[cpu]: <H1>CPU Analysis</H1>

### Memory Free ###
Target[mem]: .1.3.6.1.4.1.2021.4.6.0&.1.3.6.1.4.1.2021.4.4.0: public@127.0.0.1
MaxBytes1[mem]: 1030288
MaxBytes2[mem]: 1052216
Unscaled[mem]: dwmy
Options[mem]: gauge, absolute, growright, noinfo
YLegend[mem]: Memory Free
ShortLegend[mem]: Bytes
kilo[mem]: 1024
kMG[mem]: k,M,G,T,P
LegendI[mem]: Real
LegendO[mem]: Swap
Legend1[mem]: (MBytes)
Legend2[mem]: (MBytes)
Title[mem]: Memory Analysis
PageTop[mem]: <H1>Memory Analysis</H1>

### New TCP Connection Monitoring (per minute) ###
Target[server.newconns]: tcpPassiveOpens.0&tcpActiveOpens.0: public@127.0.0.1
Title[server.newconns]: Newly Created TCP Connections
PageTop[server.newconns]: <H1>New TCP Connections</H1>
MaxBytes[server.newconns]: 10000000000
ShortLegend[server.newconns]: c/s
YLegend[server.newconns]: Conns / Min
LegendI[server.newconns]: In
LegendO[server.newconns]: Out
Legend1[server.newconns]: New inbound connections
Legend2[server.newconns]: New outbound connections
Options[server.newconns]: growright,nopercent,perminute

### Established TCP Connections ###
Target[server.estabcons]: tcpCurrEstab.0&tcpCurrEstab.0: public@127.0.0.1
Title[server.estabcons]: Currently Established TCP Connections
PageTop[server.estabcons]: <H1>Established TCP Connections</H1>
MaxBytes[server.estabcons]: 10000000000
ShortLegend[server.estabcons]:
YLegend[server.estabcons]: Connections
LegendI[server.estabcons]: In
LegendO[server.estabcons]:
Legend1[server.estabcons]: Established connections
Legend2[server.estabcons]:
Options[server.estabcons]: growright,nopercent,gauge

และสุดท้ายก็สั่ง คำสั่งข้างล่างนี้เพื่อให้แสดง output ออกมาที่ไฟส์ไหนถ้ารูปไม่ออกอาจเกิดจากการระบุ
output ผิดครับ

#indexmaker /etc/mrtg.cfg --columns=1 --output /home/golf/xxx/index.html

แล้วสั่ง mrtg 3 ครั้งสำหรับ Debian ครับ

#mrtg
#mrtg
#mrtg

แต่ถ้าเป็น ubuntu 6.06ให้สั่ง

#env LANG=C /usr/bin/mrtg /etc/mrtg.cfg
#env LANG=C /usr/bin/mrtg /etc/mrtg.cfg
#env LANG=C /usr/bin/mrtg /etc/mrtg.cfg

3 ครั้งน่ะครับ

จะได้กราฟตามนี้ครับที่ ===> http://www.saiyaithai.org/mrtg

2162
สำหรับ hard link ที่ใช้กัน ส่วนใหญ่ จะเป็น

เป็นการสร้างเพื่อ ชี้มาที่ inode เดียวกัน

ไฟล์ A---->inode 0001
สร้างhard link ไปที่ไฟล์ B และ ไฟล์ C ชี้ไปที่ ไฟล์ A ซึ่งมี inode = 0001
ไฟล์ B ก็ชี้ไปที่ inode 0001
ไฟล์ C ก็ชี้ไปที่ inode 0001

ดังนั้น
-ถ้าเราทำการแก้ไข ไฟล์ต้นฉบับ (A) ไปก็จะส่งผลกระทบต่อไฟล์ที่เชื่อมโยง (B) และ (C) ด้วย เพราะมี inode
เดียวกัน
-ถ้าเราทำการลบ ไฟล์ A ไป ไฟล์ C ก็ยังเข้าได้ผ่านไฟล์ B ได้ เพราะชี้ไปที่ inode เดียวกัน
-แต่ถ้าเราลบไฟล์ B ไปอีก ไฟล์ C จะเข้าไม่ได้ เพราะมันไม่ไฟล์ให้เข้าถึงอีก

แต่ข้อเสีย ของ hard link คือใช้งานกับ directory ไม่ได้ หรือข้าม partition ไม่ได้
เหมาะกับการเอาไปเป็นข้อมูล backup
ที่เป็นไฟล์สำคัญๆและป้องกันข้อมูลสูญหายมากกว่า
----------------------------------------------------------------------------------------------

Soft link (symlink) เหมือนการทำ short cut ซึ่งจะทำการสร้าง inode ออกมาจาก ตัว inode หลักนั้นๆ

เมื่อมีการสร้างไฟล์ A และสร้าง soft link ไฟล์ B และ C
ก็จะทำการสร้าง inode ของไฟล์นั้นเข้ามาใหม่ ทำให้ inode ไม่ซ้ำกับไฟล์ต้นฉบับ

ซึ่งถ้า มีไฟล์ symlink_file อยู่ต้องการสร้าง soft link ไปที่ไฟล์หลัก
soource_file จะทำได้โดย
#ln -s source_file symlink_file
ถ้าเราทำการลบไฟล์ source_file ไปก็จะทำให้เข้าไปใช้งานไฟล์ symlink_file ไม่ได้
เพราะว่า inode หลักที่อ้างถูกลบไปแล้ว

แต่ข้อดีของ soft link คือสามารถทำผ่าน partition ได้ครับ

ถ้ามีปัญหาสงสัย ก็โฟสไว้ได้น่ะครับ
golfreeze[at]packetlove.com

2163
ฟอร์แมตแรกที่จะแนะนำก็คือ gzip ย่อมาจาก GNU zip คำสั่งก็ตรงไปตรงมาครับ ก็คือ

gzip filename.txt

หลังจากกด enter ไปไฟล์ filename.txt ของเราจะหายไป แล้วกลายร่างเป็น filename.txt.gz เสียแล้ว
แต่ใครยังอยากเก็บไฟล์ต้นฉบับไว้อยู่ก็ให้ใส่ -c เข้าไปซึ่งเป็นการบอกให้ gzip แสดงเข้ามาออกทาง
standard output จากนั้นเราก็ทำการเปลี่ยนทิศทางไปยังไฟล์ที่เราต้องการ

gzip -c filename.txt > filename.txt.gz

ผลลัพธ์ที่ได้ก็จะเหมือนกับคำสั่งแรกต่างกันที่ต้นฉบับเรายังอยู่ ไม่ไปไหน
และถ้าเราอยากให้ไฟล์ที่ได้บีบกันแบบสุดๆ ก็ให้ใส่ -9 แต่ถ้าอยากได้ความเร็วก็ใส่ -1
จริงแล้วเราสามารถใช้ค่าได้ตั้งแต่ -1 ถึง -9 อย่างเช่น

gzip -9 filename.txt

แต่ถ้าใครอยากใช้ -9 ตลอดแต่ไม่อยากพิมพ์ทุกครั้งก็ให้เซ็น environment variable ดังนี้

export GZIP="-9"

อะพอเราบีบเสร็จ ก็ต้องทำการแตกไฟล์ ก็ทำโดย

gunzip filename.txt.gz

และเหมือนเดิมไฟล์ .gz จะหายไป ถ้าไม่อยากให้หายก็ต้องทำอย่างนี้

gzip -c filename.txt.gz > filename.txt

เป็นยังไงสำหรับฟอร์แมตแรก ใช้ไม่อยากเลย อะฟอร์แมตที่สองที่จะแนะนำก็คงเป็น bzip2 นั่นเอง
ซึ่งอันนี้มาทีหลัง gzip แต่บีบได้เล็กกว่า รูปแบบคำสั่งก็จะคล้ายกัน ดังนี้

bzip2 filename.txt

เราก็จะได้ filename.txt.bz2 มา แต่ไฟล์ต้นฉบับก็จะหายไป
ถ้าไม่อยากให้หายไม่ต้องทำการเปลี่ยนทิศทางให้เมื่อยเหมือน gzip เพราะมี option -k มาให้ k ย่อมาจาก
keep ก็ใช้ง่ายๆ ดังนี้

bzip2 -k filename.txt

และเหมือนกันกับ gzip ซึ่งมีระดับการบีบอัด ตั้งแต่ 1 ถึง 9 ซึ่ง 1 จะใช้เวลาน้อยที่สุด ส่วน 9
จะบีบอัดได้สูงสุด

bzip2 -9 filename.txt

ไหนๆ ก็เหมือนกันมาเยอะแล้ว ก็ต้องกำหนดค่า default ได้โดย

export BZIP2="-9"

และถ้าเราอยากแตกไฟล์ออกก็ใช้คำสั่ง

bunzip2 filename.txt.bz2

ซึ่งไฟล์ .bz2 ก็จะหายไป ถ้าไม่อยากให้หายก็ใส่ -k ไปด้วยน้า

มาถึงคำสั่งสำคัญอีกคำสั่ง คือ คำสั่ง tar คำสั่งนี้ไม่ได้มีการบีบอัดใดๆ แต่จะเป็นการรวมไฟล์หลายๆ
ไฟล์ไว้เป็นไฟล์เดียวกัน รูปแบบคำสั่งก็จะเป็นดังนี้

tar -cvf test.tar filename.txt mydir

คำสั่งขั้นบนจะเป็นการนำไฟล์ filename และไดเร็กทอรี่ mydir มา tar แล้วเก็บไว้ในชื่อไฟล์ text.tar โดย
option c หมายถึงเป็นการสร้างไฟล์ tar -v เป็นการแสดงรายละเอียดขณะทำงาน และ -f
หมายถึงระบุชื่อไฟล์ที่เราต้องซึ่งก็คือ test.tar

อะและถ้าเราต้องการ extract ไฟล์ก็ทำได้โดย

tar -xvf test.tar

ซึ่ง -x หมายถึงการ extract นั่นเอง ขั้นตอนต่อไปจะเป็นการรวมพลังกันระหว่างการบีบอัดและการ tar
ถ้าเราต้องการรวมพลัง tar กับ gzip ก็ใช้คำสั่ง

tar -cvzf test.tar.gz filename.txt mydir

ซึ่งเราจะ tar ไฟล์ filename.txt และไดเร็กทอรี่ก่อน แล้วจึงทำการบีบอัดด้วย gzip แต่ถ้าใครชอบ bzip2
ก็ให้ใช้คำสั่

tar -cvjf test.tar.bz2 filename.txt mydir

จะเห็นว่าถ้าเป็น gzip เราจะใช้ option -z แต่ถ้าเป็น bzip2 จะเป็น -j อะดังนั้นถ้าเราต้องการ extract
ก็ให้ใช้คำสั่ง สำหรับ gzip

tar -xvzf test.tar.gz

และ bzip2 ก็จะเป็น

tar -xvjf test.tar.gz

เรียบร้อยครับ เป็นยังไงใช้กันไม่อยากครับ ตรงไปตรงมา ไปและ



Special Thank = http://www.logicdream.com

2164
มีปัญหาสั่งรัน crontab ไม่ได้

ให้เช๊คที่ ไฟล์

/etc/security/access.conf
comment ปิดที่ -:ALL EXCEPT root:LOCAL

ให้ comment เปิดที่ + : ALL : cron crond

แล้วลองสั่งรัน ใหม่ดูน่ะครับ

เพราะว่า มันกันไม่ให้ใครรัน crontab แม้จะเป็น root ก็ตาม

2165
string meaning
------ -------
@reboot Run once, at startup.
@yearly Run once a year, "0 0 1 1 *".
@annually (sames as @yearly)
@monthly Run once a month, "0 0 1 * *".
@weekly Run once a week, "0 0 * * 0".
@daily Run once a day, "0 0 * * *".
@midnight (same as @daily)
@hourly Run once an hour, "0 * * * *".

EXAMPLE CRON FILE

# use /bin/sh to run commands, overriding the default set by cron
SHELL=/bin/sh
#
# mail any output to `paul', no matter whose crontab this is
MAILTO=paul
#
# run five minutes after midnight, every day
5 0 * * * $HOME/bin/daily.job >> $HOME/tmp/out 2>&1
#
# run at 2:15pm on the first of every month -- output mailed to paul
15 14 1 * * $HOME/bin/monthly
#
# run at 10 pm on weekdays, annoy Joe
0 22 * * 1-5 mail -s "It's 10pm" joe%Joe,%%Where are your kids?%
23 0-23/2 * * * echo "run 23 minutes after midn, 2am, 4am ..., everyday"
5 4 * * sun echo "run at 5 after 4 every sunday"

2166
ปกติเราสามารถตั้งค่า MAILTO ใน crontab

เพื่อที่จะ ส่ง email ไปยังผู้ดูแลระบบได้ เมื่อรันคำสั่ง crontab

โดยแก้ที่

vi /etc/crontab

แก้ที่ MAILTO=root
เป็น
MAILTO=golfreeze[at]packetlove.com

ได้ครับ

เท่านี้ คำสั่ง crontab ที่รันก็ส่ง output ไปยัง email คนนั้นแล้วครับ

2167
สำหรับวิธีการให้ส่งเมล ไปถึง user ผู้รันคำสั่งนั้นๆ วิธีการคือ

ก็ไม่ต้องใส่คำสั่ง นี้ น่ะครับ
>/dev/null 2>&1

แต่ถ้าจะ disable email ก็ให้ใส่ คำสั่งนี้ ไปด้วยท้าย คำสั่ง crontab เช่น

*/5 * * * * root mrtg /etc/mrtg.cfg >/dev/null 2>&1
ครับ

2168
Examples for the Hour column:
8 = one value: execute in the 8 AM hour
5,6,9 = multiple values: execute in the 5, 6, and 9 AM hours
5-8 = range: execute in each hour between 5-8 AM (inclusive)
*/2 = fractional: execute in every other hour. 0 (midnight), 2AM, 4AM, 6AM, etc
3-12/3 = fractional range: execute in every third hour between 3AM and 12PM: 3AM, 6AM, 9AM, 12PM

Example:
5 */3 * * 1-5 cd "desktop/fold1"; ./fold &
This will launch on the 5-minute mark, every third hour, every day, every month, but only on days of
the work week (Mon-Fri). It cd's to the Desktop/Folding folder #1, then launches the launch
script in nohup mode so folding will keep running.

Example:
20,50 * * Jan-May,7-12 Mon-Fri cd "desktop/fold4"; ./foldlaunchscript
This will launch on the 20 and 50-minute marks, every hour, every day, every month except June (IT
desktop-inspection month), but only on days of the work week (Mon-Fri). It cd's to the
Desktop/Folding folder #4 on your Quad-CPU PowerMac, then launches the launch script which checks
for already-running instances of Folding before trying to launch another copy.

Example:
@reboot cd "/usr/local/mysql"; ./bin/safe_mysqld &
This will launch on each reboot. It cd's to the proper mysql root folder, then launches mysql
with the safe startup script in nohup mode.

Example:
12 * * * * cd "desktop/fold2"; ./foldlaunchscript
This will launch on the 12-minute mark, every hour, every day, every month, every day of the week.
It cd's to the Desktop/Folding folder #2, then launches the launch script which checks for
already-running instances of Folding before trying to launch another copy.

Example:
1 10 13 * 5 ./hiddenfolder/jokescript
This will launch at 10:01 AM, on any Friday the 13th. It launches your virus script.

Example:
14 2 29 8 5 ./skynet
This will launch at 2:14 AM, on August 29 if it is a Friday. It ends the world.

A special prefix (@AppleNotOnBattery ) can be added to the command line to only execute if the
laptop is running on external power - desktops are always plugged in when running, so a desktop will
always execute the command. This is an Apple extension, so it only works on Darwin (OSX) systems,
not Linux, BSD, or UNIX. I would expect it to work on x86 Darwin, but have no x86 laptop to test it
with. Using this command prefix on something that does not support it (like RedHat on a P4) will
cause an error.

Example:
45 23 * * * @AppleNotOnBattery ./Applications/Utilities/diskoptimizerscript
This will launch at 11:45 PM each day. It launches a disk optimizer, but only if your laptop is
plugged in to a power source.

2169
ปกติแล้ว เราสามารถตั้ง crontab ในลักษณะ นี้ ได้นะครับผม

@reboot = run at boot and reboot only
@yearly = run at midnight Jan 1 each year (equiv to 0 0 1 1 *)
@annually = run at midnight Jan 1 each year (equiv to 0 0 1 1 *)
@monthly = run at midnight on the first day of each month (equiv to 0 0 1 * *)
@weekly = run at midnight each Sunday (equiv to 0 0 * * 0)
@daily = run at midnight each day (equiv to 0 0 * * *)
@midnight = run at midnight each day (equiv to 0 0 * * *)
@hourly = run on the first second of every hour (equiv to 0 * * * *)
- or -
1 2 3 4 5 = specific time tags
- where -
1 = Minute (of hour) to activate [0-59]
2 = Hour (of day) to activate [0-23]
3 = Day (of month) to activate [1-31 ... 29,30,31 may not activate during all months]
4 = Month (of year) to activate [1-12 or 3-letter names "Jan,Feb,Mar"]
5 = Weekday to activate [0-6 or 3-letter names "Mon,Tue,Wed"]  (0=Sunday)

2170
http://www.webhostingtalk.com/showthread.php?p=5070700

แก้ bug

แก้ bug เรื่อง filemanager

Edit files:
/etc/vhcs2/apache/parts/als_entry.tpl
/etc/vhcs2/apache/parts/als_php2_entry.tpl
/etc/vhcs2/apache/parts/dmn_entry.tpl
/etc/vhcs2/apache/parts/dmn_php2_entry.tpl
/etc/vhcs2/apache/parts/sub_entry.tpl
/etc/vhcs2/apache/parts/sub_php2_entry.tpl

แล้วแก้ไขไฟล์ โดยลบ / หลัง /tmp/ ออกครับให้เหลือแค่

/tmp ในไฟล์เหล่านี้

เช่น
php_admin_value open_basedir "{GUI_ROOT_DIR}/:/etc/vhcs2/:/proc/:{WWW_DIR}/:/tmp/"
แก้เป็น
php_admin_value open_basedir "{GUI_ROOT_DIR}/:/etc/vhcs2/:/proc/:{WWW_DIR}/:/tmp"

ถ้าทำเสร็จหมดแล้วทำการ อัฟเดท vhcs2.conf ใหม่ดังนี้ ครับ

/etc/init.d/vhcs2_daemon stop
mysql -u root -p<password>
USE vhcs2
UPDATE `domain` SET `domain_status` = 'change' WHERE `domain_status` = 'ok';
UPDATE `domain_aliasses` SET `alias_status` = 'change' WHERE `alias_status` = 'ok';
UPDATE `subdomain` SET `subdomain_status` = 'change' WHERE `subdomain_status` = 'ok';
quit
/var/www/vhcs2/engine/vhcs2-rqst-mngr
/etc/init.d/vhcs2_daemon start

มีปัญหาก็สอบถามไว้ได้ น่ะครับ

##ปรับ timezone ของ debian ให้เป็นเวลา malaysia

cp /usr/share/zoneinfo/Asia/Kuala_Lumpur /etc/localtime

2171
แก้ไข ไฟล์ /etc/php5/cli/php.ini
แล้วแก้ไข ไฟล์

vi /etc/apache2/sites-enabled/vhcs2.conf
จาก
php_admin_value open_basedir
'/var/www/vhcs2/gui/tools/filemanager/:/tmp/:/usr/share/php/'
เปลี่ยนเป็น
php_admin_value open_basedir
'/var/www/vhcs2/gui/tools/filemanager/:/tmp:/usr/share/php/'

2172
แก้ ให้ ftp ได้ดังนี้

Step 1: Backups

nano /etc/proftpd.conf
the do a ^X (Ctrl + X) and save it as /etc/proftpd2.conf

Step 2: Delete BS Config

nano /etc/proftpd.conf
Remove everything above the "#VHCS2 Management;" Line.
Save the Doc and Exit (Ctrl + O, Ctrl + M, Ctrl + X).

Step 3: Include the VHCS FTP File

nano /etc/proftpd/proftpd.conf
Find the line
#<IfModule mod_sql.c>
# SQLBackend mysql
#</IfModule>

And make it look like this
<IfModule mod_sql.c>
SQLBackend mysql
Include /etc/proftpd.conf
</IfModule>
Save and exit the document.

Step 4: Disable PostgresSQL Module

nano /etc/proftpd/modules.conf
Comment out the following line
LoadModule mod_sql_postgres.c
Save and Exit

Step 5: Restart ProFTP
/etc/init.d/proftpd restart
You may also want to reboot your machine, but thats
completely optional. However that is all that needs to be
done.

2173
วันนี้ลองใช้งาน mail Client ใน VHCS ดูครับซึ่งเป็นตัวของ UebiMiau ที่ลงมากับตัว VHCS พอลองสร้าง
account ดูก็ไม่มีปัญหาอะไรแต่พอ login เข้าใช้งานก็เจอ message นี้ครับ
ERROR (2): Header may not contain more than a single header, new line detected.
(/var/www/vhcs2/gui/tools/webmail/inc/inc.php:155)
พอลอง search ใน google ดูก็พอเจอ แนวๆว่าให้เข้าไปแก้ไฟส์ inc.php นั้นซะซึ่งโหลดมาแก้ดังนี้คือ จาก
บันทัดที่ 155
Change :

Header("Expires: Wed, 11 Nov 1998 11:11:11 GMTrn".
"Cache-Control: no-cachern".
"Cache-Control: must-revalidate");
to

Header("Expires: Wed, 11 Nov 1998 11:11:11 GMT");
Header("Cache-Control: no-cache");
Header("Cache-Control: must-revalidate");
Save, and exit. แล้ว copy ไปไว้ที่เดิมคราวนี้ก็ลอง refresh ดูแล้ว login เข้าใช้งาน mail client
ก็สามารถใช้งานได้ปกติครับ อิอิเมลล์ใหม่คือ golfreeze@packetlove.com ครับ

2174
วันนี้ พอดีมีเครื่อง R200 มาให้เล่นก็เลย ลองลงเป็น debian 4.0 R3 64 bit
กับ vhcs2 ครับ

ลองมาดูขั้นตอนกันเด้อ ซู

ก่อนอื่นลง OS ตั้ง ip เสร็จ ก็มาแก้ไข sources.list ให้โหลด package ในไทยตามนี้เด้อ

#vi /etc/sources.list

deb http://ftp.thaios.net/debian/etch main
deb-src http://ftp.thaios.net/debian/etch main

ทำการ update และ upgrade package
#apt-get update
#apt-get upgrade
แล้วทำการลง ssh ก่อนโดย

#apt-get install ssh

แล้วทำการลง package ต่างๆ ที่จำเป็นที่จะใช้ดังนี้

ลง MySQL server (MySQL5):

#apt-get install mysql-server mysql-client libmysqlclient15-dev phpmyadmin

แก้ไขให้ client connect ไปที่ mysql server ได้ทุกแบบไม่ใช่แค่ "localhost"
#vi /etc/mysql/my.cnf

หาบันทัด bind-address = 127.0.0.1 แล้วใส่ # ไปซะ
# bind-address = 127.0.0.1

ทำการ restart MySQL:
#/etc/init.d/mysql restart

ใส่ค่า password ของ mysql
#mysqladmin -u root password yourpassword

ต่อไปทำการ install Apache 2(.2) with PHP5

#apt-get install apache2 apache2-doc apache2-mpm-prefork apache2.2-common apache2-utils libexpat1 ssl-cert

และต่อไป install php5

#apt-get install libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd php5-idn php-pear
php5-imagick php5-imap php5-json php5-mcrypt php5-memcache php5-mhash php5-ming php5-mysql php5-ps
php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

จะขึ้น Pop-up ถามว่า

Continue installing libc-client without Maildir support?

ตอบไปว่า yes

แก้ไข config apache ดังนี้

DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl index.xhtml

แก้ไขไฟล์ /etc/apache2/ports.conf

โดยเพิ่ม Listen 443:

#vi /etc/apache2/ports.conf

Listen 80
Listen 443

ทำการเปิด module ต่างๆ ที่จะใช้ใน apache
#a2enmod ssl
#a2enmod rewrite
#a2enmod suexec
#a2enmod include

ทำการ reload config apache
#/etc/init.d/apache2 force-reload

ต่อไปทำการลง mail server
#apt-get install postfix postfix-tls

จะถามค่า hostname
ใส่ให้ตรงกับ ตอนที่ install os
เช่น server1.example.com

#apt-get install proftpd proftpd-mysql

เลือกเป็นแบบ "Stand alone"

#apt-get install courier-authdaemon courier-base courier-imap courier-maildrop courier-pop
libberkeleydb-perl 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 patch procmail tar original-awk libterm-readpassword-perl
libsasl2-modules libsasl2 sasl2-bin bzip2 gcc make libc6-dev

แก้ไขไฟล์ /etc/proftpd/proftp.conf ดังนี้

#vi /etc/proftpd/proftpd.conf

UseIPv6 off

เพิ่ม config นี้ลงไป

DefaultRoot ~
IdentLookups off
ServerIdent on "FTP Server Ready"

ทำการ save แล้วออกไป.

ต่อไปทำการ download package vhcs2 มาคับตัวนี้ สามารถ support ได้ทั้งแบบ 64 bit กับ 32 bit น่ะครับ

#cd /usr/src
#wget http://downloads.sourceforge.net/vhcs/vhcs2-2.4.7.1.tar.bz2

แตกไฟล์:
#tar -xjf vhcs2-2.4.7.1.tar.bz2

เข้าไปยัง
#cd vhcs2-2.4.7.1

สั่งรัน เพิ่มให้สร้างตัว install :
#make install

หลังจากนั้นเข้าไปที่
#cd /tmp/vhcs-2.4.7.1

ทำการ copy file ไปยังปลายทาง:
#cp -R * /

##แก้ path fix error ftp ผ่านเว็บครับ

แก้ bug เรื่อง filemanager

Edit files:
/etc/vhcs2/apache/parts/als_entry.tpl
/etc/vhcs2/apache/parts/als_php2_entry.tpl
/etc/vhcs2/apache/parts/dmn_entry.tpl
/etc/vhcs2/apache/parts/dmn_php2_entry.tpl
/etc/vhcs2/apache/parts/sub_entry.tpl
/etc/vhcs2/apache/parts/sub_php2_entry.tpl

แล้วแก้ไขไฟล์ โดยลบ / หลัง /tmp/ ออกครับให้เหลือแค่

/tmp ในไฟล์เหล่านี้

เช่น
php_admin_value open_basedir "{GUI_ROOT_DIR}/:/etc/vhcs2/:/proc/:{WWW_DIR}/:/tmp/"
แก้เป็น
php_admin_value open_basedir "{GUI_ROOT_DIR}/:/etc/vhcs2/:/proc/:{WWW_DIR}/:/tmp"

แล้วเข้าไปที่ :
#cd /var/www/vhcs2/engine/

ทำการแก้ไข file vhcs2_common_code.pl
#vi vhcs2_common_code.pl

ใช้ vi เข้าไปแก้ บันทัดที่ "1408" หาคำว่า:
'key'=>$main::db_pass_key,

เพิ่มบันทัดนี้เข้าไปก่อนหน้า นั้น
'keysize'=>32,

ระวังเครื่องหมายด้วยน่ะครับ
แก้ที่บันทัด ประมาณ 1446 ให้ใส่ตามข้างบนนั้น


save แล้วออกมา.

เริ่มทำการ install vhcs ครับ
#cd /var/www/vhcs2/engine/setup
#./vhcs2-setup

2175
บางครั้ง เราอาจจะใช้วิธีหา ข้อความที่เป็นคำสั่งใน file ของ user ได้
คือผมเคยมี case หนึ่งซึ่งหาด้วยวิธีอื่นไม่เจอจริงๆ เลยใช้วิํธี หาโดย

#cd /folder/problem

#ใช้คำสั่ง ค้นหา
#find . -iname '*.*' -print | xargs grep -il 'mail'

และสามารถเช๊ค connection ได้คือ
netstat -anp | grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

เช๊คดูการทำงานของ disk , utilization
#iostat -x 2

เช๊คดูการทำงานของ การเขียน อ่าน disk
#iotop

Pages: 1 ... 143 144 [145] 146