ปัญหาของคนที่ใช้คำสั่ง apt-get นั่นก็คือสิ้นเปลืองค่าอาหาร เพราะต้องนั่งรอนานแสนนานกว่าจะเสร็จสิ้นในแต่ละกระบวนการ การหาขนมขบเคี้ยวฆ่าเวลาจึงเป็นเรื่องปกติ นั่นไงหล่ะปัญหาของการเปลืองค่าอาหาร ฮ่าๆๆๆ เอาเป็นว่าเข้าเรื่องเลยละกันนะครับ apt-fast นั้นเป็นสคริปต์คำสั่งแบบเดียวกับ apt-get แต่เผอิญว่ามีความเร็วกว่าหลายขุมเลยทีเดียว ดังนั้นจึงมักเป็นที่หมายปองของเหล่าผู้ใช้ทั่วยุทธจักรที่ต้องการครอบครองมัน แต่ก็อีกนั่นแหละครับใช่ว่ามันจะมาพร้อมกับระบบเดิมๆเลยซะเมื่อไหร่ ดังนั้นคนที่อยากใช้คำสั่ง apt-fast บน Ubuntu 12.04 LTS จึงต้องทำความเข้าใจมันก่อนว่าเพราะอะไรมันจึงได้รวดเร็วยิ่งนัก
เพื่อไม่ให้เป็นการเสียเวลาก็เริ่มกันเลยดีกว่าครับ เริ่มแรกก็เปิด Terminal ขึ้นมาจากนั้นก็ทำให้เป็น root ไปซะ (เป็นความชอบส่วนตัวผมนะ ขี้เกียจพิมพ์ sudo อิอิ)
1. พิมพ์คำสั่งเพื่อติดตั้ง axel ที่เป็นความลับเบื้องหลังของเจ้า apt-fast ดังนี้
apt-get update && apt-get install axel
2. จากนั้นก็ทำการบูชาอาราธนา apt-fast เข้ามาเก็บไว้ที่เครื่องเราก่อน โดยพิมพ์คำสั่งดังนี้
wget http://www.mattparnell.com/linux/apt-fast/apt-fast.sh -U ''
3. ทำการส่งมันไปสู่ที่ชอบๆด้วยคำสั่ง
mv apt-fast.sh /usr/bin/apt-fast
4. ต่อไปก็ทำการเปิดการทำงานให้เป็น executable file ด้วยคำสั่ง
chmod +x /usr/bin/apt-fast
5. เสร็จแล้วจากนั้นก็ลองวิชา ลองพิมพ์คำสัั่ง apt-fast update ดูสิ ว๊าวๆๆๆ ถ้ายังไม่เห็นผลลอง install package อื่นๆเล่นๆดู อิอิ คุณอาจจะเห็นหน้าต่าง Terminal เป็นแบบนี้
แถมครับ
Source code : apt-fast
# !/bin/sh
# apt-fast v0.03 by Matt Parnell http://www.mattparnell.com, this thing is fully open-source
# if you do anything cool with it, let me know so I can publish or host it for you
# contact me at admin@mattparnell.com
# Special thanks
# Travis/travisn000 - support for complex apt-get commands
# Allan Hoffmeister - aria2c support
# Abhishek Sharma - aria2c with proxy support
# Richard Klien - Autocompletion, Download Size Checking (made for on ubuntu, untested on other distros)
# Patrick Kramer Ruiz - suggestions - see Suggestions.txt
# Sergio Silva - test to see if axel is installed, root detection/sudo autorun
# Use this just like apt-get for faster package downloading.
# Check for proper priveliges
[ "`whoami`" = root ] || exec sudo "$0" "$@"
# Test if the axel is installed
if [ ! -x /usr/bin/axel ]
then echo "axel is not installed, perform this?(y/n)"
read ops
case $ops in
y) if apt-get install axel -y --force-yes
then echo "axel installed"
else echo "unable to install the axel. you are using sudo?" ; exit
fi ;;
n) echo "not possible usage apt-fast" ; exit ;;
esac
fi
# If the user entered arguments contain upgrade, install, or dist-upgrade
if echo "$@" | grep -q "upgrade\|install\|dist-upgrade"; then
echo "Working...";
# Go into the directory apt-get normally puts downloaded packages
cd /var/cache/apt/archives/;
# Have apt-get print the information, including the URI's to the packages
# Strip out the URI's, and download the packages with Axel for speediness
# I found this regex elsewhere, showing how to manually strip package URI's you may need...thanks to whoever wrote it
apt-get -y --print-uris $@ | egrep -o -e "(ht|f)tp://[^\']+" > apt-fast.list && cat apt-fast.list | xargs -l1 axel -a
# Perform the user's requested action via apt-get
apt-get $@;
echo -e "\nDone! Verify that all packages were installed successfully. If errors are found, run apt-get clean as root and try again using apt-get directly.\n";
else
apt-get $@;
fi
ขอบคุณภาพประกอบจาก
- http://www.patsonic.com/images/2011/05/fast-five.jpg
- https://encrypted-tbn0.google.com/images?q=tbn:ANd9GcTmEPQpmt_J7BiIt5UKm7xYdXXlQn8f2a6UzZLETYui_uxe5baM
- https://encrypted-tbn1.google.com/images?q=tbn:ANd9GcQDWwzulrqtMUH42B3ZvqGSKhjvEaBPF-POWB-vqDAWnebMMV4


No comments:
Post a Comment