安装配置

postgresql使用二进制包安装

安装步骤

# 下载PostgreSQL二进制包
wget https://example.com/path/to/postgresql-13.2.tar.gz
tar -zxvf postgresql-13.2.tar.gz
cd postgresql-13.2
 
# 配置安装选项,包括指定安装目录
./configure --prefix=/opt/postgresql
 
# 编译并安装
make
make install
 
# 初始化数据库
/opt/postgresql/bin/initdb -D /opt/postgresql/data
 
# 启动数据库服务器
/opt/postgresql/bin/postgres -D /opt/postgresql/data >logfile 2>&1 &

在上面的示例中,--prefix=/opt/postgresql 参数指定了PostgreSQL的安装目录为/opt/postgresql。初始化数据库时,指定了数据目录为/opt/postgresql/data。启动数据库服务器时,将日志输出重定向到logfile文件中,并保持标准输出和标准错误都指向同一个日志文件。

posted @ 2026-05-18 13:54  数据库小白(专注)  阅读(14)  评论(0)    收藏  举报