Ubuntu安装pg15和pgvector

Ubuntu 安装 pg15, 添加源

echo "deb http://apt.postgresql.org/pub/repos/apt focal-pgdg main" > /etc/apt/sources.list.d/pgdg.list

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

apt-get update

sudo apt install postgresql-15

 

apt-get install postgresql-15-pgvector

需要登陆到特定数据库创建扩展(扩展不是全局的)

psql langchain_chatchat
create extension vector;
select * from pg_available_extensions where name = 'vector';
CREATE TABLE "public"."test" ( 
  "field1" VARCHAR ( 64 ), 
  "field2" VARCHAR ( 128 ), 
  "field3" vector ( 1024 ), 
  CONSTRAINT "test_pkey" PRIMARY KEY ( "field1" ) 
);

启动 pg
sudo service postgresql start



修改uri中的用户名和密码

psql postgresql://postgres:pg123@172.17.0.3:5434/postgres

postgresql协议名称

postgres 用户名

pg123 密码

172.17.0.3 ip

5434 port

postgres 需要访问的数据库名称

为用户名赋予权限

GRANT USAGE, CREATE ON SCHEMA public TO postgres ;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO postgres ;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO postgres ;

 

 

ubuntu20.04二进制部署PostgreSQL 15.2 - 小吉猫 - 博客园 (cnblogs.com)

linux 安装 pgvector - 简书 (jianshu.com)

PostgreSQL的登录、创建用户、数据库并赋权_postgresql登录-CSDN博客

posted @ 2024-03-18 14:26  levylaw  阅读(399)  评论(0编辑  收藏  举报