Archive

Archive for the ‘Linux’ Category

ลง Imagemagick และ PHP Imagick extension บน CentOS

April 17, 2012 Leave a comment

ทดสอบแล้วบน Centos 5.5 32 Bit

ก่อนอื่นให้ใช้คำสั่งด้านล่าง ใน ssh (ไล่ไปทีละบรรทัดนะครับ)

yum install ImageMagick.i386
yum install ImageMagick-devel.i386
pecl install imagick

ถ้าเจอ Error ด้านล่างหลังจากใช้คำสั่ง pecl install imagick:

root@myhost [~]# pecl install imagick
downloading imagick-3.0.1.tgz ...
Starting to download imagick-3.0.1.tgz (93,920 bytes)
.....................done: 93,920 bytes
13 source files, building
running: phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
Please provide the prefix of Imagemagick installation [autodetect] :
building in /var/tmp/pear-build-root/imagick-3.0.1
running: /root/tmp/pear/imagick/configure --with-imagick
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
ERROR: `/root/tmp/pear/imagick/configure --with-imagick' failed

ให้ใช้คำสั่งนี้:

mount -o remount,rw /tmp

หลังจากเสร็จขั้นตอนการติดตั้ง ให้สร้างไฟล์สั่งโหลด php extension imagick และ restart httpd ด้วยคำสั่งด้านล่าง

echo "extension=imagick.so" > /etc/php.d/imagick.ini
/etc/init.d/httpd restart

ทดสอบการโหลด modules imagick:

php -m | grep imagick

Categories: Linux Tags:

เกี่ยวกับวันเวลาของ Linux

August 18, 2011 Leave a comment

วิธีดูเวลา Local time ในเครื่อง ใช้คำสั่ง

# date

ผลลัพท์จะออกมาประมาณนี้

Thu Aug 18 05:28:47 ICT 2011

การตั้งเวลานั้นให้ใช้ ntp เป็นตัว Sync เวลากับ Server เพื่อปรับเวลาอัตโนมัติได้เลย

วิธีลง ntp

# yum install ntp

เปิด Service

# chkconfig ntpd on

Synchronize กับ Server ntp

# ntpdate pool.ntp.org

สั่ง Start Service

# /etc/init.d/ntpd start

เสร็จเรียบร้อย

Categories: Linux Tags: , , ,

คำสั่งเช็ค Lan network data ต่าง ๆ

June 29, 2011 Leave a comment

ดูข้อมูล Network เบื้องต้น eth0 = Device lan ตัวแรกeth1  = Device lan ตัวสอง

ethtool eth0

เช็ค Connect / Netstat command เพื่อดู Connection

netstat -nat

เช็ค Connect / เฉพาะ ESTABLISHED

netstat -nat | grep ‘ESTABLISHED’

Categories: Linux Tags: , , ,

วิธีลง tcptrack สำหรับ Monitor Traffic และ Connection

June 29, 2011 Leave a comment

tcptrack เป็นโปรแกรมที่ไว้ใช้สำหรับ Monitor Connection / Traffic แบบ Real-time
ลงโปรแกรมผ่าน Terminal โดยใช้คำสั่งข้างล่างนี้

สำหรับ Redhat (RHEL) / Fedora / CentOS

# cd /tmp/
# wget http://dag.wieers.com/rpm/packages/tcptrack/tcptrack-1.1.5-1.2.el5.rf.x86_64.rpm
# rpm -ivh tcptrack-1.1.5-1.2.el5.rf.x86_64.rpm

สำหรับ Debian / Ubuntu

$ sudo apt-get install tcptrack

Command เวลาใช้

tcptrack -i eth0

สามารถเลือกดูแบบ port ที่กำหนดได้ เช่น (SMTP)

# tcptrack -i eth0 port 25

หรือคำสั่งข้างล่างนี้ สำหรับ Monitor Port 80

# tcptrack -i eth0 port 80

สามารถตรวจ Connection แบบไอพีเดียวได้ด้วย

# tcptrack -i eth0 src or dst 76.11.22.12

*หมายเหตุ eth0 เป็นหมายเลข Device ของ Lan ซึ่งปกติจะเป็น eth0 หากมี Device lan เชื่อมต่อมากกว่าหนึ่งก็สามารถเปลี่ยนเป็น eth1 ได้

Categories: Linux Tags: