Jun 21

ใช้ mysqltuner แล้วพบว่า จำเป็นต้อง optimize tables แต่จะทำไงให้ optimize ได้ทุกตารางล่ะ

ใช้คำสั่งนี้ได้เลยครับ

mysqlcheck -Aao --auto-repair -u root -p[password]

-a, –analyze [Analyze given tables]
-o, –optimize [Optimize table]
-A, –all-databases [Check all the database]
–auto-repair [If a checked table is corrupted, automatically fix it. Repairing will be done after all tables have been checked, if corrupted ones were found]

หรือ จะใช้

mysqlcheck -uroot -p -ro –all-databases 

-r = Can fix almost anything except unique keys that are not unique.

ก็จะสำเร็จเสร็จเรียบร้อย ที่เหลือก็แล้วแต่ปรับแต่งนะครับ

written by Mr-San \\ tags: ,

Jun 18

เมื่อวันพฤหัสบดี 12 มิถุนายน 2551 มีงานเปิดตัวโครงการระดับประเทศงานหนึ่งครับ ผมเป็นคนหนึ่งในทีมผู้จัดทำ นั่นก็คือ โครงการระบบจดหมายอิเล็กทรอนิกส์กลางภาครัฐ โครงการใหญ่มากสำหรับผมในปีนี้ แถมยังได้รับเกียรติจาก ดร.ศักดิ์ เสกขุนทด ให้ร่วมเป็น speaker ในงานด้วย ตื่นเต้นมาก (ไม่เคยขึ้นพูดงานที่มีคนฟังเยอะขนาดนี้ ประมาณ 400 คน)

โครงการนี้ถือกำเนิดจาก มติ ครม.ที่ไม่อยากให้ข้าราชการใช้ free email ซึ่งอาจจะมีส่วนทำให้ความลับทางราชการรั่วไหลได้ จึงอยากให้ข้าราชการหลืกเลี่ยงการใช้งาน แล้วมาใช้ส่วนกลางแทน และผลประโยชน์ที่ได้อีกอย่างที่ผมเห็นว่าสำคัญมากคือ ราชการไม่จำเป็นต้องมีการลงทุนซ้ำซ้อนในส่วนของโครงสร้างระบบเมล์ แล้วหันมาใช้ส่วนกลาง ง่ายต่อการจัดการ

รายละเอียดผมคงไม่ต้องสาธยายมากครับ ไงลองไปอ่านตาม link ต่างๆ กันละกันครับ

ref :

ส่วนรูปทีมงานและรูปอื่นๆ ผมคัดเอามาบางส่วน ดูได้ที่

written by Mr-San \\ tags:

May 18

อันนี้เป็น checklist สำหรับ ตั้ง Server ใหม่สำหรับ Ubuntu 8.04 Server นะครับ
ก็ขึ้นกับว่าใครจะทำอะไรบ้างแต่อันนี้เป็นของที่ผมคิดว่า น่าจะเหมาะกับการเป็น Server ครับ

  • /etc/network/interface - pre-up /etc/network/iptables.firewall : เพิ่มกฏ Iptables Firewall
  • vi /etc/default/rcS - UTC=no : แก้ไขเวลาเครื่องและเวลาของระบบ ให้เป็นเวลาของประเทศไทย
  • backup /etc/init.d : ไว้สำหรับแก้ไขไฟล์ เก็บไว้ก่อน
  • /etc/init.d/apparmor stop && update-rc.d -f apparmor remove : ยกเลิกการใช้งาน apparmor
  • ln -sf /bin/bash /bin/sh : แก้ไข default shell
  • apt-get remove pcmciautils ubuntu-minimal pppoeconf ppp pppconfig
  • update-rc.d -f pcmciautils remove
  • /etc/ssh/sshd_config - PermitRootLogin no

เก็บไว้ติดตั้งเรื่อย Ubuntu 8.04 เป็น LTS (Long Term Support) ด้วยครับ จะได้ใช้ไปอีกนานๆ

written by Mr-San \\ tags: , ,

May 03

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

ให้ไปเคลียร์เงินเลยแล้วจะจัดการดูดส้วมให้ (พอดีมีอยู่ 300 บาท) ทางเจ้าหน้าที่ที่มาก็บอกว่า งั้น 400 ละกัน (เพิ่งตื่นยังคิดอะไรไม่ทัน) แต่สงสัยว่าทำไมมันดูดส้วมเร็วจังฟะ แล้วยังบอกอีกว่า เติมน้ำยาเสร็จแล้วเป็น 2 ระบบในท่อเดียวกัน (มันมีอย่างนี้ด้วยเหรอนี่) พอจ่ายตังค์ไป (ยืมเพื่อนบ้านอีก 100 บาท) ก็จำเบอร์รถกลับมา เป็นรถดูดส้วมสีน้ำเงิน ทะเบียน 70-0619 ส่วนจังหวัดไม่มีมันพับไว้ (ไม่น่าเลย น่าจะเดินมาดูก่อน) แล้วพอไปทวงใบเสร็จ คนขับรถดูดส้วมก็บอกว่าเด๋วขอไปเติมน้ำยาก่อนแล้วจะเอามาให้ ที่ไหนได้ ขับออกไปเลย (คิดอย่างเดียว ถ้ามันดูดจริง ก็ ok ไป ถ้าไม่ได้ดูด ก็เสียเงินฟรีสิฟะ) เลยมาเขียนบอกไว้เพื่อป้องกันจะได้ไม่โดนอีก

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

written by Mr-San \\ tags: ,

Apr 21

หากใครหา php5-gmp ซึ่งจะไปใช้กับ Ubuntu 7.10 ก็จะหาไม่ได้นะครับ ขั้นแรกคือรอ Ubuntu 8.04 (Hardy Heron) ซึ่งจะมีให้เลย แถมยังเป็น LTS (Long Time Support) อีกด้วย ก็จะ launch ในวันที่ 24 เมษายน ที่จะถึงนี้เอง
แต่พอดีผมใช้อยู่และรอไม่ได้ก็เลยต้องหาวิธีทำให้ PHP5 ของ Ubuntu 7.10 ใช้ได้ก็เลยไปหาใน Ubuntuforums.org มีคนทำเป็น package ด้วย link ดูได้จากด้านล่างนะครับ (อีกที่ มี compile package ไว้ให้ด้วย)
ผมได้แก้ให้เป็น version 5.2.3 ครับ แต่วิธีการเดียวกัน

Steps to enter at the command line:

1. apt-get install build-essential debhelper libgmp3c2 libgmp3-dev

(More tools might be needed depending on what you already have installed, but you will tend to get warnings about what is missing)

Then, download the PHP sources:

2. apt-get source php5

My version is 5.2.3, but yours may be different.

Get all the dependencies for building PHP:

3. apt-get build-dep php5

Change into the debian build directory for PHP:

** Found problem with : libsnmp10-dev - virtual package with libsnmp-dev
used with apt-get install —all of package–

4. cd php5-5.2.3/debian

Let’s edit the modulelist file.

5. vi modulelist

Insert a line below the one that says

gd GD

with the contents:
gmp GMP

Next, edit the rules file. Either open it from gedit directly or use:

6. vi rules

Look for the line that says:

–with-curl=shared,/usr \

Open a line below this with the contents:
--with-gmp=shared,/usr \

Make sure not to forget the backslash on the end. Also, GMP installed itself into /usr/local on my machine. Your location may be different.

Now, we edit the control file. Again, either use the gedit GUI to open the file or type:

7.vi control

Add this to the end of the file:
Package: php5-gmp
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, ${php:Depends}, php5-common (= ${Source-Version})
Description:GMP module for php5
This package provides a module for GMP to be used with PHP5.
.
PHP5 is an HTML-embedded scripting language. Much of its syntax is borrowed
from C, Java and Perl with a couple of unique PHP-specific features thrown
in. The goal of the language is to allow web developers to write
dynamically generated pages quickly.

Make sure that you keep all that text as one big block with no extra lines between it. It’s ok to have an extra line after it, but not between it. Just see how the other entries are entered and go from there.

Move up a directory.

8. cd ..

Now, run:

9. sudo dpkg-buildpackage

This will do the whole configure/compile for PHP and create debs in the parent directory. This does take awhile, though. When this process is done, move up to the parent directory:

10. cd ..

And, you will see all of the PHP debs, including the new php5-gmp_[version].deb

Run a dpkg -i on the ones you need (I just used the gmp one):

11.dpkg -i php5-gmp_523-1ubuntu6.3_i386.deb

เป็นอันเสร็จพิธี อย่าลืม restart apache นะครับ

อ้างอิง

written by Mr-San \\ tags: , , ,