[pgsql-jp: 33389] Re: install 成功、security設定と起動失敗。
小野@FJCT
ono @ fjct.fujitsu.com
2004年 6月 26日 (土) 12:25:41 JST
To:Yasuharu Ninomiya様
小野といいます。
ちなみに、PostgreSQLはROOTでインストールしてはだめですよ。
Installは成功したようです、とありますが、起動はRoot以外で実施し
ますので、ROOTで作ってはログオンカレントユーザでは起動できなく
なるのが普通。
しかし、メールの最後ではDBもテーブルもできてそうですが、だとする
と、postmasterも起動されているのではありません。?
ps -sでプロセスが見つかれば動いています。
僕が実際に構築した時の流れを記述します。
見比べてはいかがでしょうか。
例。
$ mkdir /u01/postgres/db/pgsql7.3.2
$ vi .cshrc
setenv POSTGRES_HOME /u01/postgres/db/pgsql
setenv PGLIB $POSTGRES_HOME/lib
setenv PGDATA $POSTGRES_HOME/data
$ tar xfz postgresql-7.3.2.tar.gz
$ cd postgresql-7.3.2
$ ./configure --prefix=/u01/postgres/db/pgsql7.3.2
$ make ; make install
$ cd /u01/postgres/db/
$ ln -s pgsql7.3.2 pgsql
$ initdb
$ cd $PGDATA;
$ vi pg_hba.conf
local all all trust
host all all 127.0.0.1 255.255.255.255 trust
$ pg_ctl -o "-S -i" start
$ createdb -E EUC_JP hogehoge
$ psql -l
List of databases
Name | Owner | Encoding
--------------+----------+-----------
hogehoge | postgres | EUC_JP
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
> Subject : [pgsql-jp: 33388] install 成功、security設定と起動失敗。
> From : Yasuharu Ninomiya <ninomii @ fml.nirs.go.jp>
> Date : Sat, 26 Jun 2004 11:25:33 +0900
>
> 以前に、Mac OSXへのinstallで色々とお騒がせ致しました二宮です。
> そのせつは、申し訳ありませんでした、
>
> 以下のように、PostgreSQLのInstallは成功したようです。
> しかし、今度は、install後のUser Access and Authentitication(つまりセキュリ
> ティー設定)がうまくいきません。postmasterが起動していない気がします。
> また、postgreSQLも起動しているのかよく判りません。
>
> マニュアル http://www.postgresql.jp/document/pg743doc/html/
> にも目を通しましたが、よく判りません。
>
> 何かお気づきの点がございましたらお教え頂けないでしょうか。
>
> よろしくお願い致します。
>
>
>
> PostgreSQLのinstallについて;
>
> Bash:Terminalにて施行:AppleのpostreSQL on Mac OSX mannualに従う。
>
> 成功理由:
>
> これまでは、finkの/sw/src/の下のpostgresの中で展開していた。よくみると、
> postgresの中にpostgresql-7.4.3があり、その下のsrcの中にpostgresql用のbin
> やincludeが展開していた。
>
> そこで、Terminalで、AppleのPostgreSQL on Mac OSXに忠実に従って施行した。以前
> うまくいかなかったのは、/usr/localの下にsrcがなかった為ではと思い、srcを作成
> してから施行した結果、Installまでは成功した。
>
>
>
> しかし、後のUser Access and Authentitication(つまりセキュリティー設定)が今
> 度は、うまくいかない。原因は不明。
> 後はUser Access and Authentitication(つまりセキュリティー設定)について;
>
> g4almi:~ ninomiya$ su -l postgresql
>
> (PostgreSQLはpostgresqlユーザーしか使用権限がないのでこれが必須と思われる。)
>
> Password:
>
> g4almi:~ postgresql$ emacs /usr/local/pgsql/data/pg_hba.conf
>
> TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
>
>
>
> local all all trust
>
> # IPv4-style local connections:
>
> host all all 127.0.0.1 255.255.255.255 trust
>
> # IPv6-style local connections:
>
> host all all ::1
> ffff:ffff:ffff:ffff:ffff:ffff¥
>
> :ffff:ffff trust
>
> このMethodの3カ所のtrustをすべてmd5に書き換えて、control&X, control&S
>
> control&X, control&Cで保存し、
>
> g4almi:~ postgresql$ cd /usr/local/pgsql
>
> g4almi:/usr/local/pgsql postgresql$psql testしたが、ダメ
>
>
>
> 少しやり方かえて下記のようにやったが、ダメ;
>
> g4almi:/usr/local/pgsql postgresql$ /usr/local/pgsql/bin/pg_ctl -D
> /usr/local/pgsql/data -l logfile start
>
> pg_ctl: Another postmaster may be running. Trying to start postmaster
> anyway.
>
> /usr/local/pgsql/bin/pg_ctl: line 341: logfile: Permission denied
>
> pg_ctl: cannot start postmaster
>
> Examine the log output.
>
> g4almi:/usr/local/pgsql postgresql$ psql test
>
> -su: psql: command not found
>
> g4almi:/usr/local/pgsql postgresql$
>
> 何が悪いのか原因不明。
>
>
>
> 翌日、改めて下記のようにやったが、ダメ
>
> g4almi:~ ninomiya$ su -l postgresql
>
> Password:
>
> g4almi:~ postgresql$ chown postgresql /usr/local/pgsql/data
>
> g4almi:~ postgresql$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l
> logfile start
>
> pg_ctl: Another postmaster may be running. Trying to start postmaster
> anyway.
>
> pg_ctl: cannot start postmaster
>
> Examine the log output.
>
> g4almi:~ postgresql$
>
> 原因不明
>
>
>
>
>
>
>
>
> Install成功までの処理内容;
>
> Last login: Fri Jun 25 17:56:18 on ttyp1
>
> Welcome to Darwin!
>
> g4almi:~ ninomiya$ cd /usr/local
>
> g4almi:/usr/local ninomiya$ sudo sh
>
> Password:
>
> sh-2.05b# mkdir src
>
> sh-2.05b# cd /usr/local/src
>
> sh-2.05b# pw
>
> sh: pw: command not found
>
> sh-2.05b# echo $HOME
>
> /Users/ninomiya
>
> sh-2.05b# mkdir /usr/local/src/postgre
>
> sh-2.05b# cd postgres
>
> sh: cd: postgres: No such file or directory
>
> sh-2.05b# rm /usr/local/src/postgre
>
> rm: /usr/local/src/postgre: is a directory
>
> sh-2.05b# mkdir /usr/local/src/postgres
>
> sh-2.05b# cd postgres
>
> sh-2.05b# mv /sw/src/postgres/postgresql-7.4.3.tar.gz
> /usr/local/src/postgres
>
> sh-2.05b# tar -xzvf postgresql-7.4.3.tar.gz
>
> 略
>
> postgresql-7.4.3/INSTALL
>
> 成功
>
>
>
> sh-2.05b# cd postgresql-7.4.3
>
> sh-2.05b# ./configure --with-includes=/sw/include/ --with-libraries=/sw/lib
>
> 略
>
> config.status: linking ./src/makefiles/Makefile.darwin to src/Makefile.port
>
> sh-2.05b#
>
> 成功
>
>
>
>
>
> sh-2.05b#make
>
> 略
>
> All of PostgreSQL successfully made. Ready to install.
>
> sh-2.05b#
>
> 成功
>
>
>
> sh-2.05b#make install
>
> 略
>
> PostgreSQL installation complete.
>
> sh-2.05b#
>
> 成功
>
>
>
> Mac OSX System PreferencesのAccountsでNew user設定;postgresql
>
> (何故か、postgresは設定不能だった。Usersにpostgres既にあり消せない)
>
> そしてそのまま管理者のninomiyaのTerminalにて
>
> sh-2.05b# mkdir /usr/local/pgsql/data
>
> sh-2.05b# chown postgresql /usr/local/pgsql/data
>
> sh-2.05b# su -l postgresql
>
>
>
> Databaseを初期化する。
>
> g4almi:~ postgresql$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
>
> 略
>
> Success. You can now start the database server using:
>
>
>
> /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data
>
> or
>
> /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
>
>
>
> g4almi:~ postgresql$
>
> 成功
>
>
>
> export PATH=$PATH:/usr/local/pgsql/bin
>
> パッチ:成功
>
>
>
> PostgreSQL server start準備;
>
> g4almi:~ postgresql$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l
> logfile start
>
> postmaster successfully started
>
> 成功
>
> g4almi:~ postgresql$ createdb test
>
> CREATE DATABASE
>
> g4almi:~ postgresql$
>
> 成功
>
>
>
> g4almi:~ postgresql$ psql test
>
> Welcome to psql 7.4.3, the PostgreSQL interactive terminal.
>
>
>
> Type: ¥copyright for distribution terms
>
> ¥h for help with SQL commands
>
> ¥? for help on internal slash commands
>
> ¥g or terminate with semicolon to execute query
>
> ¥q to quit
>
>
>
> test=# create table foo (name varchar, foo_id serial);ここでreturn
>
> NOTICE: CREATE TABLE will create implicit sequence "foo_foo_id_seq" for
> "serial" column "foo.foo_id"
>
> CREATE TABLE
>
> test=# insert into foo (name) values ('Liz'); ここでreturn
>
> INSERT 17151 1
>
> test=# insert into foo (name) values ('Jason'); ここでreturn
>
> INSERT 17152 1
>
> test=#
>
> 以上でinstallおよび準備終了。
pgsql-jp メーリングリストの案内