[Rocky Linux] postgresql 16 + pgVector 설치

Rocky Linux 에 PostgreSQL 16 + pgVector 설치 과정

 

가. 시스템 업데이트

# dnf -y update
# dnf install epel-release

 

나. postgreSQL + pgVecgtor 다운로드 / 설치

# cd /home

# wget https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# wget https://download.postgresql.org/pub/repos/yum/16/redhat/rhel-8-x86_64/pgvector_16-0.7.0-2PGDG.rhel8.x86_64.rpm

# dnf install -y postgresql16-server
# /usr/pgsql-16/bin/postgresql-16-setup initdb
# systemctl enable postgresql-16
# systemctl start postgresql-16
# rpm -ivh pgvector_16-0.7.0-2PGDG.rhel8.x86_64.rpm

# dnf install postgresql16-contrib
# systemctl restart postgresql-16

 

다. 환경설정

아래의 설정을 해 주면, 외부에서 DBever 와 같은 툴로 접근이 가능

# vi /var/lib/pgsql/16/data/postgresql.conf
==========================
listen_addresses = '*'
max_connections = 1000 
==========================

# vi /var/lib/pgsql/16/data/pg_hba.conf
==========================
host    all             all             0.0.0.0/0               md5
==========================

 

 

라. 기타 설정

- postgres 의 password 설정, Extention 에 vector, uuid-ossp 생성

# su - postgres
$ psql
  # ALTER USER postgres WITH PASSWORD '______';
  # CREATE EXTENSION vector;
  # CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
  # SELECT extname FROM pg_extension;
  
 extname
-----------
 plpgsql
 vector
 uuid-ossp
(3개 행)

 

※ database 생성 및 user 추가

# su - postgres
$ psql
  # CREATE DATABASE DB_NAME;
  # CREATE USER USER_ID WITH PASSWORD '________';
  
# sudo -u postgres psql
\c DB_NAME
ALTER DATABASE DB_NAME OWNER TO USER_ID;
ALTER SCHEMA public OWNER TO USER_ID;
GRANT ALL ON DATABASE DB_NAME TO USER_ID;
GRANT USAGE, CREATE ON SCHEMA public TO USER_ID;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO USER_ID;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO USER_ID;
ALTER ROLE USER_ID IN DATABASE DB_NAME SET search_path TO public;
\q