티스토리 뷰

반응형

postgres 설치 방법 매번 찾는거 귀찮아서 정리해본다~!

postgresql 공식 사이트: https://www.postgresqltutorial.com/install-postgresql-linux/


postgresql 설치

1) postgresql 설치 

~$sudo apt-get install postgresql postgresql-contrib

(참고로 나는 기본적으로 Ubuntu에 설치되어 있는 postgresql 패키지(제공버전 10)를 사용하였다. 만약 다른 버전을 사용하고자 한다면 https://www.postgresql.org/download/linux/ubuntu/ 를 참고하면 될 것같다.)

(참고로 apt-cache serach postgres | grep postgresql* 을 이용해 확인해보면 postgres 관련 많은 패키지가 보이는데, 패키지 설명을 보고 원하는 패키지는 추가적으로 설치하면 된다. postgresql-contrib 는 postgresql을 사용하는데 있어서 편리한 기능들을 추가적으로 제공하므로 같이 설치해준다. )

2) postgres 계정 접속 

- postgresql을  설치하고 나면 postgres라는 계정이 생성된다. 해당 계정에서 psql을 접속한다.

(참고 : cat /etc/passwd | grep post* 를 이용해 postgres 계정 생성되었는지 확인할 수 있음)

~$sudo -i -u postgres (postgres 계정으로 변환)

postgres@~$psql (psql 접속)


postgresql 제거

1) postgres 패키지 목록 조회

~$dpkg -l | grep postgres

 

2) 조회된 postgres 관련 패키지 삭제

~$sudo apt-get --purge remove postgresql postgresql-10 postgresql-client-10 postgresql-client-common postgresql-common postgresql-contrib

 

3) postgresql에 사용되었던 각종 폴더 삭제

sudo rm -rf /var/lib/postgresql/

 

4) postgres 계정 삭제

sudo deluser postgres

참고:

https://askubuntu.com/questions/32730/how-to-remove-postgres-from-my-installation

반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2024/10   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
글 보관함