Windows 上でのインストール

cygwin 編

cygwin のインストール

 http://www.cygwin.com/setup.exe をダウンロードし,インストールします. All を Install しておけば確実ですが, 部分的にインストールしたい場合は「cygwin のインストール」のページをご覧下さい.

Perl モジュールのインストール

Perl の確認

デスクトップのアイコンをクリックし,cygwin のコマンドプロンプトから以下を実行. Perl がインストールされていることを確認します.

Perl のバージョン確認

$ perl -v

This is perl, v5.8.7 built for cygwin-thread-multi-64int
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2005, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'.  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.


$

cpan コマンドのアップデート

cpan コマンドをアップデートするのですが, Compress::Raw::Zlib のインストールに失敗するので, これを先にインストールしておきます.

cpan を初めて起動すると,設定を聞いてきますが基本的にデフォルトのままリターンを入力していけば良いでしょう. "cpan -i Compress::Raw::Zlib" を実行します.

$ cpan -i Compress::Raw::Zlib
...
Are you ready for manual configuration? [yes]
...
CPAN build and cache directory? [/home/yourname/.cpan]
...
Cache size for build directory (in MB)? [10]
...
Perform cache scanning (atstart or never)? [atstart]
...
Cache metadata (yes/no)? [yes]
...
Your terminal expects ISO-8859-1 (yes/no)? [yes]
...
File to save your history? [/home/Satoshi/.cpan/histfile]
Number of lines to save? [100]
...
Policy on building prerequisites (follow, ask or ignore)? [ask]
...
Where is your gzip program? [/usr/bin/gzip]
Where is your tar program? [/usr/bin/tar]
Where is your unzip program? [/usr/bin/unzip]
Where is your make program? [/usr/bin/make]
Where is your lynx program? []
Where is your wget program? [/usr/bin/wget]
Where is your ncftpget program? []
Where is your ncftp program? []
Where is your ftp program? []
Where is your gpg program? []
What is your favorite pager program? [/usr/bin/less]
What is your favorite shell?
...
Typical frequently used settings:

    PREFIX=~/perl       non-root users (please see manual for more hints)

Your choice:  []
...
    -j3              dual processor system

Your choice:  []
...
    UNINST=1         to always uninstall potentially conflicting files

Your choice:  []
...
Timeout for inactivity during Makefile.PL? [0]
...
Your ftp_proxy?
Your http_proxy?
Your no_proxy?
...

ソースを取得するためのエリアを聞いてきますので,番号を入力します. これはまだ cpan の初期設定です.

(1) Africa
(2) Asia
(3) Central America
(4) Europe
(5) North America
(6) Oceania
(7) South America
Select your continent (or several nearby continents) [] 2
Sorry! since you don't have any existing picks, you must make a
geographic selection.

(1) China
(2) Hong Kong
(3) Indonesia
(4) Israel
(5) Japan
(6) Malaysia
(7) Philippines
(8) Republic of Korea
(9) Russian Federation
(10) Saudi Arabia
(11) Singapore
(12) Taiwan
(13) Thailand
(14) Turkey
Select your country (or several nearby countries) [] 5
Sorry! since you don't have any existing picks, you must make a
geographic selection.

(1) ftp://ftp.dti.ad.jp/pub/lang/CPAN/
(2) ftp://ftp.jaist.ac.jp/pub/lang/perl/CPAN/
(3) ftp://ftp.kddilabs.jp/CPAN/
(4) ftp://ftp.nara.wide.ad.jp/pub/CPAN/
(5) ftp://ftp.ring.gr.jp/pub/lang/perl/CPAN/
(6) ftp://ftp.u-aizu.ac.jp/pub/CPAN
(7) ftp://ftp.yz.yamagata-u.ac.jp/pub/lang/cpan/
(8) http://ftp.cpan.jp/
Select as many URLs as you like (by number),
put them on one line, separated by blanks, e.g. '1 4 5' [] 1 2 3 4 5 6 7 8

Enter another URL or RETURN to quit: []

ここまで入力すると "Compress::Raw::Zlib" のインストールが開始されます.

CPAN Shell を使用していると DLL の置き換えができないので,手作業でインストールするように促すメッセージが途中で表示されます. ここで n を入力してインストールを中断させます.

Please note that this module cannot be installed on Cygwin using the CPAN
shell. The CPAN Shell uses Compress::Raw::Zlib internally and it is not
possible to delete an active DLL.

If you are running the CPAN shell, please exit it and install this module
by hand by running 'make install' under the directory

    ~/.cpan/build/Compress-Raw-Zlib-VERSION

Do you want to continue? [Y/N]: n
exiting...
Running make test
  Make had some problems, maybe interrupted? Won't test
Running make install
  Make had some problems, maybe interrupted? Won't install

中断した後,Compress-Raw-Zlib-VERSION ("VERSION" は実際のバージョンです.このドキュメントの執筆時点では "2.005" でした) ディレクトリに移り,"make install" を実行します. Makefile が作成されていないので,perl Makefile.PL を実行して,Makefile を作成します.

$ cd ~/.cpan/build/Compress-Raw-Zlib-2.005/
$ perl Makefile.PL

再び先ほどと同じメッセージがでますが,今回は y を入力して,Makefile を作成します.

I see you are running Cygwin.

Please note that this module cannot be installed on Cygwin using the CPAN
shell. The CPAN Shell uses Compress::Raw::Zlib internally and it is not
possible to delete an active DLL.

If you are running the CPAN shell, please exit it and install this module
by hand by running 'make install' under the directory

    ~/.cpan/build/Compress-Raw-Zlib-VERSION

Do you want to continue? [Y/N]: y
continuing...
Parsing config.in...
Building Zlib enabled
Auto Detect Gzip OS Code..
Setting Gzip OS Code to 3 [Unix/Default]
Looks Good.
Up/Downgrade not needed.
Checking if your kit is complete...
Looks good
Writing Makefile for Compress::Raw::Zlib

"make install" を実行します.

$ make install
cp lib/Compress/Raw/Zlib.pm blib/lib/Compress/Raw/Zlib.pm
AutoSplitting blib/lib/Compress/Raw/Zlib.pm (blib/lib/auto/Compress/Raw/Zlib)
...
Installing /usr/lib/perl5/site_perl/5.8/cygwin/Compress/Raw/Zlib.pm
Writing /usr/lib/perl5/site_perl/5.8/cygwin/auto/Compress/Raw/Zlib/.packlist
Appending installation info to /usr/lib/perl5/5.8/cygwin/perllocal.pod

(ディスクの容量を節約したい場合には,この後に "make clean" を実行するとよいでしょう)

こののち,Bundle::CPAN をアップデートします.

$ cpan -i Bundle::CPAN
CPAN: Storable loaded ok
Going to read /home/Satoshi/.cpan/Metadata
...
    File::Spec
    Cwd
Shall I follow them and prepend them to the queue
of modules we are processing right now? [yes]
...
    IO::Uncompress::Gunzip
    IO::Compress::Gzip
    IO::Uncompress::Base
    IO::Compress::Gzip::Constants
    IO::Compress::Base
    IO::Compress::Base::Common
Shall I follow them and prepend them to the queue
of modules we are processing right now? [yes]
...
Ah, I see you already have installed libnet before.

Do you want to modify/update your configuration (y|n) ? [no]
...
Flipping rl_default_selected each line.

Enter arithmetic or Perl expression: exit
...
Continue installing YAML.pm? [y]
...
    IO::Uncompress::Base
    IO::Compress::Base
Shall I follow them and prepend them to the queue
of modules we are processing right now? [yes]
...
Writing /usr/lib/perl5/site_perl/5.8/cygwin/auto/File/HomeDir/.packlist
Appending installation info to /usr/lib/perl5/5.8/cygwin/perllocal.pod
  /usr/bin/make install  -- OK

"cpan -v" を実行して,cpan shell がアップデートされたことを確認します.

$ cpan -v
/usr/bin/cpan script version 1.9, CPAN.pm version 1.9102

Catalyst モジュールのインストール

次に,実行に必要となる Perl のモジュールをインストールします.

依存関係を自動で判別できないようですので,先に Module::Install モジュールをインストールしておきます.

  • Module::Install
$ cpan -i Module::Install

以下のリストは必要となるモジュールです.数字は開発時のバージョンを表しています.このバージョンよりも新しいものであれば,まず問題なく動作するでしょう.

  • Catalyst -- 5.7007
  • Digest::SHA -- 5.44
  • DBIx::Class -- 0.07005
  • DBIx::Class::Schema::Loader
  • Catalyst::Model::DBIC::Schema -- 0.20
  • Catalyst::Plugin::Session -- 0.14
  • Catalyst::Plugin::Session::State::Cookie -- 0.07
  • Cache::FastMmap -- 1.16
  • Catalyst::Plugin::Session::Store::FastMmap -- 0.02
  • Catalyst::Plugin::Static::Simple -- 0.17
  • Catalyst::Plugin::Authentication -- 0.09
  • Catalyst::Plugin::Authentication::Credential::Password -- (0.09)
  • Catalyst::Plugin::Authentication::Store::DBIC -- 0.07
  • Catalyst::Plugin::Charsets::Japanese -- 0.06
  • Catalyst::Plugin::ConfigLoader -- 0.14
  • Catalyst::View::TT -- 0.25
  • Catalyst::Action::RenderView -- 0.05
  • DBD::Pg (PostgreSQL 用)
  • Catalyst::Devel (開発用)
  • Catalyst::Plugin::StackTrace -- 0.06 (デバッグ用)

各モジュールのインストールは以下のようにして行います.

cpan -fi Catalyst

依存関係により,インストールの途中で追加のモジュールをインストールするかどうかを尋ねられますが,基本的にすべてインストールします.同様にして上に列挙したモジュールをすべてインストールします.モジュールによっては相互に依存してインストールできない場合がありますので,"-f" オプションをつけて,強制的にインストールしておきます.

Secure-SBM の立ち上げ確認

開発に参加しない場合は,Secure-SBM を展開したディレクトリの "lib/SecureSBM.pm" ファイルを編集します.

Index: lib/SecureSBM.pm
===================================================================
--- lib/SecureSBM.pm    (revision 308)
+++ lib/SecureSBM.pm    (working copy)
@@ -13,12 +13,10 @@
 # Static::Simple: will serve static files from the applications root directory
 #
 use Catalyst qw/
-               -Debug
                ConfigLoader
                Static::Simple
                Charsets::Japanese

-               StackTrace

                Authentication
                Authentication::Store::DBIC

"-Debug" の行と "StackTrace" の行を削除します. (CPAN モジュール "Catalyst::Plugin::StackTrace" をインストールしてある場合は, これらの行を削除しなくてもエラーなく動作します.)

"script/securesbm_server.pl" を実行すると,CPAN モジュールに不足がなければ,以下のようなメッセージが表示されます.

$ ./script/securesbm_server.pl
You can connect to your server at http://vulcan:3000

Ctrl-C で終了させます.データベースの設定を行っていないので,この段階ではまだ使用できません.

PostgreSQL のインストール

CPAN モジュールのインストールのために cygwin インストール時に PostgreSQL サーバを選択しましたが, cygwin の PostgreSQL は使用しません. PostgreSQL 8.x からは Windows 版がリリースされていますので,それを利用します.

日本 PostgreSQL ユーザ会のホームページ  http://www.postgresql.jp/PostgreSQL/8_2/8_2_4 から

Windows 版をダウンロードします(最新版がリリースされている場合は,そちらをご利用ください).

postgresql-8.2-ja.zip を解凍後,postgresql-8.2-ja.msi を起動します.

表示内容にしたがって簡単にインストールできますが, インストール時に設定する「エンコーディング」は「UTF-8」を選択してください. 詳細を見たい方は こちら をご覧下さい.

PostgreSQL の起動

スタートメニューから [すべてのプログラム]→[PostgreSQL]→[サービスの起動]を選択し, サービスを開始します.

PostgreSQL サービスの起動

PostgreSQL 用の設定変更

Secure-SBM 用のユーザを作成します.Secure-SBM をダウンロードし,展開したディレクトリに securesbm.yml というファイルに設定します. 初期の設定では,PostgreSQL データベースで使用するデータベース名,ユーザとそのパスワードはそれぞれ ssbmdb, ssbm, ssbm となっています.securesbm.yml の以下の行を変更します.

Model::SecureSBMDB:
  connect_info:
    - 'dbi:Pg:dbname=ssbmdb' <= データベース名
    - 'ssbm' <= ユーザ名
    - 'ssbm' <= パスワード
    -  AutoCommit: 1

単に動作を確認するだけの場合にはこのままでも構いませんが,セキュリティ上好ましくないので,設定を変更して作業を進めます.ここでは,データベース名,ユーザ名,パスワードをそれぞれ newdb, user1, pwd1 と設定するものとします. cygwin から使用するには,TCP/IP で接続する必要があるため,"host=127.0.0.1" をセミコロン (';') で区切って設定します.

変更後の設定は以下のようになります.

Model::SecureSBMDB:
  connect_info:
    - 'dbi:Pg:dbname=newdb;host=127.0.0.1'
    - 'user1'
    - 'pwd1'
    -  AutoCommit: 1

これらの設定を元に,PostgreSQL にデータベースを作成します.

PostgreSQL のユーザの作成

[スタート]→ [すべてのプログラム]→[PostgreSQL]→[コマンド・プロンプト] を選択し,コマンドウィンドウを起動します.コマンドプロンプトから "createuser" を実行します.

C:\Program Files\PostgreSQL\8.2\bin>createuser -U postgres -SdRWP user1
Enter password for new role:  <= ここでパスワードを入力します.設定してある "pwd1" を入力しました.
Enter it again:               <= ここでパスワードを入力します.設定してある "pwd1" を入力しました.
Password:                     <= ユーザ postgres のパスワードを入力します.
CREATE ROLE

これで,データベースにアクセスするためのユーザが作成できました.

データベースの作成

[スタート]→ [すべてのプログラム]→[PostgreSQL]→['postgres'へのpsql] を選択し,データベースを作成します.

"CREATE DATABASE newdb OWNER user1;" という SQL を発行し,データベースを作成します.

Password for user postgres: <= ユーザ postgres のパスワードを入力します.
Welcome to psql 8.2.4, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

postgres=# CREATE DATABASE newdb OWNER user1;
CREATE DATABASE
postgres=# \q  <= 終了する場合には  \q を入力します.

"\q" を入力して,終了します.

テーブルの作成

ダウンロードして展開したファイルの中に utils/createPostgreSQLTables.sql というファイルがあります. このファイルを使用して,データベースを作成します.

PostgreSQL のユーザの作成」で使用したウィンドウを使用して "psql -U user1 newdb < \somewhere\Secure-SBM\utils\createPostgreSQLTables.sql" を実行します.

C:\Program Files\PostgreSQL\8.2\bin>psql -U user1 newdb < c:\cygwin\home\user\Secure-SBM\utils\createPostgreSQLTables.sql
NOTICE:  CREATE TABLE will create implicit sequence "users_user_id_seq" for serial column "users.user_id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "users_pkey" for table "users"
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "users_user_email_key" for table "users"
CREATE TABLE
NOTICE:  CREATE TABLE will create implicit sequence "roles_role_id_seq" for serial column "roles.role_id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "roles_pkey" for table "roles"
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "roles_role_name_key"for table "roles"
CREATE TABLE
...
NOTICE:  CREATE TABLE / UNIQUE will create implicit index "adminstatus_adminstatus_proxy_key" for table "adminstatus"
CREATE TABLE
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1

C:\Program Files\PostgreSQL\8.2\bin> exit

最後にコマンドプロンプトに "exit" を入力して終了します.

これで,データベースの準備ができました.

Secure-SBM の起動

Secure-SBM が動作することを確認します.

cygwin のコマンドプロンプトを開き,Secuer-SBM のディレクトリで以下のコマンドを実行します.

./script/securesbm_server.pl

このコマンドにより,ポート 3000 番にアクセスすることで,アプリケーションを起動できます.

出力例:

$ ./script/securesbm_server.pl
You can connect to your server at http://yourhostname:3000

これでサーバの準備ができました.

ブラウザでの確認と管理者パスワード変更

インストール時のブラウザでの確認と管理者パスワード変更」をご覧下さい.


トップページへ


ActivePerl 編 (未だ,成功していません)

(未だ,成功していません)

ActivePerl のインストール

perl -v

ppm: Catalyst

ppm: Template-Toolkit

ppm: Catalyst-Plugin-Session-Store-File 失敗!

未だ成功せず.


トップページへ