sudo 권한을 못쓸때
서버의 주인은 따로 있고 보안 정책으로 인해 sudo 명령어도 못 쓰는 경우가 왕왕있다,
물론 관리자에게 얘기하고, sudo 권한을 달라고 할 수 있지만, 혼자 쓰는 서버가 아닌 여러명이 함께 쓰는 서버 일경우
sudo 권한을 사용하는 것은 힘들다.
No sudo, install postgresql
이럴때 postgres를 설치하고 사용하는 방법을 기록한다.
https://www.endpointdev.com/blog/2013/06/installing-postgresql-without-root/ 포스트를 참고하였다.
설치 환경을 아래와 같다.
1) Linux ( CentOS7)
2) non root
3) x86_64
4) Python3.10 설치 되어있음
1) Github에서 Postgres 설치 파일을 다운로드 받는다.
$ wget https://github.com/postgres/postgres/archive/master.zip
2) 다운로드 받은 파일의 압축을 해제한다.
$ unzip master.zip
3) 압축 해제된 폴더로 이동한다.
$ cd master
4) 해당 명령어를 순서대로 실행하여 postgres를 설치한다.
$ ./configure --prefix=$HOME/postgres/ --with-python PYTHON=/usr/bin/python3.6 --without-readline
$ make install
$ /home/{USER_NAME}/postgres/bin/pg_ctl -D /home/{USER_NAME}/postgres/data/ -l logfile start
$ /home/{USER_NAME}/postgres/bin/psql -U {usename} postgres
5) 제대로 설치됬는지 확인해보자(postgres 버전 보기)
$ postgres=# select version();
version
-----------------------------------------------------------------------------------------------------------
PostgreSQL 16devel on x86_64-pc-linux-gnu, compiled by gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2), 64-bit
이렇게 하면 root 계정이 아니더라도 사용자의 postgres 데이터 베이스를 만들수 있다.
728x90
반응형