PostgreSQLのサイレントインストール
EDBから入手可能なPostgreSQLのインストーラは、引数に --help をつけることで様々なオプションを表示できる。主要なオプションは以下の通り。
--mode unattended: unattended(無人)モードをオンにし、ユーザーが操作せずにインストールできる。--unattendedmodeui none:--mode unattendedと併用することでサイレントインストールになる。--enable-components server,pgAdmin,stackbuilder,commandlinetools: インストールするコンポーネント--prefix "C:\Program Files\PostgreSQL\14": インストール先--datadir "C:\Program Files\PostgreSQL\14\data": データ格納先--superpassword postgres: スーパーユーザー(postgres)のパスワード--serverport 5432: ポート
使用例
デフォルト設定でサイレントインストールする。
postgresql-14.13-2-windows-x64.exe ^
--mode unattended ^
--unattendedmodeui none ^
--superpassword postgres ^
--serverport 5432
おまけ PostgreSQL 14 インストーラのヘルプ
PostgreSQL 14
Usage:
--help Display the list of valid options
--version Display product information
--unattendedmodeui <unattendedmodeui> Unattended Mode UI
Default: minimal
Allowed: none minimal minimalWithDialogs
--optionfile <optionfile> Installation option file
Default:
--debuglevel <debuglevel> Debug information level of verbosity
Default: 2
Allowed: 0 1 2 3 4
--mode <mode> Installation mode
Default: qt
Allowed: qt win32 unattended
--debugtrace <debugtrace> Debug filename
Default:
--enable-components <enable-components> Comma-separated list of components
Default: server,pgAdmin,stackbuilder,commandlinetools
Allowed: server pgAdmin stackbuilder commandlinetools
--disable-components <disable-components> Comma-separated list of components
Default:
Allowed: server pgAdmin stackbuilder commandlinetools
--installer-language <installer-language> Language selection
Default: en
Allowed: en es fr
--extract-only <extract-only>
Default: 0
--superaccount <superaccount> Sets the user name of the database superuser. Defaults to 'postgres'.
Default: postgres
--servicename <servicename> Sets the name of the database service.
Default:
--serviceaccount <serviceaccount> Sets the operating system user account that owns the server process. Defaults to 'postgres'.
Default:
--servicepassword <servicepassword> Sets the password for the operating system user account that owns server process. Defaults to superuser password.
Default:
--install_runtimes <install_runtimes> Specifies whether or not install the Microsoft Visual C++ runtimes before the installation proceeds.
Default: 1
--enable_acledit <enable_acledit> Check and give the read permissions on the complete data directory path for the service account.
Default: 0
--create_shortcuts <create_shortcuts> Specifies whether or not menu shortcuts should be created.
Default: 1
--prefix <prefix> Installation Directory
Default: C:\Program Files\PostgreSQL\14
--datadir <datadir> Data Directory
Default: C:\Program Files\PostgreSQL\14\data
--superpassword <superpassword> Password
Default:
--serverport <serverport> Port
Default: 5433
--locale <locale> Locale
Default: