最適化apt-get。 パッケージのダウンロード速度を向上させます

こんにちは



最近、より高速なインターネット料金プランに切り替えました。 いつものように、私はシステムを起動し、更新はリポジトリから始まりました。 しかし、速度の増加は目立ちませんでした。



外国の小冊子の記録を偶然見つけたとき、標準のダウンロードツールの代わりにaxelユーティリティを使用している記事を見ました。









.



.



(

25-30k),

wget

.

, . apt-get?

axel: sudo apt-get install axel

- .








ダウンロードするコマンドはwgetと同じです



axel site.com/file.bin







次に、次の内容でapt-fastファイルを作成します。



#!/bin/sh

#apt-fast by Matt Parnell 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








実行権を与えます: chmod + x apt-fast

そして、便宜上/ usr / binにコピーします: sudo cp apt-fast / usr / bin



更新するには、 sudo apt-fast upgradeと書きます。

パッケージをダウンロードしてインストールするには、 sudo apt-fast install package_nameと書きます。



速度の向上は本当にまともです。 これは、リポジトリのチャネル幅が最大ダウンロード速度に対して十分でない場合に、高速ネットワーク接続を備えたマシンで特に感じられます。



webupd8.orgに基づく



画像







All Articles