*postgres7.4.x+Perl Moduleのインストール [#qd46c569]

RIGHT:更新日&lastmod();  

[[ここ:http://www.postgresql.org/]]からPostgresqlを、 [[ここhttp://cpan.uwinnipeg.ca/htdocs/faqs/cpan-search.html?request=search]]からPerl Module(pgsql_perl5-1.9.0.tar.gz)をDownloadする。
[[ここ:http://www.postgresql.org/]]からPostgresqlを、 [[ここ:http://cpan.uwinnipeg.ca/htdocs/faqs/cpan-search.html?request=search]]からPerl Module(pgsql_perl5-1.9.0.tar.gz)をDownloadする。
**postgres7.4.xのインストール [#b21ca4d5]

事前にpostgresというユーザを作成。

vine3.0ではreadline-devel-4.3-5vl1.i386.rpmがインストールされていないで
インストールする

 $ tar zxvf postgresql-7.4.1.tar.gz
 $ cd postgresql-7.4.1
 $ ./configure --enable-multibyte=EUC_JP --enable-syslog --with-perl \
 --with-openssl <-sslを有効にする
 (8.2では--enable-multibyte=EUC_JP --enable-syslogのオプションがなくなった)
 $ make
 $ su
 # make install
 # chown -R postgres.postgres /usr/local/pgsql

postgresの.bash_profileに

     # PostgreQSL
     export PATH="$PATH":/usr/local/pgsql/bin
     export POSTGRES_HOME=/usr/local/pgsql
     export PGLIB=$POSTGRES_HOME/lib
     export PGDATA=$POSTGRES_HOME/data
     export MANPATH="$MANPATH":POSTGRES_HOME/man
     export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$PGLIB"

    を追加。

$ source .bash_profile

     $ initdb

 (8.2ではここで文字コードを指定
 
 $ initdb --encoding=EUC_JP
 The files belonging to this database system will be owned by user "postgres".
 This user must also own the server process.
 
 The database cluster will be initialized with locale ja_JP.eucJP.
 
 creating directory /usr/local/pgsql/data ... ok
 creating subdirectories ... ok
 selecting default max_connections ... 100
 selecting default shared_buffers/max_fsm_pages ... 24MB/153600
 creating configuration files ... ok
 creating template1 database in /usr/local/pgsql/data/base/1 ... ok
 initializing pg_authid ... ok
 initializing dependencies ... ok
 creating system views ... ok
 loading system objects' descriptions ... ok
 creating conversions ... ok
 setting privileges on built-in objects ... ok
 creating information schema ... ok
 vacuuming database template1 ... ok
 copying template1 to template0 ... ok
 copying template1 to postgres ... ok
 
 WARNING: enabling "trust" authentication for local connections
 You can change this by editing pg_hba.conf or using the -A option the
 next time you run initdb.
 
 Success. You can now start the database server using:
 
     postgres -D /usr/local/pgsql/data
 or
     pg_ctl -D /usr/local/pgsql/data -l logfile start)
 ========= 8.2の説明ここまで ===============================
 
     $ cd /usr/local/pgsql/data
     $ chmod 600 pg_hba.conf

pg_hba.confを編集
 # TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK           METHOD
 
 host       yotei      www            192.244.75.xxx  255.255.255.248    trust
 host       yotei      www            192.244.75.xxx  255.255.255.255    trust
 host       yotei      all            10.3.1.xxx      255.255.255.255    trust
 host       yotei      all            0.0.0.0         0.0.0.0            reject
  
 
 host       all        all            127.0.0.1       255.255.255.255    trust

 logを取るために

  postgresql.confで

   #log_connections = false
   log_connections = true
   #log_timestamp = false
   log_timestamp = true

に変更する。Logファイルははじめに以下のように作成しておく。

 # touch /var/log/postgresql.log
 # chown postgres.postgres /var/log/postgresql.log
 # chmod o-r /var/log/postgresql.log

またネットワークで使用する場合以下の設定も必要かも
 
postgresql.confで
 #tcpip_socket = false
 を
 tcpip_socket = true

**起動 [#lb2c4990]
 $ pg_ctl -w start
 	または、
 $ /usr/local/pgsql/bin/postmaster -i -D /usr/local/pgsql/data >/var/log/postgresql.log 2>&1 &

このとき/tmp/.sPGSQL.5432 があると起動しないので消しておく

また、

/usr/local/pgsql/data/postmaster.pid

も削除しておく。

**Perl Moduleのインストール [#k9fd989d]
モジュールのコンパイルはpostgresユーザで行う。

このときPostgreSQLが動作している必要がある。でないと

make testでエラーする。

 $ tar zxvf pgsql_perl5-1.9.0.tar.gz
 $ cd pgsql_perl5-1.9.0
 $ perl Makefile.PL
 $ make
 $ make test

ところが、このバージョンでは

 PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib -I/usr/lib/perl5/5.6.1/ i386-linux -I/usr/lib/perl5/5.6.1 test.pl
 Can't call method "errorMessage" on an undefined value at test.pl line 99.
 make: *** [test_dynamic] エラー 255

のようなエラーが出たので

test.plを修正

99行目あたり

 #( $$Option_ref{port} ne "" && $$Option_ref{dbname} ne "" && $$Option_ref{user} ne "" ) <---コメントアウト

 ( $$Option_ref{port} ne "" && $$Option_ref{dbname} eq "" && $$Option_ref{user} ne "" )  <---追加
     and print "Pg::conndefaults ........ ok\n"
     or  die   "Pg::conndefaults ........ not ok: "; #, $conn->errorMessage;
                                                  ^^^^<---追加

119行目あたり
 #( $conn->errorMessage =~ /Database .?rumpumpel.? does not exist/ ) <---コメントアウト
 ( $conn->errorMessage =~ 'FATAL:  database "rumpumpel" does not exist' ) <---追加


再度 $ make test

 PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib -I/usr/lib/perl5/5.6.1/i386-linux -I/usr/lib/perl5/5.6.1 test.pl
 Pg::conndefaults ........ ok
 Pg::connectdb ........... ok
 $conn->exec ............. ok
 $conn->errorMessage ..... ok
 $conn->db ............... ok
 $conn->user ............. ok
 $conn->port ............. ok
 $conn->cmdStatus ........ not ok: CREATE TABLE
 $conn->oidStatus ........ ok
 $conn->getline .......... ok
 $conn->endcopy .......... ok
 $result->cmdTuples ...... ok
 $result->fname .......... ok
 $result->ftype .......... ok
 $result->fsize .......... ok
 $result->fnumber ........ ok
 $result->fetchrow ....... ok
 test sequence finished.
 
 $ su
 # make install

					DE JE2ISM      2004/02
細かいPostgresqlの設定は[[ここ:https://wwwism.dyndns.org/hp/linux/postgres.htm]]にある。

--------------------------------------------------------------------------------
RIGHT:[[元ページ:https://wwwism.dyndns.org/hp/linux/coimap.htm]]
RIGHT:[[元ページ:https://wwwism.dyndns.org/hp/linux/psqlperl.htm]]



トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS