pkgng
- How to use the pkgng
FreeBSD 10-CURRENTのデフォルトのパッケージ管理システムが、
開発が進められてきた次世代パッケージ管理システムpkg(8)へ置き換わりました。pkg(8)はapt-getやyumのようにバイナリパッケージレベルでパッケージ管理を実現するための仕組みです。FreeBSDサーバのアプリケーション管理を簡素化する機能として期待されます。従来のpkg_*系管理コマンドはすべてpkg(8)に変更となります。 はじめてpkg(8)を実行すると次のように最初のインストール処理が実施されたあと、
pkg(8)の使い方の一覧が表示されます。 # pkg 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 <jail name or id>|-c <chroot path>] <command> [<args>] 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 <command>'. # この段階で/var/
db/ pkg/は次のようになっています。旧来のパッケージ管理システムまたはPorts Collectionからアプリケーションをインストールした場合、 このディレクトリに個々のソフトウェアのディレクトリが作成され、 その中に関連するメタデータなどが記載されていましたが、 pkg(8)ではパッケージ情報はSQLiteのデータベースに格納されます。 # pwd /var/
db/ pkg # ls -al total 108 drwxr-xr-x 2 root wheel 512 Aug 4 03:51 . drwxr-xr-x 8 root wheel 512 Aug 4 12:02 .. -rw-r--r-- 1 root wheel 99328 Aug 4 03:51 local. sqlite # アプリケーションのインストールは次のようにinstallサブコマンドを使います。最初の実行でリモートリポジトリが取得され、
どのパッケージがインストールされることになるかが表示されたのち、 インストールが実施されます。 # pkg install topless Updating remote repository repo.
txz 100% 9695KB 293. 8KB/ s 775. 1KB/ s 00:33 The following packages will be installed: Installing topless: 1. 52 The installation will require 11 kB more space 8 kB to be downloaded Proceed with installing packages [y/ N]: y topless-1. 52. txz 100% 8352 8. 2KB/ s 8. 2KB/ s 00:00 Checking integrity... done Installing topless-1. 52... done # この段階で/var/
db/ pkg/に次のようにもうひとつSQLiteデータベースが作成されます。 # pwd /var/
db/ pkg # ls -al total 60076 drwxr-xr-x 2 root wheel 512 Aug 4 03:54 . drwxr-xr-x 8 root wheel 512 Aug 4 12:02 .. -rw-r--r-- 1 root wheel 99328 Aug 4 03:54 local. sqlite -rw-r--r-- 1 root wheel 61359104 Aug 4 03:54 repo. sqlite # 何10台、
何100台といったFreeBSDサーバを管理する場合、 pkg(8)の提供してくれるパッケージ管理機能はきわめて有益なものです。また、 仮想環境でFreeBSDを使いたい場合にもpkg(8)はとても便利な機能を提供してくれます。主要な開発機やワークステーションではPorts Collectionを使い、 サービスを提供するFreeBSDマシンではpkg(8)を使うといった使い分けが想定されます。