http://blog.glidenote.com
に移転しました

pacoでソースから導入したパッケージを管理する


paco – a source code pacKAGE oRGANIZER for Unix/Linux

CentOSにおいてyumからインストールできないソフトは、管理しやすいようソースからrpmを作成するのが妥当だと思いますが、わざわざrpmを作成するまでも無い場合などソースからインストールしたソフトを管理する際は、pacoを利用するのが便利です。

pacoとは「ソースからインストールしたソフトを管理する為」のソフトです。ソースからインストールしたソフトは管理が難しく、サーバ運用においてかなり手間がかかるので、pacoを利用しましょう。

pacoを利用するメリットは

  • ソースからインストールしたソフトが分かる。
  • いつインストールしたのか分かる
  • インストールした時のconfigureのオプションが何か分かる
  • コマンド一発でアンインストールできる

などです。

導入環境はCentOS5.4で、作業の流れは下記のような感じです。

  • ソースのダウンロードとインストール
  • pacoでパッケージを管理
  • 一般ユーザの環境でpacoを導入

ソースのダウンロードとインストール

http://sourceforge.net/projects/paco/files/から最新版をダウンロードしましょう。2010年5月17日現在の最新版2.0.7です。

wget http://sourceforge.net/projects/paco/files/paco/2.0.7/paco-2.0.7.tar.gz/download
tar zxvf paco-2.0.7.tar.gz
cd paco-2.0.7/
./configure

下記のエラーがでて、止まってしまったので調査。

checking for GTKMM... Package gtkmm-2.4 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtkmm-2.4.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtkmm-2.4' found
configure: error: Package requirements (gtkmm-2.4 >= 2.12) were not met:

ググってみるとgtkmm系のライブラリが足りないとのことですが、GUIを利用しないので –disable-gpaco を付加して解決。

./configure --disable-gpaco
make
make install

ちなみにconfigureのオプションは下記のような感じです。

paco - the source code pacKAGE oRGANIZER
 
Usage:
  paco [OPTIONS] <packages|files|command>
 
General options:
  -L, --logdir=DIR         Use DIR as the log directory.
  -a, --all                Apply to all logged packages (not with -r).
  -v, --verbose            Verbose output (-vv produces debugging messages).
  -h, --help               Display this help message.
      --version            Display version information.
 
Database maintenance options:
  -u, --update             Update the log of the package.
  -U, --unlog              Remove the log of the package.
 
General list options:
  -b, --block-size=SIZE    Use blocks of SIZE bytes for the sizes.
  -k, --kilobytes          Like '--block-size=1024'.
  -R, --reverse            Reverse order while sorting.
      --sort=WORD          Sort by WORD: 'name', 'date' (or 'time'), 'size',
                           'files', 'missing-size' or 'missing-files'.
  -t, --total              Print totals.
 
Package list options:
  -1, --one-column         Print one package per line.
  -F                       Print the number of installed files.
  -M                       Print the number of missing files.
  -C                       Print the number of shared files.
  -d, --date               Print the installation day (-dd prints the hour too).
  -s, --size               Print the installed size of each package.
  -n, --missing-size       Print the missing size of each package.
 
File list options:
  -f, --files              List installed files.
  -m, --missing-files      List missing files.
  -c, --shared             With -f and/or -m: List only the shared files.
  -N, --non-shared         With -f and/or -m: List only the non shared files.
  -w, --who-shares         With -c: Print the packages that share each file.
  -y, --symlinks           Print the contents of symbolic links.
  -z, --no-package-name    Don't print the name of the package.
  -s, --size               Show the size of each file.
 
Information options:
  Note: Information may be not available for all packages.
  -i, --info               Print package information.
  -o, --configure-options  Print the options passed to configure when the
                           package was installed.
  -q, --query, --owner     Query for the packages that own one or more files.
 
Remove options:
  -r, --remove             Remove the (non shared) files of the package. '-rr'
                           forces the package to be removed from the database.
      --remove-shared      Remove also the shared files.
  -B, --batch              Do not ask for confirmation when removing.
  -e, --skip=PATH:...      Do not remove files in PATHs (see the man page).
 
Log options:
  -l, --log                Enable log mode. See the man page.
  -p, --package=PKG        Name of the package to log.
  -D, --dirname            Use the name of the current directory as the name
                           of the package.
  -+, --append             With -p or -D: If the package is already logged,
                           append the list of files to its log.
      --log-missing        Do not skip missing files.
      --ignore-shared      With -p or -D: Do not log the shared files.
      --ignore-errors      Do not exit if the install command fails.
  -I, --include=PATH:...   List of paths to scan.
  -E, --exclude=PATH:...   List of paths to skikp.
 
Note: The package list mode is enabled by default.


pacoでパッケージを管理

pacoをインストールが完了したら、まずpaco自身をpacoで管理しましょう。

make logme

ちゃんとpacoで管理されているか確認

paco -ao
 
# こんな感じの出力結果
# paco-2.0.7:
# --disable-gpaco

パッケージをインストールする場合はmake install の前にpacoをつけるだけです。ディレクトリ名のバージョン番号を利用したいのでオプションに-Dをつけます。

paco -D make install

パッケージリストの更新

paco -ua

pacoで管理しているパッケージの確認

paco -1a

パッケージの削除

paco -r <package>

どこに何がインストールされたか確認する。

paco -f <package>
paco -f paco-2.0.7
paco-2.0.7:
/usr/local/share/paco/README
/usr/local/lib/libpaco-log.a
/usr/local/lib/libpaco-log.la
/usr/local/lib/libpaco-log.so
/usr/local/lib/libpaco-log.so.0
/usr/local/lib/libpaco-log.so.0.0.0
/usr/local/bin/paco
/usr/local/etc/pacorc
/usr/local/lib/pkgconfig/paco.pc
/usr/local/share/man/man5/pacorc.5
/usr/local/share/man/man8/paco.8
/usr/local/share/paco/faq.txt
/usr/local/share/paco/pacorc

一度インストールしたソフトも、展開したtarballが残っていれば

paco -D make install

で管理が出来るので、便利す。

一般ユーザの環境でpacoを導入

root権限のないサーバや、新しいバーションの検証などの場合は、いきなりrootでインストールするのではなく、一般ユーザの領域にインストールするのが適当だと思います。その場合にもpacoを利用して管理すると便利です。一般ユーザのホームディレクトリにpacoをインストールする場合は、configureでインストール場所を変更するだけです。

pacoは$HOME/local/bin/pacoという形でインストール。 –with-paco-logdirがないと、デフォルトの/var/log/pacoに書き込み権限がないよとエラーになるので$HOME/localを指定。

./configure --prefix=$HOME/local --disable-gpaco --with-paco-logdir=$HOME/local
make
make install

pacoのパスが見つからず、make logmeが利用できないので、下記コマンドでpaco自身を管理で対応。

paco -D make install

インストール後は、$HOME/local/binにpathを通すかエイリアスを作成しましょう。エイリアスで解決する場合は下記のような感じです。

echo "alias paco='$HOME/local/bin/paco'" >> $HOME/.bashrc
echo "alias paco='$HOME/local/bin/paco'" >> $HOME/.zshrc

参考サイト。
"make install"したソフトウェアを管理できる超便利ツール「Paco」 – RX-7乗りの適当な日々

Write a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

About

@glidenote

このブログは個人的なものです。ここで述べられている内容は私の個人的な意見に基づくものであり、私の雇用者に一切の関係はありません