** Ubuntu server + PostgreSql
1. Ubuntu server 설치시 마지막에 postgresql server 선택하여 설치를 완료한다.
설치되어 있지 않다면
> sudo apt-get install postgresql-9.3
2. postgresql.conf 수정
> sudo vi /etc/postgresql/9.3/main/postgresql.conf
listen_addresses = '*'
3. pg_hba.conf 수정
> sudo vi /etc/postgresql/9.3/main/pg_hba.conf
# Database administrative login by UNIX sockets
local all postgres md5
# IPv4 local connection: 추가
# 모든 IP 접속을 해야하는경우는 0.0.0.0/0
host all all 192.168.0.2/32 md5
4. postgres 로 로그인
> sudo -u postgres psql
5. postgres 비밀번호 변경
postgres=# ALTER USER postgres WITH ENCRYPTED PASSWORD '1'
postgres=# \q
6. postgresql 재시작
# > sudo /etc/init.d/postgresql stop
> sudo /etc/init.d/postgresql restart
7. Database 생성
postgres=# CREATE USER test WITH PASSOWRD '1'
postgres=# CREATE DATABASE test
postgres=# \q
# database 삭제
# DROP DATABASE test
8. Database 접속
psql -U test -h localhost --dbname='test'
# 비밀번호 변경하기
# test=# ALTER USER test WITH ENCRYPTED PASSWORD '1'
**. 서버 종료
> sudo shutdown -h 0
'Test Code > Linux' 카테고리의 다른 글
[Crunchbang] R package 및 R Studio 설치 (0) | 2014.05.29 |
---|---|
[ubuntu] wxPython 설치 및 예제 (0) | 2014.05.09 |
Shell 스크립트 - 기본 (0) | 2014.05.07 |
[OpenSUSE 13.1] 코덱 설치 (0) | 2014.04.30 |
[OpenSUSE 13.1 ] 저장소 위치 변경 (0) | 2014.04.30 |