| top へ |
Vine3.2でPostgresql、PHP、Apache構成 |
| 余裕のある人はアフィリエイトページ商品紹介をご覧になるのもいいかも。掘り出し物はあるかな。バナー集はこちら | |
| 参考にしたサイト http://collie.low-temp.sci.yamaguchi-u.ac.jp/~ashida/comp/psql.html http://www.miloweb.net/postgresql.html http://toto3.com/toto/linux/fedoracore2_postgresql.html |
|
| 1 | vine3.2のインストール 日立FLORA 128MBにインストール boot: text でインストール カスタム を選択 下記追加した。 X Windowシステム 日本語入力システム GNOMEデスクトップ インターネットクライアント Emacsエディタ FTPサーバー・・・・いずれ必要になるので。それに今回のテーマではないので。 基本開発ソフト その他のソフト Shells システム管理ツール ログインはグラフィック、色(16bit) 1024X768。 ・・・・インターネットからファイルを取得するにはいいです。 |
| 2 | インストール後 vi /etc/apt/sources.listで extras 追加 vi /etc/proftpd.confでanonymousFTPに#をつける DefaultRoot ~/ UseReverseDNS off IdentLookups off vi /etc/hosts.deny ALL:ALL vi /etc/hosts.allow proftpd:ALL, ALL:192.168.1.0/255.255.255.0 , ALL:localhost |
| 3 | Synapticを利用してUpdate,Upgrade、dist-upgradeした postgresql postgresql-server postgresql-libs インストール php、php-apache、php-postgresql インストール 最後にapt-get update apt-get upgarade apt-get dist-upgarde を行った。 これは Synapticと aptコマンドでは少し異なるような感じがしたので。 |
| 4 | http://www.miloweb.net/postgresql.htmlを手本にして進めた。 PostgreSQL を起動してみます。 この起動により、データベースの初期化、必要なファイルの生成や各種設定を自動的に行ってくれる様です。 root]# /etc/rc.d/init.d/postgresql start データベースを初期化中: [ OK ] Starting postgresql service: [ OK ] |
| 5 | PostgreSQL の最高権限を持つ「 postgres 」ユーザにパスワードを設定します [root@kdk45 gotsu]# passwd postgres Changing password for user postgres. New password: BAD PASSWORD: it is too short ・・・・短すぎると怒られました。 Retype new password: Sorry, passwords do not match New password:XXXXXXX・・・・・・・・・少し長い文字列にしました Retype new password: passwd: all authentication tokens updated successfully. |
| 6 |
ネットワーク経由でデータベースにアクセスするので、 /var/lib/pgsql/data/postgresql.conf を編集します。 上記 2 つのファイルが編集できたら、PostgreSQL を再起動します。 # /etc/rc.d/init.d/postgresql restart http://toto3.com//toto/linux/fedoracore2_postgresql.html に postgresuser02を作ってみる まずlinuxの一般ユーザを/homeに作る |
| 7 | 再びhttp://www.miloweb.net/postgresql.htmlを手本にして進めた。 # su - hoge $ createdb sampledb CREATE DATABASE <-- 正常にデータベースを作成した証 を参考に [root@kdk45 root]# su - postgresuser01 [postgresuser01@kdk45 postgresuser01]$ createdb sampl edb CREATE DATABASE 作成したデータベースを削除してみる [postgresuser01@kdk45 postgresuser01]$ dropdb sampled b DROP DATABASE ここまでは順調だったが 次にテーブルを作成します。 新規で SampleTable.sql というファイルを作成する。 drop table SampleTable; テーブルを作成する。 $ psql -f SampleTable.sql sampledb これで、エラーが出なかったら、成功です。 [postgresuser01@kdk45 postgresuser01]$ vi SampleTable.sql drop table SampleTable; CREATE TABLE SampleTable( No integer, Name varchar(20) ); :wq [postgresuser01@kdk45 postgresuser01]$ psql -f SampleTable. sql sampledb psql:SampleTable.sql:2: ERROR: table "sampletable" does not exist CREATE TABLE [postgresuser01@kdk45 postgresuser01]$ psql -n sampledb PostgreSQL の会話型ターミナル、psql 7.4.10 へようこそ \copyright とタイプすると、配布条件を表示します。 \h とタイプすると、SQL コマンドのヘルプを表示します。 \? とタイプすると、内部スラッシュコマンドのヘルプを表示します。 \g と打つかセミコロンで閉じると、クエリーを実行します。 \q で終了します。 sampledb=> \d SampleTable テーブル "public.sampletable" カラム | 型 | 修飾語 --------+-----------------------+-------- no | integer | name | character varying(20) | sampledb=> INSERT INTO sampleTable(no,name) VALUES(1,'GODZILLA'); INSERT 17146 1 sampledb=> SELECT * FROM SampleTable; no | name ----+---------- 1 | GODZILLA・・・・・・・データが登録されています。 (1 行) sampledb=> \q [postgresuser01@kdk45 postgresuser01]$ |
| 8 | Web 上からアクセス可能にする vine3.2ではapacheになっている [root@kdk45 root]# su - postgres -bash-2.05b$ createuser apache Shall the new user be allowed to create databases? (y/n) n Shall the new user be allowed to create more new users? (y/n) n CREATE USER -bash-2.05b$ |
| 9 | [root@kdk45 root]# su - postgresuser01 [postgresuser01@kdk45 postgresuser01]$ psql -n SampleDB psql: FATAL: database "SampleDB" does not exist・・・・大文字でエラー 小文字にして再度実施 [postgresuser01@kdk45 postgresuser01]$ psql -n sampledb PostgreSQL の会話型ターミナル、psql 7.4.10 へようこそ \copyright とタイプすると、配布条件を表示します。 \h とタイプすると、SQL コマンドのヘルプを表示します。 \? とタイプすると、内部スラッシュコマンドのヘルプを表示しま す。 \g と打つかセミコロンで閉じると、クエリーを実行します。 \q で終了します。 sampledb=> grant all on sampletable to apache; GRANT sampledb=> \q |
| 10 | [root@kdk45 root]# chkconfig postgresql on ・・・ここは一連の作業が済んでから実施 最初にやっておくべきかな〜 |
| 一応これで最小限のpostgresql環境は出来たらしいのです。 あとは買ってあった本に沿って進めたいと思います。 |
|