Qbilinux 日記

Linux に関係することだけではなく,最近は一般的なコンピュータやガジェット関係についても記載してます.

debian で複数台のマシンのパッケージを同期させる

手元に debian で使ってるマシンが複数台あるんだけど,微妙に入ってるパッケージが違っててちょっと不便.

ということで,複数台のマシンのパッケージを同じにする作業を.

ネット検索すると,いろいろと出てきますがどれもなんだかうまく行かない感じなので,メモとして書いておきます.

一番確実なのはマニュアルを見ること.dpkg と apt-get のマニュアルね.

で,dpkg のマニュアルに下記の記述がありますので,基本的にこれをやればオッケーです.

       To make a local copy of the package selection states:
            dpkg --get-selections >myselections

       You  might transfer this file to another computer, and after having updated
       the available file there with your package manager frontend of choice  (see
       https://wiki.debian.org/Teams/Dpkg/FAQ for more details), for example:
            apt-cache dumpavail | dpkg --merge-avail
       or with dpkg 1.17.6 and earlier:
            avail=`mktemp`
            apt-cache dumpavail >"$avail"
            dpkg --merge-avail "$avail"
            rm "$avail"
       you can install it with:
            dpkg --clear-selections
            dpkg --set-selections <myselections

       Note  that  this will not actually install or remove anything, but just set
       the selection state on the requested packages. You  will  need  some  other
       application  to  actually  download and install the requested packages. For
       example, run apt-get dselect-upgrade.

上記の作業をやってほぼ同期できた感じ.

一点だけ注意点.

apt の source.list は同期してくれませんので手作業で設定をあわせておく必要があります.backports や,その他の apt ソースを使っている場合には上記作業をする前に設定をしておきましょう.そうしないと,インストール途中 (apt-get dselect-upgrade 実行時かな) でパッケージが見つからずにエラーになるかと思います.はい.

そんなところかな.