root# cd /usr/ports/databases/postgresql83-server/
root# make clean
root# make
root# make install
root# make clean
root# mkdir /home/pgsql
root# chmod 755 /home/pgsql
root# chown pgsql:pgsql /home/pgsql
- vipw を使って、ホームディレクトリが /home/pgsql になるよう /etc/passwd を修正する
データベースを初期化する
postgresql_enable="YES"
postgresql_initdb_flags="--encoding=EUC_JP --lc-collate=C"
root# /usr/local/etc/rc.d/postgresql initdb
データベースサーバを起動する
root# /usr/local/etc/rc.d/postgresql start
- この時点でコマンドを入れてみて、次のようにエラーになれば動いている
root# psql -l
psql: FATAL: role "root" does not exist
ユーザを登録する
- su - pgsql してからユーザ katsu を追加
pgsql% createuser katsu
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) y