PostgreSQLをインストール&GitBucket用DB作成
はじめに
今後のアプリで使用するかもしれないのと、GitBucketでDBが必要だったのでPostgreSQLをインストールする
続けてGitBucket用データベースを作成する
PostgreSQLインストール
yum install postgresql-server
パッケージ
インストール完了
初期セットアップ(※ 初期インストール時だったので不要だったかも ← 必要)
postgresql-setup initdb
起動時に有効化 & PostgreSQL起動
# OS起動時にPostgreSQLを起動 systemctl enable postgresql # PostgreSQL起動 systemctl start postgresql
管理者ユーザのパスワード変更
postgres ユーザに変更
su - postgres
パスワード変更
psql -c “alter user postgres with password ‘*************’”
GitBucket用のデータベース作成
データベース作成
# PostgreSQL実行 psql -- DB作成 create database gitbucket WITH template template0 encoding 'utf8' lc_collate 'ja_JP.UTF-8' lc_ctype 'ja_JP.UTF-8'; -- 終了 \q
GitBucket用ユーザ作成
createuser -P gitbucket_user
設定変更
設定ファイル修正
/var/lib/pgsql/data/pg_hba.conf
変更前
# "local" is for Unix domain socket connections only local all all peer # IPv4 local connections: host all all 127.0.0.1/32 ident # IPv6 local connections: host all all ::1/128 ident
変更後
- md5(パスワード認証)に変更
# "local" is for Unix domain socket connections only local all all md5 # IPv4 local connections: host all all 127.0.0.1/32 md5 # IPv6 local connections: host all all ::1/128 md5
GitBucket上で確認
- システムセッティング画面上でDBがPostgreSQLになっていることを確認できたので完了
参考にさせて頂いたサイト
CentOS 7 : PostgreSQL : インストール : Server World
GitBucketをhttpsとPostgreSQLで構築してみた - Qiita
PostgreSQLでの認証の設定 | Netsphere Laboratories