다름이 아니라 linux에 postgresql 16 & postgis 34 버전 설치하려고하는데 sudo나 root 계정없이 설치하려고 합니다.
아무리 찾아도 너무 어려운데 볼 수 있는 자료나 고견 부탁드립니다.
모델광2024-11-28 (목) 06:53
저는 root 이외 계정으로 설치해본적 없습니다.
ChatGPT 답변 입니다.
Steps to Install PostgreSQL 16 Without Root or Sudo
1. Download PostgreSQL Source Code
Visit the PostgreSQL official site: PostgreSQL Downloads
Download the PostgreSQL 16 source tarball:
bash
코드 복사
wget https://ftp.postgresql.org/pub/source/v16.0/postgresql-16.0.tar.gz 2. Extract the Source Code
bash
코드 복사
tar -xzf postgresql-16.0.tar.gz
cd postgresql-16.0
3. Prepare a Local Installation Directory
Create a directory in your home directory where PostgreSQL will be installed:
bash
코드 복사
mkdir -p ~/postgresql16
4. Build and Install PostgreSQL
Configure the build process to install PostgreSQL in your local directory:
bash
코드 복사
./configure --prefix=$HOME/postgresql16
Compile the source code:
bash
코드 복사
make
Install PostgreSQL to your specified directory:
bash
코드 복사
make install
5. Set Environment Variables
Add PostgreSQL binaries to your PATH:
bash
코드 복사
export PATH=$HOME/postgresql16/bin:$PATH
Add the above line to your .bashrc or .bash_profile for future sessions:
bash
코드 복사
echo 'export PATH=$HOME/postgresql16/bin:$PATH' >> ~/.bashrc
6. Initialize the Data Directory
Create a directory for the PostgreSQL data files:
bash
코드 복사
mkdir -p ~/postgresql16/data
Initialize the database cluster:
bash
코드 복사
initdb -D ~/postgresql16/data
7. Start the PostgreSQL Server
Start the PostgreSQL server in the background:
bash
코드 복사
pg_ctl -D ~/postgresql16/data -l logfile start
To stop the server:
bash
코드 복사
pg_ctl -D ~/postgresql16/data stop
8. Connect to PostgreSQL
Connect to the server using psql:
bash
코드 복사
psql -d postgres
Notes
Port Configuration: By default, PostgreSQL runs on port 5432. If another instance is already using this port, modify the port in the postgresql.conf file located in the data directory.
User Permissions: Ensure you have sufficient disk space and write permissions in the directories you create for PostgreSQL.
Performance Considerations: User-level installations might be less performant compared to system-level installations, especially for production environments.
This process allows you to run PostgreSQL without requiring root or sudo privileges, making it ideal for development or testing purposes.
댓글주소
PostgresDBA2024-11-28 (목) 15:39
rpm 이나 deb 와 갈은 package 를 통해서 설치하려면 sudo 나 root 로 해야 합니다.
소스 컴파일해서 하면 위 권한은 필요 없겠죠.
그런데 postgis 까지 소스 컴파일해서 설치한다....가능은 합니다만 미친짓입니다.