cygwin版のpsqlをインストール
Windowsのpostgresqlをインストールしたが、このpsqlは使い勝手が悪いので、
cygwin版をインストールした。
cygwinのインストール
http://www.cygwin.com/からsetup-xx.exeをダウンロードし実行する。
インストールを進めるとパッケージを選択できる画面が表示されるので、
下記を追加で選択してインストールを完了させる。
Devel / bison Devel / gcc-core Devel / flex Devel / gettext-devel Devel / make Devel / readline Libs / zlib-devel Perl / perl
psql のコンパイルとインストール
私の環境ではhttp://ftp.postgresql.org/pub/source/v9.0.14/postgresql-9.0.14.tar.bz2
をダウンロードしてコンパイルした。
$ tar jxvf postgresql-9.0.14.tar.bz2 $ cd postgresql-9.0.14
psqlと、必要なlibpqライブラリに関連するconfigure オプションを指定。(日本語メッセージとマルチスレッド対応)
$ ./configure --enable-nls --enable-thread-safety
続いて、psql と libpq を make し、インストール。
$ cd /usr/src/postgresql-9.0.14/src/bin $ make $ make install $ cd /usr/src/postgresql-9.0.14/src/interfaces/libpq $ make install
~/.bash_profileに下記を追記
export PATH=/usr/local/pgsql/bin:/usr/local/pgsql/lib:$PATH export PGHOST=localhost export PGCLIENTENCODING=sjis export PGUSER=postgres # ログインユーザを postgres に export LANG=ja # メッセージを日本語に export LESS='--raw-control-chars' # psqlのページャで日本語を表示 alias ls='ls --show-control-chars' # lsで日本語を表示
.bash_profileを反映させる。
$ source ~/.bash_profile