Saturday, June 2, 2007

.tar.gz ~Compile and Install~

จะเห็นได้ว่า ไม่ว่าในการลง minidebian หรือ utility ต่างๆของ Cygwin นั้นจะมีไฟล์ .tar.gz ปรากฎให้เห็นอยู่เสมอ คราวนี้จะมาดูวิธีการติดตั้งไฟล์ประเภทนี้กัน


How to Compile and Install tar.gz

1.download ไฟล์ .tar.gz [ex. = skyeye_1_2_2_Rel.tar.bz2]
จากนั้นทำการย้าย directory ไปยังที่เก็บไฟล์ด้วยคำสั่ง
$cd [File Directory]
ex.
cd d:/Skyeye

2.copy .tar.gz มายัง directory ใดๆใน Cygwin
$ cp [ไฟล์] [Cygwin directory]
ex.
cp skyeye_1_2_2_Rel.tar.bz2 /usr/lacal/bin

3.เปลี่ยน directory ไปยังที่อยู่ของไฟล์
$ cd [ที่อยู่ใน Cygwin Directory]
ex.
cd f:/Cygwin/usr/bin

4.ทำการแตกไฟล์ .tar.gz
$tar [option
*] [ชื่อไฟล์.tar.gz]
ex.
tar jxvf skyeye_1_2_2_Rel.tar.bz2

5.เมื่อทำการแตกไฟล์เรียบร้อยแล้วให้ใช้คำสั่ง ls เพื่อดูไฟล์ภายใน โฟลเดอร์ที่ทำการแตกไฟล์มา ดูแผนผังตามรูป

(ที่มา : kitty.in.th)
จะเห็นได้ว่าเราควรใช้คำสั่งอะไรต่อไป โดยดูจากไฟล์ที่เราทำการแตกออกมา

6.หลังจากที่เราตรวจดูแล้วแล้วใช้คำสั่งตามรูปในข้อ 5 ไปแล้วจนกระทั่งสิ้นสุดขบวนการ make ซึ่งจะได้ .exe ออกมา
จากนั้นใช้คำสั่ง
$install [option
*] [file.exe] [destination]
ก็จะเสร็จเรียบร้อย


*สามารถที่จะเรียกดู option ที่ต่อท้ายแต่ละคำสั่ง ได้โดยใช้คำสังต่อไปนี้
$[คำสั่ง(instruction)] --help
ex.
$tar --help
จะมีรายละเอียดของ option ที่ต่อท้ายคำสั่ง tar ว่ามีความหมายอย่างไร
เช่น
-x = extract files from an archive
-f = use archive file or device ARCHIVE

1 comment:

Anonymous said...

Hello. This post is likeable, and your blog is very interesting, congratulations :-). I will add in my blogroll =). If possible gives a last there on my blog, it is about the Servidor, I hope you enjoy. The address is http://servidor-brasil.blogspot.com. A hug.