pkgng
- How to migrate from the old to the new
従来のパッケージ管理システムからpkg(8)へ移行するには、
次のようにpkg2ngコマンドを使用します。一度もpkg(8)コマンドを実行したことがない場合には、 まず次のようにpkg(8)を実行してプログラムをインストールしてからpkg2ngを実行します。 # pkg The package management tool is not yet installed on your system. Do you want to fetch and install it now? [y/
N]: y Bootstrapping pkg please wait Installing pkg-1. 0.b17... done If you are upgrading from the old package format, first run: $ pkg2ng usage: pkg [-v] [-d] [-j |-c ] [ ] Global options supported: -d Increment debug level -j Execute pkg(1) inside a jail(8) -c Execute pkg(1) inside a chroot(8) -v Display pkg(1) version Commands supported: add Registers a package and installs it on the system audit Reports vulnerable packages autoremove Removes orphan packages backup Backup and restore the local package database check Check for missing dependencies and database consistency clean Cleans old packages from the cache create Creates software package distributions delete Deletes packages from the database and the system fetch Fetches packages from a remote repository help Displays help information info Displays information for installed packages install Installs packages from remote package repositories query Query information for installed packages search Performs a search in remote package repositories set Modify local database informations register Registers a package into the local package database remove Deletes packages from the database and the system repo Creates a package database repository rquery Query information from the remote repository shell Open a debug shell shlib Displays which package links against a specific shared library stats Display package database statistics update Updates remote package repository databases updating Displays UPDATING information for a package upgrade Performs upgrades of package software distributions version Summarize installed versions of packages which Displays which package installed a specific file For more information on the different commands see 'pkg help '. # pkg2ng Installing perl-5. 14. 2_ 2... done Installing topless-1. 52... done # /var/
db/ pkg/の下は、 Ports Collectionやpkg_*系コマンドでインストールした段階では次のようになっています。従来のメタデータ保持形式でデータが保持されています。 # pwd /var/
db/ pkg # ls -al total 16 drwxr-xr-x 4 root wheel 512 Aug 4 04:40 . drwxr-xr-x 8 root wheel 512 Aug 4 12:02 .. drwxr-xr-x 2 root wheel 512 Aug 4 04:39 perl-5. 14. 2_ 2 drwxr-xr-x 2 root wheel 512 Aug 4 04:40 topless-1. 52 # pkg2ngを実行したあとは次のようにpkg(8)用のSQLiteデータベースが作成されます。
# pwd /var/
db/ pkg # ls -al total 848 drwxr-xr-x 4 root wheel 512 Aug 4 04:45 . drwxr-xr-x 8 root wheel 512 Aug 4 12:02 .. -rw-r--r-- 1 root wheel 807936 Aug 4 04:45 local. sqlite drwxr-xr-x 2 root wheel 512 Aug 4 04:39 perl-5. 14. 2_ 2 drwxr-xr-x 2 root wheel 512 Aug 4 04:40 topless-1. 52 # pkg2ngを実行して移行したあとはpkg infoなどのコマンドで移行したソフトウェアを確認できるようになります。
# pkg info perl-5.
14. 2_ 2 Practical Extraction and Report Language pkg-1. 0.b17 New generation package manager topless-1. 52 Display command output on the whole screen like "top" # 移行したあとにはインストールされているパッケージの情報を確認できるようになります。一旦pkg updateを実行してリモートリポジトリを取得した後、
pkg statコマンドを実行します。 # pkg update Updating remote repository repo.
txz 100% 9695KB 334. 3KB/ s 445. 1KB/ s 00:29 # pkg stat Local package database: Installed packages: 3 Disk space occupied: 52 MB Remote package database(s): Number of repositories: 1 Packages available: 19543 Unique packages: 19543 Total size of packages: 64 GB # サブコマンドの名称などは、
最後発のパッケージ管理システムだけあってわかりやすい名称に統一されています。 pkg(8)で提供されるパッケージは基本的に週に1回のペースで最新のPorts Collectionに追従していくことになっています。今後は、
コンパイル時にオプションを指定する必要があったり、 カスタマイズする必要があるものに関してはPorts Collectionを使い、 それ以外はpkg(8)を利用するといった使い方が主流になっていくのではないかとみられます。ライトユーザはほぼすべてpkg(8)を使うことになるとみられます。 pkg(8)が特に興味深いのは、
これが完全にPorts Collectionをベースとした新しいパッケージ管理システムであるということです。ソースコードからビルドするためさまざまなカスタマイズができ、 常に最新版でありつづけるというPorts Collectionの利点を生かしながら、 バイナリベースのパッケージ管理システムを実現しています。このレベルで双方の要望を実現しているアプリケーション管理システムはほかには少なく、 FreeBSD 10以降を特徴付ける機能になるものと見られます。