포스트그레스 사용자와 데이타베이스 생성. Confluence 나 JIRA 설치용

Creating user

먼저 postgres 사용자로 전환

$ sudo -i -u postgres
CODE


  1. User 생성

    $ createuser jira --interactive
    
    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) n
    
    
    $ createuser confluence --interactive
    $ createuser bamboo --interactive
    $ createuser bitbucket --interactive
    CODE

    또는 psql 프롬프트에서도 가능

    # CREATE USER confluence WITH ENCRYPTED PASSWORD 'secret123';
    CODE

Database 생성

  1. postgres 사용자로 전환

    $ sudo -i -u postgres
    CODE
  2. DB 생성

    $ createdb jiradb -O jira --encoding='utf-8' --locale=en_US.utf8 --template=template0
    $ createdb confluencedb -O confluence --encoding='utf-8' --locale=en_US.utf8 --template=template0
    $ createdb bamboodb -O bamboo --encoding='utf-8' --locale=en_US.utf8 --template=template0
    $ createdb bitbucketdb -O bitbucket --encoding='utf-8' --locale=en_US.utf8 --template=template0
    CODE

또는 psql 프롬프트에서 입력 가능

$ sudo -i -u postgres psql
CODE
postgres=# CREATE DATABASE jiradb OWNER jira ENCODING 'utf-8';
postgres=# CREATE DATABASE confluencedb OWNER confluence ENCODING 'utf-8';
postgres=# CREATE DATABASE bamboodb OWNER bamboo ENCODING 'utf-8';
postgres=# CREATE DATABASE bitbucketdb OWNER bitbucket ENCODING 'utf-8';
CODE


Creating Role 생성

  1. psql 구동

    $ sudo -i -u postgres psql
    CODE
  2. Role 생성

    postgres=#  ALTER ROLE jira WITH PASSWORD 'password' ;
    postgres=# ALTER ROLE confluence WITH PASSWORD 'password'
    postgres=# ALTER ROLE bitbucket WITH PASSWORD 'password';
    postgres=# ALTER ROLE bamboo WITH PASSWORD 'password';
    CODE

연결 확인

옵션 대소문자 구분하니 주의

$ psql -U confluence -d confluencedb  -W -h localhost
CODE
  • -U : username
  • -d : database name
  • -W : password 사용
  • -h: 연결할 호스트. 제외할 경우 "peer authentication failed" 에러 발생 가능

See Also

Ref