両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン最新のリビジョン両方とも次のリビジョン |
windows:postgresql [2019/05/18 02:23] – 外部編集 非ログインユーザー | windows:postgresql [2019/08/16 14:12] – [インストール] ともやん |
---|
| |
===== インストール ===== | ===== インストール ===== |
- [[http://www.postgresql.jp/|NPO法人 日本PostgreSQLユーザ会]]より最新版をダウンロードしてくる。 | - [[http://www.postgresql.jp/|NPO法人 日本PostgreSQLユーザ会]]より最新版を[[https://www.postgresql.jp/download|ダウンロード]]してくる。\\ ここでは [[https://get.enterprisedb.com/postgresql/postgresql-11.4-3-windows-x64.exe|postgresql-11.4-3-windows-x64.exe]] をダウンロードする。 |
- postgresql-x.x.x-x-windows-x64.exe を実行する。 | - postgresql-x.x.x-windows-x64.exe を実行する。 |
- postgres のパスワードを設定してインストールを完了させる。 | - [Next >] ボタンをクリックしてインストールを続ける。\\ {{:windows:postgresql_installer_001.png?400|PostgreSQL Installer 001}}{{:windows:postgresql_installer_002.png?400|PostgreSQL Installer 002}}\\ {{:windows:postgresql_installer_003.png?400|PostgreSQL Installer 003}}{{:windows:postgresql_installer_004.png?400|PostgreSQL Installer 004}} |
- Application Stack Builderで pgBouncer、Npgsql(.NETから利用時)、psqlODBC(MS-Accessから利用時)、PostGIS(GIS機能を利用時)をインストールする。 | - postgres のパスワードを設定して [Next >] ボタンをクリックしインストールを続ける。\\ {{:windows:postgresql_installer_005.png?400|PostgreSQL Installer 005}}{{:windows:postgresql_installer_006.png?400|PostgreSQL Installer 006}}\\ {{:windows:postgresql_installer_007.png?400|PostgreSQL Installer 007}}{{:windows:postgresql_installer_008.png?400|PostgreSQL Installer 008}}\\ {{:windows:postgresql_installer_009.png?400|PostgreSQL Installer 009}}{{:windows:postgresql_installer_010.png?400|PostgreSQL Installer 010}} |
- 開発用に利用する場合は、[コントロール パネル] - [システムとセキュリティ] - [管理ツール] - [サービス] より以下のサービスのスタートアップの種類を手動に設定しておく。 | - [Finish] をクリックすると Application Stack Builder が起動する。\\ {{:windows:postgresql_installer_011.png?400|PostgreSQL Installer 011}} |
* postgresql-x64-x.x | - Application Stack Builder で pgBouncer、Npgsql(.NETから利用時)、psqlODBC(MS-Accessから利用時)、PostGIS(GIS機能を利用時)をインストールする。\\ [次へ >] をクリックし、リストから **PostgreSQL 11 |
| (x64) on port 5432** を選択して [次へ >] でインストールを進める。\\ {{:windows:postgresql_application_stack_builder_001.png?400|Application Stack Builder 001}}{{:windows:postgresql_application_stack_builder_002.png?400|Application Stack Builder 002}} |
| - インストールしたいアプリケーションを選択する。<code> |
| [v] pgBouncer |
| [v] Npgsql |
| [v] psqlODBC (64bit) |
| [v] PostGIS |
| </code>\\ {{:windows:postgresql_application_stack_builder_003.png?400|Application Stack Builder 003}}{{:windows:postgresql_application_stack_builder_004.png?400|Application Stack Builder 004}} |
| - [次へ >] をクリックすると必要なアプリケーションのダウンロードが開始される。{{:windows:postgresql_application_stack_builder_005.png?400|Application Stack Builder 005}}{{:windows:postgresql_application_stack_builder_006.png?400|Application Stack Builder 006}} |
| - 全てのダウンロードが完了したら [次へ >] でアプリケーションのインストールを開始する。\\ {{:windows:postgresql_application_stack_builder_007.png?400|Application Stack Builder 007}} |
| - Npgsql インストーラーの [Next >] をクリックしてインストールを行う。\\ {{:windows:postgresql_npgsql_installer_001.png?400|Npgsql Installer 001}}{{:windows:postgresql_npgsql_installer_002.png?400|Npgsql Installer 002}}\\ {{:windows:postgresql_npgsql_installer_003.png?400|Npgsql Installer 003}}{{:windows:postgresql_npgsql_installer_004.png?400|Npgsql Installer 004}} |
| - pgBouncer インストーラーの「言語の選択」で **Japanese - 日本語** のまま [OK] をクリックする。\\ {{:windows:postgresql_pgbouncer_installer_001.png?200|pgBouncer Installer 001}} |
| - [次へ >] をクリックしてインストールを進める。\\ {{:windows:postgresql_pgbouncer_installer_002.png?400|pgBouncer Installer 002}}{{:windows:postgresql_pgbouncer_installer_003.png?400|pgBouncer Installer 003}} |
| - postgres のパスワードを設定して [次へ >] をクリックしてインストールを進める。\\ {{:windows:postgresql_pgbouncer_installer_004.png?400|pgBouncer Installer 004}} {{:windows:postgresql_pgbouncer_installer_005.png?400|pgBouncer Installer 005}}\\{{:windows:postgresql_pgbouncer_installer_006.png?400|pgBouncer Installer 006}} {{:windows:postgresql_pgbouncer_installer_007.png?400|pgBouncer Installer 007}} |
| - PostGIS インストーラーの [Next >] をクリックしてインストールを行う。\\ {{:windows:postgresql_postgis_installer_001.png?400|PostGIS Installer 001}}{{:windows:postgresql_postgis_installer_002.png?400|PostGIS Installer 002}}\\ {{:windows:postgresql_postgis_installer_003.png?400|PostGIS Installer 003}} |
| - 以下の問い合わせに [はい] で答える。\\ <code> |
| ラスター変換が機能するために必要な GDAL_DATA 環境変数を登録してもよろしいですか? |
| 既存の設定がある場合、これは上書きされます。</code>{{:windows:postgresql_postgis_installer_004.png?400|PostGIS Installer 004}} |
| - 以下の問い合わせに [はい] で答える。\\ <code> |
| ラスタドライバはデフォルトで無効になっています。 |
| 変更するには POSTGIS_GDAL_ENABLED_DRIVERS 環境変数を設定する必要があり、 |
| 変更を有効にするには PostgreSQL サービスを再起動する必要があります。 |
| POSTGIS_ENABLED_DRIVERS を共通ドライバ GTiff、PNG、JPEG、XYZ、DTED、USGSDEM、AAIGrid に設定しますか?</code>{{:windows:postgresql_postgis_installer_005.png?400|PostGIS Installer 005}} |
| - 以下の問い合わせに [はい] で答える。\\ <code> |
| dbからのラスタはデフォルトで無効になっています。 |
| POSTGIS_ENABLE_OUTDB_RASTERS 環境変数を 1 に設定する必要があります。 |
| データベースラスタを有効にしますか?</code>{{:windows:postgresql_postgis_installer_006.png?400|PostGIS Installer 006}} |
| - [Close] で PostGIS インストーラーを終了する。\\ {{:windows:postgresql_postgis_installer_007.png?400|PostGIS Installer 007}} |
| - 全てのインストールが完了したら Application Stack Builder を終了する。\\ {{:windows:postgresql_application_stack_builder_008.png?400|Application Stack Builder 008}} |
| - 開発用に利用する場合は、タスクバーの「ここに入力して検索」に services.msc を入力して Enter キーを押す。 |
| - 「サービス」より以下のサービスのスタートアップの種類を手動に設定しておく。 |
| * postgresql-x64-x |
* pgbouncer | * pgbouncer |
- pgsql_start.cmd ファイルを作成して手動起動できるようにしておく。<code> | - pgsql_start.cmd ファイルを作成して手動起動できるようにしておく。<file batch pgsql_start.cmd> |
powershell -command start \"net\" -verb runas -argumentlist \"start postgresql-x64-x.x\" | powershell start-process net -argumentlist \"start postgresql-x64-x\" -verb runas |
powershell -command start \"net\" -verb runas -argumentlist \"start pgbouncer\" | powershell start-process net -argumentlist \"start pgbouncer\" -verb runas |
</code> | </file>※**x** はインストールバージョンで置き換える。 |
- pgsql_stop.cmd ファイルを作成して手動停止できるようにしておく。<code> | - pgsql_stop.cmd ファイルを作成して手動停止できるようにしておく。<file batch pgsql_stop.cmd> |
powershell -command start \"net\" -verb runas -argumentlist \"stop postgresql-x64-x.x\" | powershell start-process net -argumentlist \"stop postgresql-x64-x\" -verb runas |
powershell -command start \"net\" -verb runas -argumentlist \"stop pgbouncer\" | powershell start-process net -argumentlist \"stop pgbouncer\" -verb runas |
</code> | </file>※**x** はインストールバージョンで置き換える。 |
| |
==== pgBouncer の設定 ==== | ==== pgBouncer の設定 ==== |
- pgbouncer_edit.cmd ファイルを作成して、設定を編集できるようにしておく。<code> | - pgbouncer_edit.cmd ファイルを作成して、設定を編集できるようにしておく。<WRAP prewrap 100%><file batch pgbouncer_edit.cmd> |
powershell -command start \"notepad\" -verb runas -argumentlist \"C:\\Program Files (x86)\\PgBouncer\\share\\pgbouncer.ini\" | powershell -command start \"notepad\" -verb runas -argumentlist \"C:\\Program Files (x86)\\PgBouncer\\share\\pgbouncer.ini\" |
</code> | </file></WRAP> |
- pgbouncer.ini の以下の部分を修正する。<code> | - pgbouncer.ini の以下の部分を修正する。<code> |
[databases] | [databases] |
</code> | </code> |
| |
===== pgAdmin3 のインストール ===== | |
- [[http://www.pgadmin.org/download/windows.php|pgAdmin: Download - Windows ™]]より最新版をダウンロードしてくる。 | |
- pgadmin3-x.xx.x.zip を解凍し pgadmin3.msi を実行してインストールする。 | |