↓ 全体の手順です。コマンドも含めてこれだけ。開発環境の整備(ターミナルの選択や
1. download and extract //sourceforge.net/projects/msys2/files/Base/x86_64/msys2-base-x86_64-20160205.tar.xz/download //ftp.postgresql.org/pub/source/v9.5.3/postgresql-9.5.3.tar.bz2 2. open console at MSYS2 root directory and input commpand > usr\bin\bash --login -i $ logout 3. restart MSYS2 and install packages > set MSYSTEM=MINGW64 > usr\bin\bash --login -i $ pacman -S mingw-w64-x86_64-toolchain $ pacman -S make $ pacman -S mingw-w64-x86_64-libxml2 4. move to postgres source directory and build $ cdYOUR_SOURCE_DIR $ ./configure --enable-nls --host=x86_64-w64-mingw32 --with-libxml $ make $ export DESTDIR="YOUR_POSTGRES_DIR " $ make install 5. copy DLL files > copy msys64\mingw64\bin\libintl-8.dllYOUR_POSTGRES_BINDIR > copy msys64\mingw64\bin\libiconv-2.dllYOUR_POSTGRES_BINDIR > copy msys64\mingw64\bin\libxml2-2.dllYOUR_POSTGRES_BINDIR > copy msys64\mingw64\bin\zlib1.dllYOUR_POSTGRES_BINDIR
使うのはコマンドプロンプトと、適当な解凍ソフトだけ。以下、順番に補足します。画像は
Contents
- 1. MSYS2 + MinGW-w64
ポータブル版と、PostgreSQL ソースファイルの準備 - 2. MSYS2
の最初の起動 - 3. MSYS2
を再起動。最低限必要なパッケージを入れる - 4. PostgreSQL
をビルドし、任意の場所にインストール - 5.
依存する DLL をインストール先にコピーし、完了
1. MSYS2 + MinGW-w64 ポータブル版と、PostgreSQL ソースファイルの準備
MSYS2» msys2-base-x86_64-20160205.tar.xz (42.9MB)
上記リンクで直接ダウンロード ↓ できます。サイトのウェブページからもたどれますが、SourceForge
ファイルは
MSYS2
2. MSYS2 の最初の起動
先ほど解凍したmsys64
> usr\bin\bash --login -i
本来は途中で画面クリアされるはずのところ、コマンドプロンプトのせいか
3. MSYS2 を再起動。最低限必要なパッケージを入れる
MSYS> set MSYSTEM=MINGW64 > usr\bin\bash --login -i
PostgreSQL
$ pacman -S mingw-w64-x86_64-toolchain $ pacman -S make $ pacman -S mingw-w64-x86_64-libxml2
4. PostgreSQL をビルドし、任意の場所にインストール
コマンドプロンプト上で、最初に準備した$ ./configure --enable-nls --host=x86_64-w64-mingw32 --with-libxml
次に
$ make ... All of PostgreSQL successfully made. Ready to install.
そして
$ export DESTDIR="YOUR_POSTGRES_DIR " $ make install ... PostgreSQL installation complete.
5. 依存する DLL をインストール先にコピーし、完了
make installDESTDIR |-- usr |-- local |-- pgsql |-- bin |-- include |-- lib +-- share
MSYS2
今回必要な
$ logout > copy msys64\mingw64\bin\libintl-8.dllYOUR_POSTGRES_BINDIR > copy msys64\mingw64\bin\libiconv-2.dllYOUR_POSTGRES_BINDIR > copy msys64\mingw64\bin\libxml2-2.dllYOUR_POSTGRES_BINDIR > copy msys64\mingw64\bin\zlib1.dllYOUR_POSTGRES_BINDIR
以上ですべて終了。後は普通の
次にデータベース初期化。コマンド
> initdb --no-locale -E utf8 -U postgres ../data
最後に ↓ データベースサーバを
> pg_ctl -D ../data start > psql -U postgres # select version(); # \q > pg_ctl -D ../data stop
バージョンを見ると
今回は