忍者ブログ

カウンター

プロモーション

カレンダー

03 2024/04 05
S M T W T F S
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30

AntinomyMy の実験室

   私のWEBアプリ実験室です!

ブログ内検索

楽天でお買い物

twitter

最新トラックバック

最新コメント

忍者アナライズ

ウェザーニュース

バーコード

本を買う

アクセス解析

Google+

[PR]

×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。


  • 2024/04/26 19:49

apt とdpkg (追伸でaptitude)でパッケージのインストールと各種確認

Linux 関連 調べ物

 

パッケージの確認とインストール の基本操作、apache2 を例にメモ。

<追伸で書いた部分>------
結局の所、locale 設定をインストール(apt-get install locales)し、
日本語に表示できる様に設定すれば、
こんなメモは要らないのかもしれないです。

 その場合は、ちゃんと指定した文字コードが表示できるコンソールだのターミナルを使って下さいね、
文字化けしますから。

そうすれば基本的にapkg でdebパッケージをインストールするのであろうと、
aptitude を使おうと、どちらも--help という引数を与えれば、ある程度日本語化された
ヘルプが見られますね^^;

-----追伸以上。-----

☆  ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆
指定した言葉を含む、パッケージの一覧を表示する。(dpkg)

dpkg -l | grep apache

長い場合で少しづつ見たい場合はmore にパイプする。
dpkg -l | grep apa | more


長い場合で前後しながら見られる様にしたい場合はless にパイプする。
(終了は[q]キー、移動は、1行[e][i][y][k]、n行[nz][nx]、先頭[g]、最終[G])
dpkg -l | grep apa | less

追伸:
後でも説明が出てきますが、
aptitude show apache2

がとても便利でした・・・

☆  ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆
インストールされている場合は、最新にアップデートする。

まず、最新の更新リストの設定にする。
apt-get update

 

次にリストにある全てのapt-get で管理できるパッケージをアップデートする。
apt-get upgrade

☆  ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆

インストールされていない場合は、欲しいパッケージ名を検索してみる。

apt-cache search apache2

 

長い場合で少しずつ見たい場合はmore もしくはless にパイプする。
apt-cache search apache2 | more
apt-cache search apache2 | less

 

apache2 で検索した場合、いっぱい出てくる中で以下の当りを注目する。

      ・・・ (略) ・・・
apache2 - Apache HTTP Server metapackage
apache2-utils - utility programs for webservers
apache2.2-bin - Apache HTTP Server common binary files
apache2.2-common - Apache HTTP Server common files
      ・・・ (略) ・・・

実は、パッケージの名前が明確になった場合は以下のコマンドの方が簡単にリスト化できる。
ただしこちらは、パッケージについて説明が無い。

apt-cache pkgnames apache2

結果はこうなる。

apache2-suexec-custom
apache2-utils
apache2-mpm-itk
apache2.2-bin
apache2-mpm-prefork
apache2
apache2-threaded-dev
apache2.2-common
apache2-suexec
apache2-dbg
apache2-doc
apache2-mpm-worker
apache2-mpm-event
apache2-prefork-dev

☆  ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆
依存関係を確認し、インストールしたいパッケージ内容を明確にする。

apt-cache depends apache2

 

この様に表示される

apache2
 |Depends: apache2-mpm-worker
 |Depends: apache2-mpm-prefork
 |Depends: apache2-mpm-event
  Depends: apache2-mpm-itk
  Depends: apache2.2-common

しかし、apache2 の場合、大本を指定しないとこうなる様だ。
例えばapache2.2-common だと

apt-cache depends apache2.2-common

この様に、インストールするとどうなるかが表示される。

apache2.2-common
  Depends: apache2.2-bin
  Depends: apache2-utils
  Depends: libmagic1
  Depends: mime-support
  Depends: lsb-base
  Depends: procps
  Depends: perl
  Suggests: <www-browser>
    conkeror
    edbrowse
    elinks-lite
    elvis-console
    lynx-cur
    uzbl
    chimera2
    chromium-browser
    elinks
    elvis
    epiphany-browser
    galeon
    iceape-browser
    iceweasel
    kazehakase
    konqueror
    links
    links2
    midori
    netrik
    rekonq
    xemacs21-mule
    xemacs21-mule-canna-wnn
    xemacs21-nomule
    w3m
  Suggests: apache2-doc
 |Suggests: apache2-suexec
    apache2-suexec-custom
  Suggests: apache2-suexec-custom
  Recommends: ssl-cert
  Conflicts: <apache>
  Conflicts: <apache2-common>
  Replaces: <apache2-common>

Depends: 同時にインストールされる他のパッケージ。
    つまり同時に導入される、他の依存パッケージ。
Suggests: インストールした方が利便性がよい他の薦めパッケージ。
Recommends: インストールを推奨するパッケージ。
Conflicts: 競合するのでインストールすると消されるパッケージ。
Replaces: 競合など、何らかの理由で再配置、
    再インストールされるパッケージ。

他のパッケージも含むパッケージは、Depends: でインストールされるが、
Suggests: Recommends: は表示されるだけで任意である。
Conflicts: はインストールすると強制的に消され、依存関係を再構成し、
再びインストールされるのがReplaces: である。

 

もうひとつ、自身のパッケージ内で他の
パッケージ名として依存関係も確認出来る様だ。
apt-cache rdepends apache2

 

こちらの方は、どの機能が何を使っているのかを知る為には良い、
しかし単純にパッケージとしてみるには情報量が多い。
以下はphp関連で目にとまった一例。

       ・・・ (略) ・・・
 |phpsysinfo
    apache2-mpm-itk
    apache2-mpm-event
    apache2-mpm-prefork
    apache2-mpm-worker
 |phppgadmin
    apache2-mpm-itk
    apache2-mpm-event
    apache2-mpm-prefork
    apache2-mpm-worker
 |phpmyadmin
    apache2-mpm-itk
    apache2-mpm-event
    apache2-mpm-prefork
    apache2-mpm-worker
 |phpldapadmin
    apache2-mpm-itk
    apache2-mpm-event
    apache2-mpm-prefork
    apache2-mpm-worker
 |phpbb3
    apache2-mpm-itk
    apache2-mpm-event
    apache2-mpm-prefork
    apache2-mpm-worker
      ・・・ (略) ・・・
 |htcheck-php
    apache2-mpm-itk
    apache2-mpm-event
    apache2-mpm-prefork
    apache2-mpm-worker
      ・・・ (略) ・・・

結局、apache2 という物をインストールすると
それに関連する依存しているパッケージもインストールされることが分かる。

 

また、関連しているパッケージが、また他に関係しているパッケージがあるか、
一応見てみた。

apt-cache depends phpsysinfo

 

一つ例として、phpsysinfo について見てみた、php5 本体と関係があるのがわかる。

phpsysinfo
 |Depends: apache2
    apache2-mpm-itk
    apache2-mpm-event
    apache2-mpm-prefork
    apache2-mpm-worker
  Depends: <httpd>
    apache2-mpm-itk
    bozohttpd
    monkey
    tntnet
    aolserver4-core
    aolserver4-daemon
    apache2-mpm-event
    apache2-mpm-prefork
    apache2-mpm-worker
    boa
    cherokee
    dhttpd
    ebhttpd
    lighttpd
    mathopd
    micro-httpd
    mini-httpd
    nginx
    ocsigen
    thttpd
    webfs
    yaws
  Depends: php5
  Suggests: lm-sensors
  Suggests: hddtemp

最後に、もし個別にインストールしても良いだろうが、

面倒であったり、使いたい機能が無い場合もあるだろうし、
もし機能から全て把握してカスタマイズしたいならば、
自分でコンパイルする方が無難な場合も。

今回のメモはapache2 をapt-get コマンドを用いて、
Debian パッケージのレポジトリから調べて、最新のパッケージを
丸々依存ファイルごとインストールする例でした。


追伸:aptitude コマンドで、パッケージ情報を確認することも出来る様だ。
こっちのコマンドは説明も追加されて理解しやすかった。
aptitude show apache2

Package: apache2
State: installed
Automatically installed: no
Version: 2.2.16-6+squeeze7
Priority: optional
Section: net
Maintainer: Debian Apache Maintainers <debian-apache@lists.debian.x伏せx>
Uncompressed Size: 36.9 k
Depends: apache2-mpm-worker (= 2.2.16-6+squeeze7) | apache2-mpm-prefork (=
         2.2.16-6+squeeze7) | apache2-mpm-event (= 2.2.16-6+squeeze7) |
         apache2-mpm-itk (= 2.2.16-6+squeeze7), apache2.2-common (=
         2.2.16-6+squeeze7)
Provided by: apache2-mpm-event, apache2-mpm-itk, apache2-mpm-prefork,
             apache2-mpm-worker
Description: Apache HTTP Server metapackage
 The Apache Software Foundation's goal is to build a secure, efficient and
 extensible HTTP server as standards-compliant open source software. The result
 has long been the number one web server on the Internet.

 It features support for HTTPS, virtual hosting, CGI, SSI, IPv6, easy scripting
 and database integration, request/response filtering, many flexible
 authentication schemes, and more.
Homepage: http://httpd.apache.org/

このコマンドについては、後日追伸として書いたのでApache2 については、
インストールしたのでステータスが

 State: installed

となっていたので、一応インストールされていない
同様にphp5 についても確認してみた。
 

State: not installed
Version: 5.3.3-7+squeeze8
Priority: optional
Section: web
Maintainer: Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.x伏せx>
Uncompressed Size: 20.5 k
Depends: libapache2-mod-php5 (>= 5.3.3-7+squeeze8) | libapache2-mod-php5filter
         (>= 5.3.3-7+squeeze8) | php5-cgi (>= 5.3.3-7+squeeze8), php5-common (>=

         5.3.3-7+squeeze8)
Description: server-side, HTML-embedded scripting language (metapackage)
 This package is a metapackage that, when installed, guarantees that you have at

 least one of the three server-side versions of the PHP5 interpreter installed.
 Removing this package won't remove PHP5 from your system, however it may remove

 other packages that depend on this one.

 PHP5 is a widely-used general-purpose scripting language that is especially
 suited for Web development and can be embedded into HTML. The goal of the
 language is to allow web developers to write dynamically generated pages
 quickly. This version of PHP5 was built with the Suhosin patch.
Homepage: http://www.php.net/


ステータス情報は、

State: not installed

となって、インストールされていないことがわかる。

 

☆  ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆
インストールしたいパッケージ内容が明確にわかったら、インストールしてみる。

apt-get install apache2

 

するとこんな感じになる。

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapr1
  libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap ssl-cert
Suggested packages:
  apache2-doc apache2-suexec apache2-suexec-custom openssl-blacklist
The following NEW packages will be installed:
  apache2 apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common
  libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap ssl-cert
0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
Need to get 2079 kB of archives.
After this operation, 6918 kB of additional disk space will be used.
Do you want to continue [Y/n]?

The following extra packages will be installed: 拡張パッケージ
Suggested packages: お勧め提案パッケージ
The following NEW packages will be installed:
               インストールされる新しいパッケージ

インストールを継続していいか聞いてくるので継続する(Y)

Get:1 http://security.debian.org/ squeeze/updates/main apache2.2-bin armel 2.2.16-6+squeeze7 [1357 kB]
Get:2 http://ftp.jp.debian.org/debian/ squeeze/main libapr1 armel 1.4.2-6+squeeze3 [90.2 kB]
Get:3 http://ftp.jp.debian.org/debian/ squeeze/main libaprutil1 armel 1.3.9+dfsg-5 [83.9 kB]
Get:4 http://ftp.jp.debian.org/debian/ squeeze/main libaprutil1-dbd-sqlite3 armel 1.3.9+dfsg-5 [27.5 kB]
Get:5 http://ftp.jp.debian.org/debian/ squeeze/main libaprutil1-ldap armel 1.3.9+dfsg-5 [25.4 kB]
Get:6 http://ftp.jp.debian.org/debian/ squeeze/main ssl-cert all 1.0.28 [14.8 kB]
Get:7 http://security.debian.org/ squeeze/updates/main apache2-utils armel 2.2.16-6+squeeze7 [170 kB]
Get:8 http://security.debian.org/ squeeze/updates/main apache2.2-common armel 2.2.16-6+squeeze7 [307 kB]
Get:9 http://security.debian.org/ squeeze/updates/main apache2-mpm-worker armel 2.2.16-6+squeeze7 [2246 B]
Get:10 http://security.debian.org/ squeeze/updates/main apache2 armel 2.2.16-6+squeeze7 [1396 B]
Fetched 2079 kB in 10s (196 kB/s)
Preconfiguring packages ...
Selecting previously deselected package libapr1.
(Reading database ... 19480 files and directories currently installed.)
Unpacking libapr1 (from .../libapr1_1.4.2-6+squeeze3_armel.deb) ...
Selecting previously deselected package libaprutil1.
Unpacking libaprutil1 (from .../libaprutil1_1.3.9+dfsg-5_armel.deb) ...
Selecting previously deselected package libaprutil1-dbd-sqlite3.
Unpacking libaprutil1-dbd-sqlite3 (from .../libaprutil1-dbd-sqlite3_1.3.9+dfsg-5_armel.deb) ...
Selecting previously deselected package libaprutil1-ldap.
Unpacking libaprutil1-ldap (from .../libaprutil1-ldap_1.3.9+dfsg-5_armel.deb) ...
Selecting previously deselected package apache2.2-bin.
Unpacking apache2.2-bin (from .../apache2.2-bin_2.2.16-6+squeeze7_armel.deb) ...
Selecting previously deselected package apache2-utils.
Unpacking apache2-utils (from .../apache2-utils_2.2.16-6+squeeze7_armel.deb) ...
Selecting previously deselected package apache2.2-common.
Unpacking apache2.2-common (from .../apache2.2-common_2.2.16-6+squeeze7_armel.deb) ...
Selecting previously deselected package apache2-mpm-worker.
Unpacking apache2-mpm-worker (from .../apache2-mpm-worker_2.2.16-6+squeeze7_armel.deb) ...
Selecting previously deselected package apache2.
Unpacking apache2 (from .../apache2_2.2.16-6+squeeze7_armel.deb) ...
Selecting previously deselected package ssl-cert.
Unpacking ssl-cert (from .../ssl-cert_1.0.28_all.deb) ...
Processing triggers for man-db ...
Setting up libapr1 (1.4.2-6+squeeze3) ...
Setting up libaprutil1 (1.3.9+dfsg-5) ...
Setting up libaprutil1-dbd-sqlite3 (1.3.9+dfsg-5) ...
Setting up libaprutil1-ldap (1.3.9+dfsg-5) ...
Setting up apache2.2-bin (2.2.16-6+squeeze7) ...
Setting up apache2-utils (2.2.16-6+squeeze7) ...
Setting up apache2.2-common (2.2.16-6+squeeze7) ...
Enabling site default.
Enabling module alias.
Enabling module autoindex.
Enabling module dir.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module status.
Enabling module auth_basic.
Enabling module deflate.
Enabling module authz_default.
Enabling module authz_user.
Enabling module authz_groupfile.
Enabling module authn_file.
Enabling module authz_host.
Enabling module reqtimeout.
Setting up apache2-mpm-worker (2.2.16-6+squeeze7) ...
Starting web server: apache2.
Setting up apache2 (2.2.16-6+squeeze7) ...
Setting up ssl-cert (1.0.28) ...

これでインストール終了。
☆  ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆
一番初めに書いたメモと同様のコマンドで、インストールされたか確認してみる。

dpkg -l | grep apache | more

するとインストールされているのが分かる。(文が長いので折り返しています)
ii というのは、インストールされた印の様だ。

ii  apache2                               2.2.16-6+squeeze7
            Apache HTTP Server metapackage
ii  apache2-mpm-worker                    2.2.16-6+squeeze7
            Apache HTTP Server - high speed threaded model
ii  apache2-utils                         2.2.16-6+squeeze7
            utility programs for webservers
ii  apache2.2-bin                         2.2.16-6+squeeze7
            Apache HTTP Server common binary files
ii  apache2.2-common                      2.2.16-6+squeeze7
            Apache HTTP Server common files

指定したパッケージと、その依存に当たるパッケージがインストールされた。
これでインストールは終わり。

次回はDebian でのApache2 の設定に移る・・・と思ったが、
・・・その前にPHP5 も同様にインストールして設定という
ことにします。
(後日にこのページを編集したので、ほとんど説明になっているので
インストールの説明メモは残さないかもしれません。)

メモ終わり。 お粗末<_ _>

拍手[0回]

PR


  • 2012/04/27 03:31

コメント一覧

  • お名前
  • Email

  • コメント

  • Vodafone絵文字 i-mode絵文字 Ezweb絵文字
  • パスワード
[PR]