แสดงกระทู้

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 ... 140 141 [142] 143 144 ... 146
2119
all application on unix knowledges by golfreeze / font thai centos on desktop for beginner
« on: มกราคม 23, 2011, 12:57:29 am »
วิธีติดตั้งฟอนต์ไทยสำหรับ CentOS 5.4

ดาวน์โหลดฟอนต์ไทยมาก่อน

# wget ftp://linux.thai.net/pub/ThaiLinux/software/thai-ttf/thai-ttf-0.4.13.tar.gz

แตกไฟล์ออกก่อน

# tar xvfz thai-ttf-0.4.13.tar.gz

เข้าไปที่โฟลเดอร์

# cd thai-ttf-0.4.13

ล็อคอินเป็นแอดมินก่อน

# su (แล้วใส่รหัสผ่าน)

สร้างโฟลเดอร์สำหรับเก็บฟอนต์

# mkdir /usr/share/fonts/thai-ttf

คัดลอกฟอนต์ไทยทั้งหมดไปเก็บไว้ที่โฟลเดอร์ใหม่

# cp *.* /usr/share/fonts/thai-ttf/

เพิ่มเติ่มบางที่เขาแนะนำให้ทำ เพื่อให้โปรแกรมต่างๆเรียกใช้งานฟอนต์ได้(แต่ผมทำแล้วไม่ได้
แต่จากคำสั่งบางบน ก็เพียงพอแล้ว)

# chkfontpath -add /usr/share/fonts/thai-ttf

หรือ

# chkfontpath -a /usr/share/fonts/thai-ttf

และตามด้วยทำสั่ง

# chkfontpath -l

เสร็จจากคำสั่งทั้งหมดแล้ว ก็สั่งรีบูตระบบเพื่อเริ่มใหม่

# reboot

หรือ

# shutdown -r now

ที่มา : http://www.iblog.in.th/2009/10/27/%E0%B8%95%E0%B8%B4%E0%B8%94%E0%B8%95%E0%B8%B1%E0%B9%89%E0%B8%87%E0%B8%9F%E0%B8%AD%E0%B8%99%E0%B8%95%E0%B9%8C%E0%B9%84%E0%B8%97%E0%B8%A2-centos-5-4/


ปรับขนาด หน้าจอ resolution ใน centos

cp /etc/X11/xorg.conf /etc/X11/backup.xorg.conf
system-config-display --reconfigue --set-resolution=1024x768 --set-depth=16

### เล่น DVD file หนัง โปรแกรม VLC

http://www.cyberciti.biz/faq/rhel-centos-fedora-media-mp3-players-installtion/

2120
all application on unix knowledges by golfreeze / mount ntfs-3g on centos 5.4
« on: มกราคม 23, 2011, 12:56:50 am »
ปกติ Centos version 5.4

จะลง package fuse มาให้อยู่แล้วครับผม

ก่อนที่เราจะทำการ mount filesystem ที่เป็น ntfs เราก็ลง package เพิ่มดังนี้ ครับ

wget http://marush.com/wp-content/uploads/2009/03/ntfs-3g-200921-el5i686.rpm
rpm -ihv ntfs-3g-200921-el5i686.rpm

wget http://superb-east.dl.sourceforge.net/sourceforge/fuse/fuse-2.6.0.tar.gz
tar xvfz fuse-2.6.0.tar.gz
cd fuse-2.6.0

Execute
./configure
make
make install

Then try
fdisk -l

แค่นี้แล้วก็สั่ง

#mount -t ntfs-3g /dev/sda5 /mnt/sda5
เรียบร้อยครับผม

2121
สำหรับ Mainboard ASUS P5GC-MX/1333 ตัว Lan คือ Atheros น่ะครับ

รุ่นนี้จะให้ Lan on board มาเป็น Attansic L2 100Mbit Ethernet Adapter และมี source driver
ให้เว็บไซต์ผู้ผลิตด้วย ซึ่งดีมากๆ

แต่สำหรับชาว Debian,ubuntu ง่ายกว่านั้นครับ เพราะมีใน apt-get เลย

วันนี้ ผมทดสอบ ลง Debian 4.0 R5 i386 ใน kernel มี driver net atl1 อยู่นะครับ แต่ว่าตัวรุ่นที่มากับ
MB เป็น atl2 ลอง modprobe แล้วได้บ้าง ไม่ได้บ้าง ลอง reboot ก็หลุดไปเลย

ลองติดตั้ง driver atl2 จาก apt-get เลยดีกว่าครับ
- อันดับแรก ตรวจสอบ kernel vesion ก่อนครับ ด้วย uname -a
- package driver คือ atl2-module นะครับ เลือกให้ตรงกับ kernel ของเรา ลอง apt-cache search
atl2-module ดูครับ แล้วสั่ง apt-get install atl2-module-xxxx
- ลอง modprobe atl2
- สั่ง ifconfig ethx ดู (ผมไม่รู้ว่าเครื่องอื่นๆจะเป็น eth ไหนนะครับ ถ้ามีอันเดียวก็ eth0 ครับ)

อ้างอิง http://blog.eulinux.org/2008/05/attansic-l2-100mbit-ethernet-adapter-on.html

2122
command , shell script ,tool , crontab / Re: tcpdump and tshark howto na ja
« on: มกราคม 23, 2011, 12:55:50 am »
### มี tool อีกตัวครับมาแนะนำ ชื่อ

mtr

เป็นการผสมผสาน ระหว่าง traceroute และ ping ถ้าคุณชอบใช้ traceroute ในการเช๊ค hop ของ link แล้วละก็
น่าจะชอบตัวนี้ ครับ มันสามารถ ping ไปยัง node ที่ traceroute ไปถึงได้อีก

ลองดูน่ะครับ

### BSD
#mtr google.co.th

My traceroute [v0.72]
ns1.packetlove.com (0.0.0.0) Thu Feb 25 10:40:09 2010
Keys: Help Display mode Restart statistics Order of fields quit
Packets Pings
Host Loss% Snt Last Avg Best Wrst StDev
1. 203.146.215.124 0.0% 3 2.0 25.5 2.0 57.0 28.3
2. 210.1.0.164 0.0% 3 2.1 2.2 0.4 3.9 1.7
3. 210.1.3.225 0.0% 3 1.5 2.3 1.5 3.9 1.4
4. 210.1.46.228 0.0% 3 1.6 5.6 1.6 10.0 4.2
5. 202.183.136.134 0.0% 2 10.0 9.9 9.8 10.0 0.2
6. 202.183.136.77 0.0% 2 321.2 195.6 69.9 321.2 177.8
7. 202.183.136.82 0.0% 2 38.5 46.7 38.5 54.9 11.6
8. 202.183.136.98 0.0% 2 36.1 40.5 36.1 44.9 6.2
9. 209.85.243.156 0.0% 2 37.0 39.7 37.0 42.4 3.8
10. 209.85.254.179 0.0% 2 47.6 42.2 36.8 47.6 7.6
11. sin01s01-in-f104.1e100.net 0.0% 2 37.3 41.2 37.3 45.2 5.6


##Tshark for freebsd
command

#tshark -i bce0 -f "host xxx.xxx.xxx.xxx or host yyy.yyy.yyy.yyy " -w file.cap

2123
command , shell script ,tool , crontab / tcpdump and tshark howto na ja
« on: มกราคม 23, 2011, 12:55:32 am »
วันนี้ ได้ลองใช้ tshark ดูครับ

การทำงานคล้ายๆ tcpdump แต่มีในส่วนของ data และก็ header packet ที่ค่อนข้างละเอียดกว่า tcpdump ครับ

การใช้งานก็คือ เริ่มลงไปก่อน ผมลงกับ debian นะครับ

#apt-get update
#apt-get install tshark

ก็เรียบร้อยครับผม

ต่อมาเริ่ม capture packet ที่มาจาก ip 192.168.33.1 port 25 แล้วก็เก็บไฟล์ ที่ capture ได้ที่ ไฟล์
ไฟล์หนึ่งเพื่อนำไปวิเคราะห์ ผลโดย

#tshark -i eth0 tcp port 25 and host 192.168.33.1 -w /tshark/tshark_19_20100217_03.cap

แต่ถ้าใช้เป็น tcpdump ก็ดูได้จาก command โดยที่จะ filter source ip ที่มาจาก 192.168.33.1 นี้นะครับ
แล้วเก็บไฟล์ไว้ที่ test.cap เพื่อไปวิเคราะห์ต่อไป
#tcpdump src host 192.168.33.1 and port 8080 -w test.cap

หรือต้องการ เก็บเป็นไฟล์ที่สามารถดูเป็นข้อมูลได้เลยก็

#tcpdump src host 192.168.33.1 and port 8080 > test.txt

ในกรณี ต้องออกจาก screen ก่อนนะครับ ไม่งั้นมันจะ print ข้อมูลออกมาเลย

2124
Mail issue , problem , configuration / Re: update clamav in debian and freebsd
« on: มกราคม 23, 2011, 12:55:07 am »
##update by yum

cd /root
wgethttp://dev.ffpx.org/download/clamav-toaster-0.96.0-1.3.35.src.rpm
yum install rpm-build
yum install bzip2-devel gmp-devel zlib-devel curl-devel libidn-devel
rpmbuild --rebuild --with cnt50 clamav-toaster-0.96.0-1.3.35.src.rpm
mv /usr/src/redhat/RPMS/i386/clamav-toaster-0.96.0-1.3.35.i386.rpm .
rpm -Uhv clamav-toaster-0.96.0-1.3.35.i386.rpm

2125
Mail issue , problem , configuration / update clamav in debian and freebsd
« on: มกราคม 23, 2011, 12:55:00 am »
ทั้งสอง os ผมจะให้มันอัฟเดทผ่าน source กับ port นะครับเพื่อง่ายและเป็น มาตรฐานของ packetlove.com

##Debian

เพิ่มใน sources.list

#clamav
deb http://volatile.debian.org/debian-volatileetch/volatile main contrib non-free
deb-src http://volatile.debian.org/debian-volatileetch/volatile main contrib non-free

แล้วสั่ง
#apt-get install clamav clamav-daemon clamav-freshclam clamav-base

แค่นี้ มันก็จะทำการ อัฟเดทให้ครับ

ส่วน option ที่ถามให้ตอบว่า update configuration ไปด้วยเลยน่ะครับ

แล้วลองใช้ dpkg -l | grep \"clamav\"

ก็จะได้ version ใหม่มาแล้วครับผม

###Freebsd
สั่งอัฟเดท port ก่อนนะครับ
#portsnap fetch
#portsnap extract

#cd /usr/ports/security/clamav
#make deinstall

#make install clean (เลือก option 5 ตัวบนครับ มี ARC,ARJ,LHA,UNZOO,UNRAR)

#/usr/local/etc/rc.d/clamav-clamd restart

2126
สมมติเวลา สั่ง

#apt-get update

แล้วเกิด error อย่างข้างล่างนี้ น่ะครับ

Fetched 58.9kB in 15s (3780B/s)
Reading package lists... Done
W: GPG error: http://volatile.debian.orgetch/volatile Release: The following signatures couldn't
be verified because the public key is not available: NO_PUBKEY DFD993306D849617
W: Duplicate sources.list entry http://volatile.debian.orgetch/volatile/main Packages
(/var/lib/apt/lists/volatile.debian.org_debian-volatile_dists_etch_volatile_main_binary-amd64_Packag
es)
W: Duplicate sources.list entry http://volatile.debian.orgetch/volatile/contrib Packages
(/var/lib/apt/lists/volatile.debian.org_debian-volatile_dists_etch_volatile_contrib_binary-amd64_Pac
kages)
W: Duplicate sources.list entry http://volatile.debian.orgetch/volatile/non-free Packages
(/var/lib/apt/lists/volatile.debian.org_debian-volatile_dists_etch_volatile_non-free_binary-amd64_Pa
ckages)
W: You may want to run apt-get update to correct these problems

เหมือนกับว่า เครื่อง server เราไม่มี key แก้ไขโดย

#gpg --keyserver subkeys.pgp.net --recv-keys DFD993306D849617

#gpg --armor --export DFD993306D849617 | apt-key add -

#apt-get update

ก็หายแล้วครับ

แล้วถ้าจะอัฟเดท package ใหม่ๆ ก็ ex.clamav

#apt-get install clamav clamav-daemon clamav-base clamav-freshclam

เดี๋ยวมันจะวิ่งอัฟเดท version ให้ครับผม

2127
### ถ้าจะใช้ syslog-ng ต้องลบ syslog ออกน่ะครับผมเพราะไม่งั้น os จะสับสนกันเองครับ

install syslog-ng
#apt-get install syslog-ng

ลบ script syslog ออกไม่ให้รัน ตอน reboot server
#update-rc.d -f syslog remove

ต่อไป เริ่ม config syslog-ng.conf
#vi /etc/syslog-ng/syslog-ng.conf

หาว่ามี config mail.log หรือไม่
destination df_mail { file("/var/log/mail.log"); };

#mail.* -/var/log/mail.log
log {
source(s_all);
filter(f_mail);
destination(df_mail);
};

ถ้ามีครบ ก็ ไป config logrotate ได้เลยครับ
#vi /etc/logrotate.d/syslog-ng

/var/log/mail.info {
rotate 90
daily
missingok
notifempty
compress
}

/var/log/mail.log {
rotate 90
daily
missingok
notifempty
compress
# delaycompress
}

/var/log/mail.warn {
rotate 90
daily
missingok
notifempty
compress
}

แค่นี้ ครับ

ข้อแม้ ห้ามมีไฟล์ที่ เขียน config อย่างงี้ซ้ำกันใน path "/etc/logrotate.d/"

น่ะครับไม่งั้น เวลาสั่ง logrotate มันจะขึ้นว่า log file มัน duplicate กัน

เสร็จแล้วการ test สั่งให้ logrotate ทำงาน

#logrotate /etc/logrotate.conf

รอสักพัก แล้วไปดูใน path /var/log ก็จะเห็นมัน lorate log ให้ครับผม

ส่วน log file ตัวอื่นก็ทำในลักษณะเดียวกันน่ะครับ

ส่วนการรัน log rotate จะทำงานใน cron.daily ทุกวันอยู่แล้ว ไม่ต้องไป set crontab เพิ่มน่ะครับผม
ถ้าจะเช๊คก็ดูได้ที่
#more /etc/cron.daily/logrotate




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

2128
all application on unix knowledges by golfreeze / Re: install heartbeat on freebsd
« on: มกราคม 23, 2011, 12:53:39 am »
initdead 30
ระบุว่า อีก host ตายในเวลา 30 วินาที กรณี boot เครื่องมาใหม่ แล้วไม่เจออีก node

ให้ทำการ restart service heartbeat พร้อมกันใหม่
แล้วทั้งสองเครื่องจะได้ share connection กัน

2129
all application on unix knowledges by golfreeze / install heartbeat on freebsd
« on: มกราคม 23, 2011, 12:53:18 am »
##heartbeat port
cd /usr/ports/sysutils/heartbeat/

make config
make install clean


config on ha.cf
#vi /usr/local/etc/ha.d/ha.cf

logfile /var/log/ha-log
debugfile /var/log/ha-debug
logfacility local0
bcast bce1
baud 9600
serial /dev/cuad0
auto_failback on
node mysql0.test.server
node ldap01.test.server
ping 10.0.0.1
respawn hacluster /usr/local/lib/heartbeat/ipfail
apiauth ipfail gid=haclient uid=hacluster
keepalive 2
deadtime 10
warntime 5
initdead 30

-----------------------------------------------------------------
อธิบาย ค่า config

logfile /var/log/ha-log
ให้เปิด logfile ไปที่ไฟล์ /var/log/ha-log
debugfile /var/log/ha-debug
ให้เปิด debugfile ไปที่ไฟล์ /var/log/ha-debug
logfacility local0
ให้กำหนดการโชว์ log เป็น 0
bcast bce1
ให้ broadcast packet สำหรับ heartbeat ไปถึงกันผ่าน bce1
baud 9600
ให้เปิดใช้งาน serial port ผ่าน rate 9600
serial /dev/cuad0
ให้เปิดใช้งาน device serial port ที่ cuad0 ปกติ freebsd ใช้ตัว device นี้
auto_failback on
กำหนดให้ทำการ auto failback กรณีตัว master ที่ตายกลับมาทำงานได้ใหม่
node mysql0.test.server
node mysql1.test.server
ชื่อ เครื่องที่ทำการ รัน heartbeat และใช้งาน heartbeat
ping 10.0.0.1
ให้เช็คปิงไปที่ gateway node ถ้า master ping ไม่ได้จะ swap การทำงานไปที่ slave node
respawn hacluster /usr/local/lib/heartbeat/ipfail
apiauth ipfail gid=haclient uid=hacluster
เปิดให้ใช้งาน ipfail ในการเช๊ค heartbeat ด้วย
keepalive 2
deadtime 10
ค่าตัวนี้ ใช้ในการระบุหาก master node ตาย ให้ทำการรอประมาณ 10 วินาที แล้วจะย้าย vip ไปที่ slave
node
warntime 5
เตือนเวลา heartbeat ไม่สามารถคุยกันได้
initdead 30
ระบุว่า อีก host ตายในเวลา 30 วินาที กรณี boot เครื่องมาใหม่ แล้วไม่เจออีก node

-----------------------------------------------------------------
###create authkeys file , input below command on shell prompt
( echo -ne "auth 1\n1 sha1 "; \
  dd if=/dev/urandom bs=512 count=1 | openssl md5 ) \
  > /etc/ha.d/authkeys

chmod 0600 /usr/local/etc/ha.d/authkeys

หรือเข้าไป ทำ md5 ที่ link ข้างล่างนี้ก็ได้ครับ
http://7thspace.com/webmaster_tools/online_md5_encoder.html
-----------------------------------------------------------------

#### create file \"haresources\" to share packet
mysql0.test.server 10.0.0.2

ทำการ config ที่ mysql1 ให้มีค่า config เหมือนกันทั้งสามไฟล์
ha.cf
authkeys
haresources

2130
เคยเจอ case ว่าเครื่องเพื่อน โดน hack จาก script
แล้วทำการเปลี่ยนค่า permission ของไฟล์ ls ครับ
เช๊คจากคำสั่ง
#cd /bin
#lsattr
------------------ ./tar
------------------ ./netcat
------------------ ./bzcat
------------------ ./dd
------------------ ./true
------------------ ./zforce
------------------ ./mt
s---ia------------ ./ls

พบว่าค่า attribute ของ command ls ถูกเปลี่ยน
แก้ไขโดย
#chattr -i ls
#chattr -a ls
#chown root:root ls

ผมทำการ copy ไฟล์ ls จากเครื่องอื่นที่เป็น distro เดียวกันมาลงครับ
#cp ls_backup ls
#chattr -s ls

ปกติไฟล์พวกนี้ ไม่สามารถเปลี่ยน owner ได้ตรงๆ เพราะมันติดสิทธิ์ของไฟล์อยู่ ต้องแก้ไขด้วยวิธีข้างบน

แค่นี้ก็ใช้งานได้แล้ว

แล้วก็ตามหาตัวผู้ร้ายต่อไป อิอิ

Pages: 1 ... 140 141 [142] 143 144 ... 146