「pkg」の版間の差分

提供: FreeBSD入門
移動: 案内検索
行1: 行1:
[[pkg]]は、次世代パッケージ管理システムとそのコマンドです。[[FreeBSD]] 10-CURRENT から採用されました。RELEASE版では、[[FreeBSD 10.0-RELEASE]]から利用できます。バイナリパッケージであるため、コンパイルが必要ありません。バイナリパッケージのメリットは、コンパイルがすでに終わってることでしょう。また、[[ports]]と併用できます。独自のビルドオプションなどを使いたいパッケージは、[[ports]]からビルドし、それ以外を[[pkg]]でインストールできます。
+
[[FreeBSD]]の[[pkg]]は、次世代パッケージ管理システムとそのコマンドです。[[FreeBSD]] 10-CURRENT から採用されました。RELEASE版では、[[FreeBSD 10.0-RELEASE]]から利用できます。バイナリパッケージであるため、コンパイルが必要ありません。バイナリパッケージのメリットは、コンパイルがすでに終わってることでしょう。また、[[ports]]と併用できます。独自のビルドオプションなどを使いたいパッケージは、[[ports]]からビルドし、それ以外を[[pkg]]でインストールできます。
  
 
'''読み方'''
 
'''読み方'''
行227: 行227:
 
上記の結果から mod_remoteip.so は、 apache24 のパッケージに含まれていることがわかりました。
 
上記の結果から mod_remoteip.so は、 apache24 のパッケージに含まれていることがわかりました。
 
=== 使われていないインストールされているパッケージの依存を削除する ===
 
=== 使われていないインストールされているパッケージの依存を削除する ===
 +
autoremove は、孤児のパッケージを削除するために使われます。
 +
依存関係でインストールされたか、すでに使われないパッケージを削除します。
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
pkg autoremove
 
pkg autoremove
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight lang="bash">
 +
$ sudo pkg autoremove
 +
Deinstallation has been requested for the following 14 packages:
 +
 +
        bison-2.7.1,1
 +
        curl-hiphop-7.36.0
 +
        db42-4.2.52_5
 +
        glog-0.3.3
 +
        libdwarf-20130207
 +
        libevent-hiphop-1.4.14b_3
 +
        libmemcached-1.0.7_2
 +
        libtool-2.4.2_3
 +
        libunwind-20121006
 +
        libxslt-1.1.28_3
 +
        re2c-0.13.6
 +
        t1lib-5.1.2_2,1
 +
        tbb-4.2.2
 +
        zip-3.0
 +
 +
The deinstallation will free 35 MB
 +
 +
Proceed with deinstalling packages [y/N]:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
行284: 行310:
 
vimpager-1.8.3
 
vimpager-1.8.3
 
xpi-vimperator-3.5
 
xpi-vimperator-3.5
 +
</syntaxhighlight>
 +
 +
クエリーには、正規表現を利用できます。[[gcc]]ではじまるパッケージだけ調べるには、^gcc を検索します。
 +
<syntaxhighlight lang="bash">
 +
$ pkg search '^gcc'
 +
gcc-4.7.3_1
 +
gcc-arm-embedded-4.8.20140314
 +
gcc-aux-20140422_2
 +
gcc-ecj-4.5
 +
gcc410-4.10.0.s20140518
 +
gcc46-4.6.4_1,1
 +
gcc47-4.7.4.20140419
 +
gcc47-aux-20130411_4
 +
gcc48-4.8.3.s20140508
 +
gcc49-4.9.1.s20140507
 +
gccmakedep-1.0.2_1
 
</syntaxhighlight>
 
</syntaxhighlight>
 
==== リモートのパッケージの情報の詳細を取得する ====
 
==== リモートのパッケージの情報の詳細を取得する ====
行310: 行352:
  
 
WWW:    http://code.google.com/p/sshsudo/
 
WWW:    http://code.google.com/p/sshsudo/
 +
</syntaxhighlight>
 +
 +
以下は、[[tmux]]の例です。Optionsのセクションで、[[pkg]]のパッケージが[[ports]]パッケージのmake configで指定できるオプションのいずれを有効にしてビルドされているか確認できます。 Shared Libs required で依存するシェアードオブジェクトの確認もできます。
 +
<syntaxhighlight lang="bash">
 +
$ pkg search -f tmux
 +
tmux-1.9.a_1
 +
Name          : tmux
 +
Version        : 1.9.a_1
 +
Installed on  : Thu Jan  1 09:00:00 JST 1970
 +
Origin        : sysutils/tmux
 +
Architecture  : freebsd:10:x86:64
 +
Prefix        : /usr/local
 +
Categories    : sysutils
 +
Licenses      : BSD2CLAUSE
 +
Maintainer    : gahr@FreeBSD.org
 +
WWW            : http://www.sourceforge.net/projects/tmux/
 +
Comment        : Terminal Multiplexer
 +
Options        :
 +
        BACKSPACE      : off
 +
        DOCS          : on
 +
        EXAMPLES      : on
 +
        LIBEVENT2      : off
 +
        LIBEVENT_STATIC: off
 +
Shared Libs required:
 +
        libevent-1.4.so.4
 +
Flat size      : 556KiB
 +
Pkg size      : 210 KB
 +
Description    :
 +
Tmux is a terminal multiplexer, it enables a number of terminals to be
 +
accessed and controlled from a single terminal. tmux is intended to be a
 +
simple, modern, BSD-licensed alternative to programs such as GNU screen.
 +
 +
WWW:    http://www.sourceforge.net/projects/tmux/
 
</syntaxhighlight>
 
</syntaxhighlight>
 
=== インストールされているパッケージの情報を取得する ===
 
=== インストールされているパッケージの情報を取得する ===
 
==== インストールされているパッケージの一覧を取得する ====
 
==== インストールされているパッケージの一覧を取得する ====
 +
インストールされているすべてのパッケージが確認できます。
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
pkg info
+
$ pkg info
 
</syntaxhighlight>
 
</syntaxhighlight>
 
==== パッケージの情報を取得する ====
 
==== パッケージの情報を取得する ====
 +
インストールされているパッケージの情報を確認します。
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
% pkg info tmux
 
% pkg info tmux
 
tmux-1.8                      A Terminal Multiplexer
 
tmux-1.8                      A Terminal Multiplexer
 +
</syntaxhighlight>
 +
==== パッケージのメッセージ(pkg-message)を取得する ====
 +
-D で pkg-message を表示できます。以下の例では、[[ports]]でいえば、/usr/ports/www/apache24/pkg-message を表示しています。
 +
<syntaxhighlight lang="bash">
 +
$ pkg info -D apache24
 +
apache24-2.4.9_2:
 +
To run apache www server from startup, add apache24_enable="yes"
 +
in your /etc/rc.conf. Extra options can be found in startup script.
 +
 +
Your hostname must be resolvable using at least 1 mechanism in
 +
/etc/nsswitch.conf typically DNS or /etc/hosts or apache might
 +
have issues starting depending on the modules you are using.
 
</syntaxhighlight>
 
</syntaxhighlight>
 
==== パッケージの情報を詳細な取得する ====
 
==== パッケージの情報を詳細な取得する ====
 +
ビルドオプション(portsのmake config)や共有ライブラリ(シェアードライブラリ)の依存なども確認できます。
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
user@b0:/ % pkg info -f tmux
 
user@b0:/ % pkg info -f tmux
行343: 行433:
 
Flat size      : 476KiB
 
Flat size      : 476KiB
 
Description    :
 
Description    :
Tmux is a terminal multiplexer, it enables a number of terminals to be accessed
+
Tmux is a terminal multiplexer, it enables a number of terminals to be
and controlled from a single terminal. tmux is intended to be a simple, modern,
+
accessed and controlled from a single terminal. tmux is intended to be a
BSD-licensed alternative to programs such as GNU screen.
+
simple, modern, BSD-licensed alternative to programs such as GNU screen.
  
 
WWW:    http://www.sourceforge.net/projects/tmux/
 
WWW:    http://www.sourceforge.net/projects/tmux/
 
</syntaxhighlight>
 
</syntaxhighlight>
 
==== インストールされているファイルの一覧を取得する ====
 
==== インストールされているファイルの一覧を取得する ====
インストールされているファイルの一覧を表示する。
+
インストールされているファイルの一覧を表示できます。
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
% pkg info -l tmux
 
% pkg info -l tmux
行402: 行492:
 
tmux-1.9.a                    yes
 
tmux-1.9.a                    yes
 
vim-7.4.192_1                  no
 
vim-7.4.192_1                  no
 +
</syntaxhighlight>
 +
 +
すべてのパッケージのロックの状態を確認する場合は、-aを指定します。
 +
<syntaxhighlight lang="bash">
 +
$ pkg info -k -a
 
</syntaxhighlight>
 
</syntaxhighlight>
 
==== パッケージのアンロック ====
 
==== パッケージのアンロック ====
行433: 行528:
 
* [[ports]]
 
* [[ports]]
 
* [[ソフトウェアの管理]]
 
* [[ソフトウェアの管理]]
 +
* [[FreeBSD 10.0 環境構築]]
 +
* [[FreeBSDの環境構築]]
 
<!-- vim: fileencoding=utf-8 filetype=mediawiki
 
<!-- vim: fileencoding=utf-8 filetype=mediawiki
 
-->
 
-->

2014年5月25日 (日) 15:38時点における版

FreeBSDpkgは、次世代パッケージ管理システムとそのコマンドです。FreeBSD 10-CURRENT から採用されました。RELEASE版では、FreeBSD 10.0-RELEASEから利用できます。バイナリパッケージであるため、コンパイルが必要ありません。バイナリパッケージのメリットは、コンパイルがすでに終わってることでしょう。また、portsと併用できます。独自のビルドオプションなどを使いたいパッケージは、portsからビルドし、それ以外をpkgでインストールできます。

読み方

pkg
ぴーけーじー

目次

概要

pkgは、次世代パッケージ管理システムとそのコマンドです。 FreeBSD 10-CURRENT から採用されました。 FreeBSD 9.1-RELEASE で利用できます。 FreeBSD 10.0-RELEASEでは、デフォルトで使用できます。

Ports Collectionをベースに1-2週間ごとにパッケージが更新されます。 最新のコレクションをバイナリでインストール・アップグレードできます。

以下のhtopの動画の前半にpkgを利用している例があります。

設定

設定ファイル

  • /usr/local/etc/pkg.conf

FreeBSD 10.0-RELEASE /etc/pkg/FreeBSD.conf

# $FreeBSD: release/10.0.0/etc/pkg/FreeBSD.conf 258710 2013-11-28 14:24:26Z gjb $
FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest",
  mirror_type: "srv",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}

make.conf

FreeBSD 10.x 未満の場合は、下記設定を /etc/make.conf にします。

WITH_PKGNG=	yes

使い方

pkg コマンドのオプション

% pkg help
Usage: pkg [-v] [-d] [-l] [-N] [-j <jail name or id>|-c <chroot path>] 
[-C <configuration file>] [-R <repo config dir>] <command> [<args>]
 
Global options supported:
        -d             Increment debug level
        -j             Execute pkg(8) inside a jail(8)
        -c             Execute pkg(8) inside a chroot(8)
        -C             Use the specified configuration file
        -R             Directory to search for individual repository configurations
        -l             List available commands and exit
        -v             Display pkg(8) version
        -N             Test if pkg(8) is activated and avoid auto-activation
 
Commands supported:
        add            Registers a package and installs it on the system
        annotate       Add, modify or delete tag-value style annotations on packages
        audit          Reports vulnerable packages
        autoremove     Removes orphan packages
        backup         Backs-up and restores the local package database
        check          Checks for missing dependencies and database consistency
        clean          Cleans old packages from the cache
        config         Display the value of the configuration options
        convert        Convert database from/to pkgng
        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 about installed packages
        install        Installs packages from remote package repositories
        lock           Locks package against modifications or deletion
        plugins        Manages plugins and displays information about plugins
        query          Queries information about installed packages
        register       Registers a package into the local database
        remove         Deletes packages from the database and the system
        repo           Creates a package repository catalogue
        rquery         Queries information in repository catalogues
        search         Performs a search of package repository catalogues
        set            Modifies information about packages in the local database
        ssh            ssh packages to be used via ssh
        shell          Opens a debug shell
        shlib          Displays which packages link against a specific shared library
        stats          Displays package database statistics
        unlock         Unlocks a package, allowing modification or deletion
        update         Updates package repository catalogues
        updating       Displays UPDATING information for a package
        upgrade        Performs upgrades of packaged software distributions
        version        Displays the versions of installed packages
        which          Displays which package installed a specific file
 
Commands provided by plugins:
 
For more information on the different commands see 'pkg help <command>'.

はじめて起動するとき

% sudo /usr/sbin/pkg
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]:
Bootstrapping pkg please wait
Installing pkg-1.0.11... 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         Backs-up and restores the local package database
        check          Checks 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 about installed packages
        install        Installs packages from remote package repositories
        query          Queries information about installed packages
        register       Registers a package into the local database
        remove         Deletes packages from the database and the system
        repo           Creates a package repository catalogue
        rquery         Queries information in repository catalogues
        search         Performs a search of package repository catalogues
        set            Modifies information about packages in the local database
        shell          Opens a debug shell
        shlib          Displays which packages link against a specific shared li                                                                                                                                                                brary
        stats          Displays package database statistics
        update         Updates package repository catalogues
        updating       Displays UPDATING information for a package
        upgrade        Performs upgrades of packaged software distributions
        version        Displays the versions of installed packages
        which          Displays which package installed a specific file
 
For more information on the different commands see 'pkg help <command>'.

すでにサードパーティ製ソフトウェアがインストールされている場合

FreeBSDports などでソフトウェアがインストールされている場合は、データベースを新しいフォーマットへ変換する必要があります。

sudo /usr/local/sbin/pkg2ng
% sudo /usr/local/sbin/pkg2ng
 
省略
 
Moved old package database to /var/db/pkg.bak.
Conversion has been successfully finished
Your old packages database has been moved to: /var/db/pkg.bak.
% ls /var/db/pkg
local.sqlite  repo.sqlite

パッケージをインストールする

パッケージのインストールの例。

pkg install tmux

パッケージをアンインストールする

pkg delete tmux

バージョンチェック

アップデートできるパッケージがないか調べます。

pkg version
% pkg version
ImageMagick-6.8.0.7                <
ORBit2-2.14.19                     =
R-2.15.3                           =
adns-1.4_1                         =
amap-5.2                           =

時代遅れなパッケージを調べる

pkg version -l '<'

データベースのダウンロード

% sudo pkg update -f
Updating repository catalogue
repo.txz                        100% 1832     1.8KB/s   1.8KB/s   00:00

バージョンアップ

新しいバージョンのパッケージにアップグレードします。

sudo pkg upgrade

ドライラン(Dry run)します。

sudo pkg upgrade -n

インストールされているファイルからパッケージを調べる

任意のファイルがどのパッケージによってインストールされたのか調べるには、以下のコマンドを実行します。

$ pkg which /usr/local/libexec/apache24/mod_remoteip.so
/usr/local/libexec/apache24/mod_remoteip.so was installed by package apache24-2.4.9

上記の結果から mod_remoteip.so は、 apache24 のパッケージに含まれていることがわかりました。

使われていないインストールされているパッケージの依存を削除する

autoremove は、孤児のパッケージを削除するために使われます。 依存関係でインストールされたか、すでに使われないパッケージを削除します。

pkg autoremove
$ sudo pkg autoremove
Deinstallation has been requested for the following 14 packages:
 
        bison-2.7.1,1
        curl-hiphop-7.36.0
        db42-4.2.52_5
        glog-0.3.3
        libdwarf-20130207
        libevent-hiphop-1.4.14b_3
        libmemcached-1.0.7_2
        libtool-2.4.2_3
        libunwind-20121006
        libxslt-1.1.28_3
        re2c-0.13.6
        t1lib-5.1.2_2,1
        tbb-4.2.2
        zip-3.0
 
The deinstallation will free 35 MB
 
Proceed with deinstalling packages [y/N]:

パッケージの検証

脆弱性のあるソフトウェアがインストールされていないか、検証できます。

pkg audit -F
% sudo pkg audit -F
auditfile.tbz                         100%   87KB  86.8KB/s  86.8KB/s   00:01
ca_root_nss-3.14 is vulnerable:
mozilla -- multiple vulnerabilities
 
WWW: http://portaudit.FreeBSD.org/a4ed6632-5aa9-11e2-8fcb-c8600054b392.html
 
省略
 
10 problem(s) in your installed packages found.

リモートのパッケージの情報を取得する

query は、任意の文字列が入ります。

pkg search 'query'

リモートのパッケージの一覧を取得する

pkg search '.'
user@b0:/ % pkg search '.'|wc
   22691   22691  457583

リモートのパッケージを検索する

pkgのsearchコマンドは、以下の引数をとります。

Usage: pkg search [-egix] [-r repo] [-S search] [-L label] [-Q mod]... 
	<pkg-name>
       pkg search [-cDdefgiopqRx] [-r repo] <pattern>
 
       Search and Label options: comment description name origin pkg-name
       Output Modifiers: annotations arch categories comment depends-on
             description full licenses maintainer name options pkg-size
             prefix repository required-by shared-libs-required shared-libs-provided
             size url version www
For more information see 'pkg help search'.
user@b0:/ % pkg search vim
vim-7.4.110_3
vim-lite-7.4.110
vimpager-1.8.3
xpi-vimperator-3.5

クエリーには、正規表現を利用できます。gccではじまるパッケージだけ調べるには、^gcc を検索します。

$ pkg search '^gcc'
gcc-4.7.3_1
gcc-arm-embedded-4.8.20140314
gcc-aux-20140422_2
gcc-ecj-4.5
gcc410-4.10.0.s20140518
gcc46-4.6.4_1,1
gcc47-4.7.4.20140419
gcc47-aux-20130411_4
gcc48-4.8.3.s20140508
gcc49-4.9.1.s20140507
gccmakedep-1.0.2_1

リモートのパッケージの情報の詳細を取得する

user@b0:/ % pkg search sshsudo
sshsudo-1.0

-f オプションで詳細情報が取得できます。

user@b0:/ % pkg search -f sshsudo
sshsudo-1.0
Name           : sshsudo
Version        : 1.0
Origin         : sysutils/sshsudo
Architecture   : freebsd:10:x86:32
Prefix         : /usr/local
Categories     : sysutils
Licenses       : GPLv3
Maintainer     : gaod@hychen.org
WWW            : http://code.google.com/p/sshsudo/
Comment        : A bash script to run sudo command on multiple remote computers
Flat size      : 40.5KiB
Pkg size       : 15 KB
Description    :
A bash script to run sudo command on multiple remote computers with least effort
 
WWW:    http://code.google.com/p/sshsudo/

以下は、tmuxの例です。Optionsのセクションで、pkgのパッケージがportsパッケージのmake configで指定できるオプションのいずれを有効にしてビルドされているか確認できます。 Shared Libs required で依存するシェアードオブジェクトの確認もできます。

$ pkg search -f tmux
tmux-1.9.a_1
Name           : tmux
Version        : 1.9.a_1
Installed on   : Thu Jan  1 09:00:00 JST 1970
Origin         : sysutils/tmux
Architecture   : freebsd:10:x86:64
Prefix         : /usr/local
Categories     : sysutils
Licenses       : BSD2CLAUSE
Maintainer     : gahr@FreeBSD.org
WWW            : http://www.sourceforge.net/projects/tmux/
Comment        : Terminal Multiplexer
Options        :
        BACKSPACE      : off
        DOCS           : on
        EXAMPLES       : on
        LIBEVENT2      : off
        LIBEVENT_STATIC: off
Shared Libs required:
        libevent-1.4.so.4
Flat size      : 556KiB
Pkg size       : 210 KB
Description    :
Tmux is a terminal multiplexer, it enables a number of terminals to be
accessed and controlled from a single terminal. tmux is intended to be a
simple, modern, BSD-licensed alternative to programs such as GNU screen.
 
WWW:    http://www.sourceforge.net/projects/tmux/

インストールされているパッケージの情報を取得する

インストールされているパッケージの一覧を取得する

インストールされているすべてのパッケージが確認できます。

$ pkg info

パッケージの情報を取得する

インストールされているパッケージの情報を確認します。

% pkg info tmux
tmux-1.8                       A Terminal Multiplexer

パッケージのメッセージ(pkg-message)を取得する

-D で pkg-message を表示できます。以下の例では、portsでいえば、/usr/ports/www/apache24/pkg-message を表示しています。

$ pkg info -D apache24
apache24-2.4.9_2:
To run apache www server from startup, add apache24_enable="yes"
in your /etc/rc.conf. Extra options can be found in startup script.
 
Your hostname must be resolvable using at least 1 mechanism in
/etc/nsswitch.conf typically DNS or /etc/hosts or apache might
have issues starting depending on the modules you are using.

パッケージの情報を詳細な取得する

ビルドオプション(portsのmake config)や共有ライブラリ(シェアードライブラリ)の依存なども確認できます。

user@b0:/ % pkg info -f tmux
tmux-1.8_1
Name           : tmux
Version        : 1.8_1
Origin         : sysutils/tmux
Architecture   : freebsd:10:x86:32
Prefix         : /usr/local
Categories     : sysutils
Licenses       : BSD
Maintainer     : gahr@FreeBSD.org
WWW            : http://www.sourceforge.net/projects/tmux/
Comment        : A Terminal Multiplexer
Options        :
        BACKSPACE      : off
        LIBEVENT2      : off
        LIBEVENT_STATIC: off
Shared Libs required:
        libevent-1.4.so.4
Flat size      : 476KiB
Description    :
Tmux is a terminal multiplexer, it enables a number of terminals to be
accessed and controlled from a single terminal. tmux is intended to be a
simple, modern, BSD-licensed alternative to programs such as GNU screen.
 
WWW:    http://www.sourceforge.net/projects/tmux/

インストールされているファイルの一覧を取得する

インストールされているファイルの一覧を表示できます。

% pkg info -l tmux
tmux-1.8 owns the following files:
/usr/local/bin/tmux
/usr/local/etc/bash_completion.d/tmux
/usr/local/man/man1/tmux.1.gz
/usr/local/share/doc/tmux/CHANGES
/usr/local/share/doc/tmux/FAQ
/usr/local/share/doc/tmux/README
/usr/local/share/doc/tmux/TODO
/usr/local/share/examples/tmux/bash_completion_tmux.sh
/usr/local/share/examples/tmux/h-boetes.conf
/usr/local/share/examples/tmux/n-marriott.conf
/usr/local/share/examples/tmux/screen-keys.conf
/usr/local/share/examples/tmux/t-williams.conf
/usr/local/share/examples/tmux/tmux.vim
/usr/local/share/examples/tmux/tmux_backup.sh
/usr/local/share/examples/tmux/vim-keys.conf
/usr/local/share/licenses/tmux-1.8/BSD
/usr/local/share/licenses/tmux-1.8/LICENSE
/usr/local/share/licenses/tmux-1.8/catalog.mk

インストールされているパッケージの統計を表示する

user@b0:/ % pkg stat
Local package database:
        Installed packages: 116
        Disk space occupied: 583 MB
 
Remote package database(s):
        Number of repositories: 1
        Packages available: 22691
        Unique packages: 22691
        Total size of packages: 94 GB

パッケージをロックとアンロック

パッケージのロック

パッケージの更新をロックできます。

$ sudo pkg lock tmux
tmux-1.9.a: lock this package? [y/N]: y
Locking tmux-1.9.a

パッケージのロック状態の確認

パッケージがロックされているかは、infoで確認します。

yes
ロックされている
no
ロックされていない
$ pkg info -k tmux vim
tmux-1.9.a                     yes
vim-7.4.192_1                  no

すべてのパッケージのロックの状態を確認する場合は、-aを指定します。

$ pkg info -k -a

パッケージのアンロック

パッケージのロックは、アンロックオプションで解除できます。

$ sudo pkg unlock tmux
tmux-1.9.a: unlock this package? [y/N]: y
Unlocking tmux-1.9.a

ロック状態のパッケージはアップデートできない

ロック状態のパッケージは、アップデートがあっても、インストールされません。

$ sudo pkg install tmux
Updating repository catalogue
tmux-1.9.a_1 already installed
$ sudo pkg unlock tmux
tmux-1.9.a: unlock this package? [y/N]: y
Unlocking tmux-1.9.a
$ sudo pkg install tmux
Updating repository catalogue
The following 1 packages will be installed:
 
        Upgrading tmux: 1.9.a -> 1.9.a_1
 
210 KB to be downloaded
 
Proceed with installing packages [y/N]:

関連項目