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)