FreeBSD Daily Topics

2012年8月10日 次世代パッケージ管理システムpkg(8)の使い方

この記事を読むのに必要な時間:およそ 3 分


How to use the pkg(8)


# pkg search svn
svn2cl-0.13                    Subversion ChangeLog generator
svnmailer-py27-1.1.0.d.r1373_5 A tool to post subversion repository commit information
ssvnc-1.0.29                   Enhanced TightVNC Viewer (SSVNC: SSL/SSH VNC viewer)
websvn-2.3.3                   Subversion repository web frontend
pecl-svn-1.0.2                 A PECL extension to the libsvn library
hidesvn-1.2                    Utility that uses LD_PRELOAD to hide .svn directories
psvn-emacs23-915036_6          Subversion interface for Emacs
cvs2svn-2.3.0_4                CVS to Subversion Repository Converter
svndelta-1.0.6_4               Summarizes and manages differences between local files and Subversion
svn2git-1.0.4                  Imports svn repositories into git
esvn-0.6.12_9                  GUI frontend for the Subversion revision system
qsvn-0.8.1_5                   Qt based GUI frontend for Subversion
py27-hgsvn-0.1.9               Scripts to work locally on Subversion checkouts using Mercurial
bzr-svn-1.2.2_1                Plugin for bzr to work with svn
svntrac-2.0.1_4                Web-Based Bug And Patch-Set Tracking System For Subversion
rsvndump-0.5.8                 Remote Subversion repository dumpfile generator
rapidsvn-0.12.0_3              Cross-platform GUI front-end for the Subversion revision system
latex-svninfo-0.7.4_4          A LaTeX package for Subversion support
pysvn-1.7.6                    Python binding for Subversion


# pkg install websvn-2.3.3
Updating remote repository
Remote repository up-to-date, no need to upgrade
The following packages will be installed:

	Installing php5: 5.4.4
	Installing php5-iconv: 5.4.4
	Installing php5-xml: 5.4.4
	Installing websvn: 2.3.3

The installation will require 14 MB more space

0 B to be downloaded

Proceed with installing packages [y/N]: y
Checking integrity... done
Installing php5-5.4.4... done
Installing php5-iconv-5.4.4... done
Installing php5-xml-5.4.4... done
Installing websvn-2.3.3... done
To setup websvn, please edit the configuration file:


# pkg info websvn
websvn-2.3.3                   Subversion repository web frontend


# pkg remove websvn
The following packages will be deinstalled:


The deinstallation will free 3 MB

Proceed with deinstalling packages [y/N]: y
Deinstalling websvn-2.3.3... done

ここの例ですと,websvn-2.3.3をインストールするための関連ソフトウェアとしてインストールされたphp5-iconv-5.4.4,php5-xml-5.4.4, php5-5.4.4がシステムに残ってしまいます。これらはautoremoveサブコマンドで自動的に探しだしてアンインストールさせることができます。

# pkg autoremove
Packages to be autoremoved: 

The autoremoval will free 11 MB

Proceed with autoremoval of packages [y/N]: y
Deinstalling php5-iconv-5.4.4... done
Deinstalling php5-xml-5.4.4... done
Deinstalling php5-5.4.4... done


# pkg info | head
GeoIP-1.4.8_2                  Find the country that any IP address or hostname originates from
GraphicsMagick-1.2.10_2        Fast image processing tools based on ImageMagick
ORBit2-2.14.19                 High-performance CORBA ORB with support for the C language
aalib-1.4.r5_6                 An ascii art library
alsa-lib-1.0.23                ALSA compatibility library
alsa-plugins-1.0.23_3          ALSA compatibility library plugins
appres-1.0.3                   Program to list application's resources
apr-ipv6-devrandom-gdbm-db42- Apache Portability Library
aspell-              Spelling checker with better suggestion logic than ispell
atk-2.0.1                      A GNOME accessibility toolkit (ATK)
# pkg info | wc -l


# pkg stats
Local package database:
	Installed packages: 550
	Disk space occupied: 2973 MB

Remote package database(s):
	Number of repositories: 1
	Packages available: 19543
	Unique packages: 19543
	Total size of packages: 64 GB


# pkg which /usr/local/bin/zip
/usr/local/bin/zip was installed by package zip-3.0


# pkg audit
chromium-19.0.1084.56_1 is vulnerable:
chromium -- multiple vulnerabilities


firefox-13.0.1,1 is vulnerable:
mozilla -- multiple vulnerabilities


thunderbird-13.0.1 is vulnerable:
mozilla -- multiple vulnerabilities


3 problem(s) in your installed packages found.

従来のパッケージであれば/var/db/pkg/以下のファイルを直接チェックしていた作業が,すべてpkg(8)経由で実施できるようになっています。pkg(8)の操作は直感的でわかりやすく,FreeBSD 10以降のパッケージ管理を特徴づける機能になりそうです。