ユーザ用ツール

サイト用ツール


serverapps:nextcloud:03.postgresql_config

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

次のリビジョン
前のリビジョン
serverapps:nextcloud:03.postgresql_config [2023/08/07 03:19] – 作成 hayashiserverapps:nextcloud:03.postgresql_config [2023/08/07 03:20] (現在) hayashi
行 1: 行 1:
 ====== 03.PostgreSQLサーバの設定 ====== ====== 03.PostgreSQLサーバの設定 ======
 +
 +
 +===== rc.conf =====
 +
 +/etc/rc.confまたは/etc/rc.conf.localに記述
 +
 +  postgresql_enable="YES"
 +  postgresql_data="/usr/local/pgsql/DATA"
 +
 +data領域はzfsで別にとるので、disk追加してpool作成
 +
 +  # zpool create zdata /dev/adaxx
 +  # zfs create -o mountpoint=/usr/local/pgsql zdata/pgsql
 +  # mkdir /usr/local/pgsql/DATA
 +  # chown postgres:postgres /usr/local/pgsql/DATA
 +
 +===== 初期化 =====
 +
 +
 +<code>
 +# service postgresql initdb
 +The files belonging to this database system will be owned by user "postgres".
 +This user must also own the server process.
 +
 +The database cluster will be initialized with locales
 +  COLLATE:  C
 +  CTYPE:    C.UTF-8
 +  MESSAGES: C.UTF-8
 +  MONETARY: C.UTF-8
 +  NUMERIC:  C.UTF-8
 +  TIME:     C.UTF-8
 +The default text search configuration will be set to "english".
 +
 +Data page checksums are disabled.
 +
 +fixing permissions on existing directory /usr/local/pgsql/DATA ... ok
 +creating subdirectories ... ok
 +selecting dynamic shared memory implementation ... posix
 +selecting default max_connections ... 100
 +selecting default shared_buffers ... 128MB
 +selecting default time zone ... Japan
 +creating configuration files ... ok
 +running bootstrap script ... ok
 +performing post-bootstrap initialization ... ok
 +syncing data to disk ... ok
 +
 +initdb: warning: enabling "trust" authentication for local connections
 +You can change this by editing pg_hba.conf or using the option -A, or
 +--auth-local and --auth-host, the next time you run initdb.
 +
 +Success. You can now start the database server using:
 +
 +    /usr/local/bin/pg_ctl -D /usr/local/pgsql/DATA -l logfile start
 +</code>
 +
 +===== pg_hba.conf の編集 =====
 +
 +外部からの接続を /usr/local/pgsql/data/pg_hba.conf に設定します((標準では自分自身からの接続のみを許可しています))
 +
 +  # TYPE  DATABASE        USER            CIDR-ADDRESS            METHOD
 +  host    all             all             192.168.0.0/24          md5
 +
 +postgresql.confのlisten_addresses も変更
 +
 +  listen_addresses = '*'
 +
 +===== 起動 =====
 +PostgrSQLを起動
 +  # service postgresql start
 +
 +===== NextCloud用設定 =====
 +
 +<code>
 +# psql -h localhost -U postgres
 +psql (13.11)
 +Type "help" for help.
 +
 +postgres=# CREATE ROLE ncadm WITH LOGIN PASSWORD 'ncadmpassword';
 +CREATE ROLE
 +postgres=# CREATE DATABASE nc WITH OWNER ncadm TEMPLATE template0 
 +postgres=# ENCODING UTF8 LC_COLLATE 'ja_JP.UTF-8' LC_CTYPE 'ja_JP.UTF-8';
 +CREATE DATABASE
 +</code>
  
serverapps/nextcloud/03.postgresql_config.1691378363.txt.gz · 最終更新: 2023/08/07 03:19 by hayashi