Cygwin + PostgreSQL インストール後の設定 (postgresql-7.4.2-1 以降)

  環境変数



Cygwin に PostgreSQL パッケージをインストールしても PostgreSQL そのものは
インストールされません。以降にインストール手順を記述しますが、まず最初に Windows
環境変数 を設定して下さい

1) CYGWIN=server
2) PGDATA=/postgres



  cygserver.exe の起動 (バックグラウンド)

  
$ /usr/sbin/cygserver.exe &
  



  システムの初期化 (initdb の起動)

ユーザは、Windows にログインしているユーザが作成されます。バスワードはありません

  
$ initdb -E EUC_JP
  


以下は 7.4.5-1 の実行結果です

  
$ initdb -E EUC_JP
The files belonging to this database system will be owned by user "lightbox".
This user must also own the server process.

The database cluster will be initialized with locale C.

creating directory /postgres... ok
creating directory /postgres/base... ok
creating directory /postgres/global... ok
creating directory /postgres/pg_xlog... ok
creating directory /postgres/pg_clog... ok
selecting default max_connections... 40
selecting default shared_buffers... 1000
creating configuration files... ok
creating template1 database in /postgres/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 /postgres
or
    /usr/bin/pg_ctl -D /postgres -l logfile start
  



  postgresql.conf の変更

  
C:\cygwin\postgres\postgresql.conf をエディタで変更します
( Cygwin 内からは /postgres/postgresql.conf )
  

  
#---------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#---------------------------------------------------------------------------

# - Connection Settings -

tcpip_socket = true
max_connections = 40
	# note: increasing max_connections costs about 500 bytes of shared
	# memory per connection slot, in addition to costs from shared_buffers
        # and max_locks_per_transaction.
  



  .bash_profile の変更

C:\cygwin\home\ログインユーザ名\.bash_profile

今後、Cygwin コンソールを開けた時に PostgreSQL を起動するようにします

  
# base-files version 3.2-1

# ~/.bash_profile: executed by bash for login shells.

if [ -e /etc/bash.bashrc ] ; then
  source /etc/bash.bashrc
fi

if [ -e "${HOME}/.bashrc" ] ; then
  source "${HOME}/.bashrc"
fi

# Set PATH so it includes user's private bin if it exists
# if [ -d "${HOME}/bin" ] ; then
   PATH=.:${PATH}
# fi

# Set MANPATH so it includes users' private man if it exists
# if [ -d "${HOME}/man" ]; then
#   MANPATH=${HOME}/man:${MANPATH}
# fi

# Set INFOPATH so it includes users' private info if it exists
# if [ -d "${HOME}/info" ]; then
#   INFOPATH=${HOME}/info:${INFOPATH}
# fi

/usr/sbin/cygserver.exe &
if [ -e /postgres/postmaster.pid ] ; then
	rm /postgres/postmaster.pid
fi
pg_ctl start -l logfile
  



  PostgreSQL が正常にインストールされた事を確認

Cygwin コンソールを開いている場合はいったん閉じて再度開けます

以下は Cygwin コンソールに表示されるメッセージです

  
cygserver: Initialization complete.  Waiting for requests.
postmaster successfully started
  

コマンドプロンプトより以下を入力して現在カタログされているデータベースを確認します

  
psql -l 
  

以下は実行結果です


$ psql -l
        List of databases
   Name    |  Owner   | Encoding
-----------+----------+----------
 template0 | lightbox | EUC_JP
 template1 | lightbox | EUC_JP
(4 rows)



  データベースの作成

以下のコマンドをプロンプトより入力して実行します
( ※ 現在ログインしているユーザ名をデータベース名とする場合は createdb のみ入力します )

  
createdb データベース名
  



  ODBC ドライバのインストール

もっとも簡単なものは こちら からダウンロードできます



  一連の処理の詳細説明

こちら を参照して下さい










  infoboard   管理者用   
このエントリーをはてなブックマークに追加





フリーフォントWEBサービス
SQLの窓WEBサービス

SQLの窓フリーソフト

素材

一般WEBツールリンク

SQLの窓

フリーソフト

JSライブラリ