GnuPGのインストール
11月 11th, 2009 by admin
[前のページへ] <- – [目次] – ->[次のページへ]
GnuPGのインストール
1. 「Xcode」のインストール
Xcode Toolsがインストールされている必要があります。マックを購入した時に付いていたインストールディスクからインストールを行ってください。
インストールディスクをセットすると、Xcode Toolsフォルダが表示されるので、中にあるXcodeTools.mpkgファイルをダブルクリックしてインストールを行ってください。

2. MacPortsを使ったインストール
MacPorts
のページから/downloadsへ進み、お使いのOSのバージョンにあったMacPortsの最新版をダウンロードしてください。
ダウンロードしたファイルをマウントしてできたパッケージファイルをダブルクリックしてインストールしてください。
インストール先は/opt/local内になります。
環境変数を追加します。
ターミナルを起動して注意:入力する文字は「」の中のものです。
念のため「cd」と入力してリターンキー。
「sudo pico .bashrc」と入力してリターンキー。(bashrcの頭にあるドットを忘れずに)
管理者パスワードを求められたら入力してリターンキー
picoの画面になったら

上記の例では何も書かれていませんが、すでに何か書かれている場合は、最後に追加してください。
「export PATH=/opt/local/bin:/opt/local/sbin/:$PATH」と入力してリターンキー。
「export MANPATH=/opt/local/man:$MANPATH」と入力。
コントロール + o (オー)キーを押すと「File Name to Write」と表示されるのでリターンキーを押して保存
コントロール + x (エックス)キーを押してpicoを終了
念のため「source .bashrc」と入力してリターンキー。
「sudo pico .bash_profile」と入力してリターンキー。(bash_profileの頭にあるドットを忘れずに)
管理者パスワードを求められたら入力してリターンキー
picoの画面になったら、「source .bashrc」という記述があるか確認。

なければ
「source .bashrc」と入力。
コントロール + o (オー)キーを押すと「File Name to Write」と表示されるのでリターンキーを押して保存
コントロール + x (エックス)キーを押してpicoを終了
念のため「source .bash_profile」と入力してリターンキー。
これで環境変数の追加は完了しました。
「sudo port -d selfupdate」と入力してリターンキー。(アップデート)
すでにMacPortsをインストールしてあればここから
「sudo port -d sync」と入力してリターンキー。(リストの更新)
「sudo port install gnupg」と入力してリターンキー。(gnupgのインストール)
インストール完了までは時間がかかります。
終了したら、最後に「exit」と入力してリターンキーでターミナルを終了してください。
参考サイト
MacPortsでステキなUNIXツールをインストール – はこべにっき#
インストールが正しく完了したかを確認します。
「gpg –version」と入力してリターンキー。ダウンロードしたバージョンになっていればOKです。

画像は1.4.2.2のものです。
新規インストールの場合はさらに公開鍵と秘密鍵の生成を行ってください。
次に自分の公開鍵と秘密鍵の生成を行うので、ターミナルを起動し「gpg –gen-key」と入力してリターンキー。(以下の例は1.2.4でおこなったものです。)
Last login: ■■■■■ on ttyp1 Welcome to Darwin! PowerMac-G4:~ ■■■■■$ gpg --gen-key gpg (GnuPG) 1.2.4; Copyright (C) 2003 Free Software Foundation, Inc. This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. See the file COPYING for details. gpg: /Users/■■■■■/.gnupg: directory created gpg: new configuration file `/Users/■■■■■/.gnupg/gpg.conf' created gpg: WARNING: options in `/Users/■■■■■/.gnupg/gpg.conf' are not yet active during this run gpg: keyring `/Users/■■■■■/.gnupg/secring.gpg' created gpg: keyring `/Users/■■■■■/.gnupg/pubring.gpg' created Please select what kind of key you want: (1) DSA and ElGamal (default) (2) DSA (sign only) (4) RSA (sign only) Your selection? 1
Your selection?と聞かれるのでdefaultの「1」を入力してリターンキー。
DSA keypair will have 1024 bits.
About to generate a new ELG-E keypair.
minimum keysize is 768 bits
default keysize is 1024 bits
highest suggested keysize is 2048 bits
What keysize do you want? (1024)
What keysize do you want? (1024) と聞かれるので、よければそのままリターンキー。より強力なほがよければ「2048」と入力してリターンキー。
Requested keysize is 1024 bits
Please specify how long the key should be valid.
0 = key does not expire
<n> = key expires in n days
<n>w = key expires in n weeks
<n>m = key expires in n months
<n>y = key expires in n years
Key is valid for? (0)
Key is valid for?と聞かれるので、そのままリターンキー。
Key does not expire at all Is this correct (y/n)? y
Is this correct (y/n)?と聞かれるので、「y」と入力してリターンキー。
You need a User-ID to identify your key; the software constructs the user id
from Real Name, Comment and Email Address in this form:
"Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>"
Real name: ■■■■■ ■■■■■
Email address: webmaster@macfeeling.com
Comment:
You selected this USER-ID:
"■■■■■ ■■■■■ <webmaster@macfeeling.com>"
Real name:と聞かれるので、ローマ字で「名前」を入力してリターンキー。
Email address:と聞かれるので、使用するメールアドレスを入力してリターンキー。
Comment: と聞かれるので、特になければそのままリターンキー。
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O You need a Passphrase to protect your secret key.
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit?と聞かれるので、「O」(大文字のオー)を入力してリターンキー。
Enter passphrese Repeat passphrase
Enter passphreseと聞かれるので、任意の「パスフレーズ」を入力してリターンキー。
さらにRepeat passphraseと聞かれるので、もう一度同じ「パスフレーズ」を入力してリターンキー。
キーの生成が始まりますので、キーボードのキーを適当にたたくか、マウスを動かしてください。
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
+++++..+++++++++++++++.++++++++++++++++++++.+++++..
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
+++++..+++++++++++++++.++++++++++++++++++++.+++++..
gpg: /Users/■■■■■/.gnupg/trustdb.gpg: trustdb created
public and secret key created and signed.
key marked as ultimately trusted.pub ■■■■■/■■■■■ 2005-01-27 ■■■■■ ■■■■■ <webmaster@macfeeling.com>
Key fingerprint = ■■■■■ ■■■■■ ■■■■■ ■■■■■ ■■■■■ ■■■■■ ■■■■■ ■■■■■ ■■■■■ ■■■■■
sub ■■■■■/■■■■■ 2005-01-27
ホームに不可視フォルダ「.gnupg」が作成され中に各種ファイルが作成されます。以上でGnuPGのインストールは終了です。
もし、何らかの理由でやり直したい場合は、フォルダごと削除してください。
ホームに生成された不可視フォルダ「.gnupg」は別な場所にバックアップしておいてください。
念のため「cd」と入力してリターンキー。
ここでは書類フォルダ内にgnupgという名前でコピーします。
「cp -pR .gnupg ~/Documents/gnupg」と入力してリターンキー。
システムを入れ替えた場合
OSを入れ替えたりしたときは、バックアップしてある「gnupg」フォルダをターミナルでホームに戻してください。
念のため「cd」と入力してリターンキー。
「cp -pR 」と入力(半角スペースに注意)したら、Finderからバックアップしてある「gnupg」フォルダをドロップするとファイルパスが補完されます。
ここでは書類フォルダにgnupgという名前で補完していたとします。すると
「cp -pR /Users/xxxxxxx/Documents/gnupg」と補完(xxxxxxxはユーザ名)されるので
「cp -pR /Users/xxxxxxx/Documents/gnupg .gnupg」 と入力(半角スペースおよびドットに注意)してリターンキー。不可視フォルダとしてコピーされます。
参考ページ
How to initialize GnuPG on Mac OS X
