Fórum Ubuntu CZ/SK

Ostatní => Tipy a triky pro Linux => Téma založeno: petrakis 29 Listopadu 2009, 07:18:56

Název: Akcelerace apt-get-u pres axel
Přispěvatel: petrakis 29 Listopadu 2009, 07:18:56
Nekdy se stava ze stahovani upgradu anebo instalacnich souboru je pomale.Stava se to z duvodu, protoze nektere FTP servery limitujou rychlost jednotlivych spojeni. Akcelerator Axel zpusobuje otevreni vice spojeni najednou a jako pisou autori dosahuje rychlost az 26-krat vetsi. Na zaver diky Matt-u Parnellovi mame script ktery nam vsechno zaridi.

1.) nejdriv potrebujeme mit instalovanej Axel
Kód: [Vybrat]
sudo apt-get install axel
2,) nasledne si vytvorime prazdnej soubor kterej pojmenujeme apt-fast a vlozime do nej
Kód: [Vybrat]
#!/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

nastavime souboru prava
Kód: [Vybrat]
chmod +x apt-fast
a premistime ho do slozky /usr/bin


vysledek je ze instalaci jakyhokoliv balicku muzeme ted provadet zpusobem
Kód: [Vybrat]
sudo apt-fast install novybalicek

anebo updaty s upgradama

Kód: [Vybrat]
sudo apt-fast update && sudo apt-fast dist-upgrade
Na zaver podekovani za script: http://www.mattparnell.com/projects/apt-fast-and-axel-roughly-26x-faster-apt-get-installations-and-upgrades.html (http://www.mattparnell.com/projects/apt-fast-and-axel-roughly-26x-faster-apt-get-installations-and-upgrades.html)



[attachment deleted by admin]