LoginSignup
8
8

More than 5 years have passed since last update.

必要な言語ファイルだけ取得で apt-get の時間を短縮する

Posted at

Debian / Ubuntu は多くの言語に翻訳されています。
これは利点ではあるのですが、何も設定をしないと全ての翻訳情報を
取得してしまうため Update の時間が長くなってしまうという欠点があります。

自分が使うものだけを取得するように設定すると時間を短縮することができます。

1. 既に取得してしまっている翻訳情報の削除

一度も apt-get update または aptitude update を実行していない場合は、この操作はスキップできます

既に apt-get update または aptitude update を実行している場合は、
国際化(翻訳とか)の情報も取得してしまっているので、まずはそれらを削除します。

国際化情報が残っていると、apt の設定を変更しても、
更新情報を取得しようとしてしまうからです。

cd /var/lib/apt/list
sudo rm -f *Translation*

2. 使用する言語の設定

/etc/apt/apt.conf に「使用する言語はこれだ!」と設定します。
エディタで /etc/apt/apt.conf を開いて(ファイルがなければ作成)次の行を追記します。

編集・保存には root 権限が必要です。

APT::Acquire::Language "ja_JP";
APT::Acquire::Language "en";
APT::Acquire::Translation "ja_JP";

3. パッケージデータベース更新

お約束ですね。

apt-get update

または

aptitude update

を実行してパッケージデータベースの更新をしてください。
指定した言語以外の国際化情報は取得しなくなっています。

4. 実際どうなるの?

設定前に実行した aptitude update ではこうなっていました。

$ sudo aptitude update
取得: 1 http://ftp.jp.debian.org wheezy InRelease [207 kB]
取得: 2 http://ftp.jp.debian.org wheezy/main Sources/DiffIndex [7,876 B]
Hit http://ftp.jp.debian.org wheezy/contrib Sources/DiffIndex        
取得: 3 http://ftp.jp.debian.org wheezy/main amd64 Packages/DiffIndex [7,876 B]
Hit http://ftp.jp.debian.org wheezy/contrib amd64 Packages/DiffIndex  
Hit http://ftp.jp.debian.org wheezy/contrib Translation-en/DiffIndex
取得: 4 http://ftp.jp.debian.org wheezy/main Translation-ja/DiffIndex [7,819 B]
取得: 5 http://ftp.jp.debian.org wheezy/main Translation-en/DiffIndex [7,876 B]
Hit http://ftp.jp.debian.org wheezy/main Translation-fi/DiffIndex
取得: 6 http://ftp.jp.debian.org wheezy/main Translation-pl/DiffIndex [7,819 B]
Hit http://ftp.jp.debian.org wheezy/main Translation-sv/DiffIndex
Hit http://ftp.jp.debian.org wheezy/main Translation-sk/DiffIndex
Hit http://ftp.jp.debian.org wheezy/main Translation-hr/DiffIndex
Hit http://ftp.jp.debian.org wheezy/main Translation-ru/DiffIndex
Hit http://ftp.jp.debian.org wheezy/main Translation-vi/DiffIndex
Hit http://ftp.jp.debian.org wheezy/main Translation-eu/DiffIndex
Hit http://ftp.jp.debian.org wheezy/main Translation-sr/DiffIndex
取得: 7 http://ftp.jp.debian.org wheezy/main Translation-fr/DiffIndex [7,819 B]
取得: 8 http://ftp.jp.debian.org wheezy/main Translation-da/DiffIndex [7,819 B]
取得: 9 http://ftp.jp.debian.org wheezy/main Translation-cs/DiffIndex [7,819 B]
取得: 10 http://ftp.jp.debian.org wheezy/main Translation-ro [1,455 B]
Hit http://ftp.jp.debian.org wheezy/main Translation-eo/DiffIndex
Hit http://ftp.jp.debian.org wheezy/main Translation-hu/DiffIndex
取得: 11 http://ftp.jp.debian.org wheezy/main Translation-nb [1,302 B]
取得: 12 http://ftp.jp.debian.org wheezy/main Translation-uk/DiffIndex [7,819 B]
Hit http://ftp.jp.debian.org wheezy/main Translation-km/DiffIndex            
Hit http://ftp.jp.debian.org wheezy/main Translation-ko/DiffIndex
Hit http://ftp.jp.debian.org wheezy/main Translation-id/DiffIndex
Hit http://ftp.jp.debian.org wheezy/main Translation-es/DiffIndex
Hit http://ftp.jp.debian.org wheezy/main Translation-zh/DiffIndex
取得: 13 http://ftp.jp.debian.org wheezy/main Translation-it/DiffIndex [7,876 B]
Hit http://ftp.jp.debian.org wheezy/main Translation-ca/DiffIndex            
Hit http://ftp.jp.debian.org wheezy/main Translation-pt/DiffIndex
Hit http://ftp.jp.debian.org wheezy/main Translation-nl/DiffIndex
取得: 14 http://ftp.jp.debian.org wheezy/main Translation-de/DiffIndex [7,819 B]
取得: 15 http://ftp.jp.debian.org wheezy/main 2012-09-06-0212.33.pdiff [5,423 B]
取得: 16 http://ftp.jp.debian.org wheezy/main amd64 2012-09-06-0212.33.pdiff [10.7 kB]
取得: 17 http://ftp.jp.debian.org wheezy/main 2012-09-06-1412.31.pdiff [427 B]
取得: 18 http://ftp.jp.debian.org wheezy/main 2012-09-06-0212.33.pdiff [5,423 B]
取得: 19 http://ftp.jp.debian.org wheezy/main 2012-09-06-0212.33.pdiff [937 B]    
取得: 20 http://ftp.jp.debian.org wheezy/main 2012-09-06-1412.31.pdiff [737 B]    
取得: 21 http://ftp.jp.debian.org wheezy/main 2012-09-06-1412.31.pdiff [909 B]    
取得: 22 http://ftp.jp.debian.org wheezy/main 2012-09-06-1412.31.pdiff [6,029 B]  
取得: 23 http://ftp.jp.debian.org wheezy/main 2012-09-06-1412.31.pdiff [33 B]                  
取得: 24 http://ftp.jp.debian.org wheezy/main 2012-09-06-1412.31.pdiff [1,419 B]  
取得: 25 http://ftp.jp.debian.org wheezy/main 2012-09-06-1412.31.pdiff [1,747 B]  
取得: 26 http://ftp.jp.debian.org wheezy/main 2012-09-06-1412.31.pdiff [1,581 B]  
取得: 27 http://ftp.jp.debian.org wheezy/main amd64 2012-09-06-0212.33.pdiff [10.7 kB]
取得: 28 http://ftp.jp.debian.org wheezy/main 2012-09-06-1412.31.pdiff [427 B]
取得: 29 http://ftp.jp.debian.org wheezy/main 2012-09-06-0212.33.pdiff [937 B]
取得: 30 http://ftp.jp.debian.org wheezy/main 2012-09-06-1412.31.pdiff [737 B]
取得: 31 http://ftp.jp.debian.org wheezy/main 2012-09-06-1412.31.pdiff [909 B]
取得: 32 http://ftp.jp.debian.org wheezy/main 2012-09-06-1412.31.pdiff [6,029 B]
取得: 33 http://ftp.jp.debian.org wheezy/main 2012-09-06-1412.31.pdiff [33 B]
取得: 34 http://ftp.jp.debian.org wheezy/main 2012-09-06-1412.31.pdiff [1,419 B]  
取得: 35 http://ftp.jp.debian.org wheezy/main 2012-09-06-1412.31.pdiff [1,747 B]  
取得: 36 http://security.debian.org wheezy/updates InRelease [87.8 kB]
取得: 37 http://ftp.jp.debian.org wheezy/main 2012-09-06-1412.31.pdiff [1,581 B]
取得: 38 http://security.debian.org wheezy/updates/main Sources [937 B]                                          取得: 39 http://security.debian.org wheezy/updates/contrib Sources [14 B]                                        取得: 40 http://security.debian.org wheezy/updates/main amd64 Packages [979 B]                                   取得: 41 http://security.debian.org wheezy/updates/contrib amd64 Packages [14 B]                                 Ign http://security.debian.org wheezy/updates/contrib Translation-ja_JP                                          Ign http://security.debian.org wheezy/updates/contrib Translation-ja
Ign http://security.debian.org wheezy/updates/contrib Translation-en
Ign http://security.debian.org wheezy/updates/contrib Translation-fi
Ign http://security.debian.org wheezy/updates/contrib Translation-pl
Ign http://security.debian.org wheezy/updates/contrib Translation-sv
Ign http://security.debian.org wheezy/updates/contrib Translation-sk
Ign http://security.debian.org wheezy/updates/contrib Translation-hr
Ign http://security.debian.org wheezy/updates/contrib Translation-ru
Ign http://security.debian.org wheezy/updates/contrib Translation-vi
Ign http://security.debian.org wheezy/updates/contrib Translation-eu
Ign http://security.debian.org wheezy/updates/contrib Translation-sr
Ign http://security.debian.org wheezy/updates/contrib Translation-fr
Ign http://security.debian.org wheezy/updates/contrib Translation-da
Ign http://security.debian.org wheezy/updates/contrib Translation-cs
Ign http://security.debian.org wheezy/updates/contrib Translation-ro
Ign http://security.debian.org wheezy/updates/contrib Translation-eo
Ign http://security.debian.org wheezy/updates/contrib Translation-hu
Ign http://security.debian.org wheezy/updates/contrib Translation-nb
Ign http://security.debian.org wheezy/updates/contrib Translation-uk
Ign http://security.debian.org wheezy/updates/contrib Translation-km
Ign http://security.debian.org wheezy/updates/contrib Translation-ko
Ign http://security.debian.org wheezy/updates/contrib Translation-id
Ign http://security.debian.org wheezy/updates/contrib Translation-es
Ign http://security.debian.org wheezy/updates/contrib Translation-zh
Ign http://security.debian.org wheezy/updates/contrib Translation-it
Ign http://security.debian.org wheezy/updates/contrib Translation-ca
Ign http://security.debian.org wheezy/updates/contrib Translation-pt
Ign http://security.debian.org wheezy/updates/contrib Translation-nl
Ign http://security.debian.org wheezy/updates/contrib Translation-de
Ign http://security.debian.org wheezy/updates/main Translation-ja_JP
Ign http://security.debian.org wheezy/updates/main Translation-ja
Ign http://security.debian.org wheezy/updates/main Translation-en
Ign http://security.debian.org wheezy/updates/main Translation-fi
Ign http://security.debian.org wheezy/updates/main Translation-pl
Ign http://security.debian.org wheezy/updates/main Translation-sv
Ign http://security.debian.org wheezy/updates/main Translation-sk
Ign http://security.debian.org wheezy/updates/main Translation-hr
Ign http://security.debian.org wheezy/updates/main Translation-ru
Ign http://security.debian.org wheezy/updates/main Translation-vi
Ign http://security.debian.org wheezy/updates/main Translation-eu
Ign http://security.debian.org wheezy/updates/main Translation-sr
Ign http://security.debian.org wheezy/updates/main Translation-fr
Ign http://security.debian.org wheezy/updates/main Translation-da
Ign http://security.debian.org wheezy/updates/main Translation-cs
Ign http://security.debian.org wheezy/updates/main Translation-ro
Ign http://security.debian.org wheezy/updates/main Translation-eo
Ign http://security.debian.org wheezy/updates/main Translation-hu
Ign http://security.debian.org wheezy/updates/main Translation-nb
Ign http://security.debian.org wheezy/updates/main Translation-uk
Ign http://security.debian.org wheezy/updates/main Translation-km
Ign http://security.debian.org wheezy/updates/main Translation-ko
Ign http://security.debian.org wheezy/updates/main Translation-id
Ign http://security.debian.org wheezy/updates/main Translation-es
Ign http://security.debian.org wheezy/updates/main Translation-zh
Ign http://security.debian.org wheezy/updates/main Translation-it
Ign http://security.debian.org wheezy/updates/main Translation-ca
Ign http://security.debian.org wheezy/updates/main Translation-pt
Ign http://security.debian.org wheezy/updates/main Translation-nl
Ign http://security.debian.org wheezy/updates/main Translation-de
Fetched 416 kB in 1分 15秒 (5,538 B/s)

設定後はこうなりました。

$ sudo aptitude update
Hit http://ftp.jp.debian.org wheezy InRelease
Hit http://ftp.jp.debian.org wheezy/main Sources/DiffIndex 
Hit http://ftp.jp.debian.org wheezy/contrib Sources/DiffIndex
Hit http://ftp.jp.debian.org wheezy/main amd64 Packages/DiffIndex
Hit http://ftp.jp.debian.org wheezy/contrib amd64 Packages/DiffIndex
取得: 1 http://ftp.jp.debian.org wheezy/contrib Translation-en/DiffIndex [5,197 B]
取得: 2 http://ftp.jp.debian.org wheezy/main Translation-en/DiffIndex [7,876 B]
Hit http://security.debian.org wheezy/updates InRelease
Hit http://security.debian.org wheezy/updates/main Sources
Hit http://security.debian.org wheezy/updates/contrib Sources
Hit http://security.debian.org wheezy/updates/main amd64 Packages
Hit http://security.debian.org wheezy/updates/contrib amd64 Packages
Ign http://security.debian.org wheezy/updates/contrib Translation-ja_JP                                          Ign http://security.debian.org wheezy/updates/contrib Translation-en                                             Ign http://security.debian.org wheezy/updates/main Translation-ja_JP                                             Ign http://security.debian.org wheezy/updates/main Translation-en                                                Fetched 13.1 kB in 7秒 (1,642 B/s)

すっきり >ω<ノ

8
8
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8