프로그래밍/DB

리눅스(ubuntu)에 postgreSQL 설치하기

kugancity 2018. 11. 24. 19:32
반응형




리눅스에 postgreSQL 설치한 과정을 정리해두겠다. 


apt-get install로 아래와 같이 패키지 설치를 한다. 


sudo apt-get install postgresql postgresql-contrib








# sudo apt-get install postgresql postgresql-contrib

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following packages were automatically installed and are no longer required:

  duplicity librsync1 python-lockfile

Use 'apt-get autoremove' to remove them.

The following extra packages will be installed:

  libossp-uuid16 libpq5 postgresql-9.3 postgresql-client-9.3

  postgresql-client-common postgresql-common postgresql-contrib-9.3

Suggested packages:

  uuid oidentd ident-server locales-all postgresql-doc-9.3 libdbd-pg-perl

The following NEW packages will be installed:

  libossp-uuid16 libpq5 postgresql postgresql-9.3 postgresql-client-9.3

  postgresql-client-common postgresql-common postgresql-contrib

  postgresql-contrib-9.3

0 upgraded, 9 newly installed, 0 to remove and 578 not upgraded.

Need to get 4,137 kB of archives.

After this operation, 17.7 MB of additional disk space will be used.

Do you want to continue? [Y/n]

...




이제 설치가 완료되었으니 psql로 command line 을 실행해보자. 


root로 psql을 실행하면 아래와 같이 root라는 role이 없다고 에러가 나온다.




root# psql

psql: FATAL:  role "root" does not exist



아직 root라는 role이 생성이 안되어 있으니
아래와같이 postgresql 의 슈퍼 유저인 postgres 로 실행을 해야한다. 


sudo -u postgres psql

postgres에 들어오면 아직 암호가 설정이 안되어 있으니 
마지막으로 password로 암호를 설정하고 \q로 종료한다. 



postgres=# \password postgres
Enter new password:
Enter it again:
postgres=# \q






728x90
반응형