PostgresQLのインストールと構成(win 2003テストに合格)

6208 ワード

Cygwin + PostgreSQL
環境:
  • Cygwin 1.5.10-3
  • Cygipc 2.03-2
  • PostgreSQL 7.4.3-1
  • Windows 2003
  • cygwinインストールディレクトリ:C:cygwinbinは、PostgresQLが含まれているcygwinをダウンロードしてインストールしたと仮定し、必要に応じて:1.cygserverをNTサービスにインストールして起動する($はシステムプロンプトで入力不要)a.スクリプトを実行する:$/usr/bin/cygserver-configb.win 2003で環境変数を設定する:CYGWIN=serverc.win 20032.新規ユーザーアカウントを再起動する:$net user postgres[password]/add$net user postgres/fullname:postgres$net user postgres/comment:'PostgreSQL User Account'$net user postgres/homedir:「$(cygpath-w/home/postgres)」注意:以上の[password]をパスワード3に置き換えてください.新規フォルダ:C:cygwinhomepostgres.4.更新ファイル:/etc/passwd$mkpasswd-l-u postgres>/etc/passwd意味:/etc/passwdファイルにユーザーpostgresの情報を加える5.データを格納するディレクトリを新規作成し、postgresをそのディレクトリの所有者に設定します:a.$mkdir/usr/share/postgresql/datab.$chown postgres/usr/share/postgresqlc. $ chown postgres/usr/share/postgresql/data6.ユーザ権限設定:a.[ローカルセキュリティ設定][ユーザ権限割り当て]:$cmd/c secpolを開く.mscb.「サービス登録」の属性として、ユーザーpostgres 7.データ領域aを初期化a.administratorをログアウトし、ユーザーpostgresでwin 2003に入り、コンソールでsuコマンドでユーザーb.$ initdb -D /var/postgresql/data

    を り えることはできない.8.postmaster(PostgreSQLのサーバ)をNTサービスにインストールし、$cygrunsrv-I postmaster-p/usr/bin/postmaster-aを する「-D/usr/share/postgresql/data-i」-y cygserver-s INT-u postgres–oそのパラメータの は の りです:-I postmaster:postmasterというサービス-p/usr/bin/postmasterを します:アプリケーションパスは/usr/bin/postmaster-a"-D/usr/usr/share/postgresql/data-i":postmasterはディレクトリ/usr/share/postgresql/dataをデータディレクトリとします.-i(TCP/IP )と-Dパラメータ-y cygserver:postmasterがcygserver-s INTに していることを す: INT when terminated is run by the user(-u)postgres-o:システム にサービスを するより なパラメータ コマンド:cygrunsrv-hおよびpostmaster--helpCygrunsrvでパスワード9を2 する があります.postgresqlデータベースにログインし、template 1はデータベースの に に されるテストデータベース:$psql-U postgres template 1[ ]cygwin:24679152 http://www.cnblogs.com/huqingyu/archive/2004/07/04/20976.aspxのインストールcygserver:24679152 http://discypus.jp/pc/cygwin/postgresql.shtmlに する[ ]1. はhttp://www.cygwin.com/cygwin-ug-net/using-cygserver.htmlを してください.サービスipc-daemon 2--install-as-serviceを くのはwin 2003ではだめです. のinitdbではselecting default max_connections... Signal 12はそこでインターネットを して を します:http://cygwin.com/ml/cygwin/2004-06/msg00457.htmlも の が したと って、http://www.sitepoint.com/article/use-postgresql-php-windowsは の を しました:http://www.cygwin.com/ml/cygwin/2004-06/msg00765.html の でヒント:o build against cygserver instead of cygipc o upgrade to PostgreSQL 7.4.22.「psql:could not connect to server」というプロンプトが された 、postmasterサービスが するかどうかを する があり、 していない は$ net start postmaster



    [インタフェース ]
    1. cygwin :
    $ cygcheck -c cygwin cygipc postgresql
    Cygwin Package Information
    Package              Version        Status
    cygipc               2.03-1         OK
    cygwin               1.5.10-3        OK
    postgresql           7.4.3-1          OK


    2.
    $ initdb -D /var/postgresql/data
    The files belonging to this database system will be owned by user "username".
    This user must also own the server process.
    The database cluster will be initialized with locale C.
    creating directory /var/postgresql/data... ok
    creating directory /var/postgresql/data/base... ok
    creating directory /var/postgresql/data/global... ok
    creating directory /var/postgresql/data/pg_xlog... ok
    creating directory /var/postgresql/data/pg_clog... ok
    selecting default max_connections... 100
    selecting default shared_buffers... 1000
    creating configuration files... ok
    creating template1 database in /var/postgresql/data/base/1... ok
    initializing pg_shadow... ok
    enabling unlimited row size for system tables... ok
    initializing pg_depend... ok
    creating system views... ok
    loading pg_description... ok
    creating conversions... ok
    setting privileges on built-in objects... ok
    creating information schema... ok
    vacuuming database template1... ok
    copying template1 to template0... ok
    Success. You can now start the database server using:
        /usr/bin/postmaster -D /var/postgresql/data
    or
        /usr/bin/pg_ctl -D /var/postgresql/data -l logfile start
    .postmasterサービスのステータス$cygrunsrv-Q postmasterService postmaster exists Type:Own ProcessCurrent State:Stoppped を します.Controls Accepted   :4.postmasterのログ$cat/var/log/postmasterを します.log            LOG:  shmdt(0xd00000) failed: Invalid argumentLOG:  database system was shut down at 2003-11-29 13:28:49LOG:  checkpoint record is at 0/A18780LOG:  redo record is at 0/A18780; undo record is at 0/0; shutdown TRUELOG:  next transaction ID: 554; next OID: 17147LOG:  database system is ready 5.postgresqlコンソール$psql-U postgres template 1 Welcome to psql 7.4,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 quittemplate1-#\q$