Postgresql Install & remove

기존 Postgresql 삭제하기

$ sudo systemctl stop postgresql-9.6.service

서비스 상태 보기

$ sudo systemctl list-unit-files postgresql*
UNIT FILE              STATE
postgresql-9.6.service enabled

서비스 비활성화

$sudo systemctl disable postgresql-9.6.service

postgresql 홈디렉토리 삭제

root# rm -rf /var/lib/pgsql

postgresql 계정 삭제

root$ userdel postgres
root$ groupdel postgres

패키지 로 설치 했기 때문에 패키지 삭제

설치된 패키지의 리스트를 확인하기 위해 아래 명령어

#yum list installed *postgres*

postgresql 패키지 삭제

#yum remove *postgres*

postgres패키지가 잘 삭제 됬는지 확인

#yum list installed *postgres*

Postgresql 10 설치하기

yum repostory 등록 ?

$ sudo rpm -Uvh https://yum.postgresql.org/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm



$sudo yum install postgresql10

설치 중 아래와 같이 오류가 나는점 ??

# rpm -Uvh https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm(을)를 복구합니다
준비 중...                         ################################# [100%]
        pgdg-redhat-repo-42.0-4.noarch 패키지는 이미 설치되어 있습니다

이미 yumrepo 에 설치 되어있다고 해서 postgresql을 설치 해봤다. 그러니....에러가..

$ sudo yum install -y postgresql10
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.kakao.com
 * extras: mirror.kakao.com
 * updates: ftp.jaist.ac.jp
No package postgresql10 available.
Error: Nothing to do

아래와 같은 명령어로 리스트를 확인해보니 96 버전은 있는데 10버전이 없었다.

#yum list installed *postgres*

yum repolist를 삭제하고 다시 해볼까 ??

$ll /etc/yum.repos.d/

pgdg 패키지를 yum repos.d 에서 삭제

$sudo rm -f /etc/yum.repos.d/pgdg-redhat-all.repo

이후 다시 확인 하면 pgdg repo가 삭제된것을 알수 있다.

[root@spark03 yum.repos.d]# ll
합계 124
-rw-r--r--. 1 root root  1664 11월 23  2018 CentOS-Base.repo
-rw-r--r--. 1 root root  1309 11월 23  2018 CentOS-CR.repo
-rw-r--r--. 1 root root   649 11월 23  2018 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root   630 11월 23  2018 CentOS-Media.repo
-rw-r--r--. 1 root root  1331 11월 23  2018 CentOS-Sources.repo
-rw-r--r--. 1 root root  5701 11월 23  2018 CentOS-Vault.repo
-rw-r--r--. 1 root root   314 11월 23  2018 CentOS-fasttrack.repo
drwxr-xr-x. 4 root root  4096  5월 31 17:10 dbserver8530
-rw-r--r--. 1 root root   607  5월 14 11:43 setup.json

이후 다시 pgdg...를 repo에 등록해준다

$ sudo rpm -Uvh https://yum.postgresql.org/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm



$sudo yum install postgresql10 postgresql10-server

그럼 설치 완료

다음리눅스는 yum과 rpm 에 대해서 공부 해보자

참고

https://tecadmin.net/install-postgresql-server-centos/

https://zetawiki.com/wiki/Yum_repo_%EC%A0%9C%EA%B1%B0

'BackEnd > Linux' 카테고리의 다른 글

Bash 프로그래밍 기초 - 파라미터 받아오기  (0) 2019.08.20
Bash 프로그래밍 기초 - If  (0) 2019.08.20
Bash 프로그래밍 기초 - for  (0) 2019.08.20
Bash 프로그래밍 기초 - array  (0) 2019.08.19
파일 행 수 세기  (1) 2019.07.09

+ Recent posts