Axel is a command line application which accelerates HTTP/FTP downloads by using multiple sources for one file. For example, some FTP sites limit the speed of each connection, therefore opening more than one connection at a time multiplies the allowable bandwidth.
What if we could use a bash script to use "apt-get" with Axel so the "apt-get" download speed would increase dramatically? Well, you can, thanks to Matt Parnell who has created a bash script which does just that. The script works with any Linux distribution which uses "apt-get" (Debian, Ubuntu, etc.).
What if we could use a bash script to use "apt-get" with Axel so the "apt-get" download speed would increase dramatically? Well, you can, thanks to Matt Parnell who has created a bash script which does just that. The script works with any Linux distribution which uses "apt-get" (Debian, Ubuntu, etc.).
Before using the script, you must install Axel:
Then create an empty file called apt-fast and paste this:
sudo apt-get install axel
Then create an empty file called apt-fast and paste this:
#!/bin/sh
#apt-fast by Matt Parnell http://www.mattparnell.com , this thing is FOSS
#please feel free to suggest improvements to admin@mattparnell.com
# Use this just like apt-get for faster package downloading. Make sure to have axel installed
#If the first user entered variable string contains apt-get, and the second string entered is either install or dist-upgrade
if echo "$1" | grep -q "[upgrade]" || echo "$2" | grep -q "[install]" || echo "$2" | grep -q "[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
apt-get -y --print-uris $1 $2 $3 $4 > debs.list;
#Strip out the URI's, and download the packages with Axel for speediness
egrep -o -e "(ht|f)tp://[^\']+" debs.list | xargs -l1 axel -a;
#Perform the user's reqested action via apt-get
apt-get -y $1 $2 $3 $4;
echo "Done! Make sure and check to see that the packages all were installed properly. If a package is erred, run sudo apt-get autoclean and try installing it again without the use of this script.";
elif echo "$1" | grep -q "[*]"; then
apt-get $1;
else
echo "Sorry, but you appear to be entering invalid options. You must use apt-get and one of apt-get's options in order to use this script.";
fi
Then use the terminal to navigate to where you created the script and run this command:
For easier usage, you can move it to the /usr/bin folder.
Now, instead of using: sudo apt-get install PACKAGE_NAME, use sudo apt-fast install PACKAGE_NAME or upgrade or dist-upgrade - it also works with those operations.
I must say I have obviously tested the script and indeed, it works really fast. I don't know if it's 26x faster as the author claims, but the speed improvement, well, let's just say you won't need to measure it to notice the difference!
chmod +x apt-fast
For easier usage, you can move it to the /usr/bin folder.
Now, instead of using: sudo apt-get install PACKAGE_NAME, use sudo apt-fast install PACKAGE_NAME or upgrade or dist-upgrade - it also works with those operations.
I must say I have obviously tested the script and indeed, it works really fast. I don't know if it's 26x faster as the author claims, but the speed improvement, well, let's just say you won't need to measure it to notice the difference!
Update: a new apt-fast version is out, now with full apt-get syntax replacement
Special thanks to Mahdi for suggesting this script!
Message from Testking: We provide high quality SY0-201 material and 70-680 practice exam so you will pass 642-902 on first attempt for sure.
Tidak ada komentar:
Posting Komentar