postgresql Linux 二进制文件安装

来源:这里教程网 时间:2026-03-14 19:37:22 作者:

一、创建psotgres用户 groupadd postgres useradd -g postgres postgres 二、创建必须目录 下载路径https://www.enterprisedb.com/download-postgresql-binaries wget https://get.enterprisedb.com/postgresql/postgresql-9.6.4-1-linux-x64-binaries.tar.gz 进入下载目录 tar -xzf postgresql-9.6.4-1-linux-x64-binaries.tar.gz -C /data/service 创建data目录: mkdir -p /data/service/postgresql/data mkdir -p /data/service/postgresql/log 授权: chown -R postgres.postgres pgsql  (解压目录) chown -R postgres.postgres postgresql 三、初始化 cd /data/service/pgsql/ su postgres ./bin/initdb -E utf8 -D /data/service/postgresql/data 四、启动 ./postgres -D /data/service/postgresql/data/ > /data/service/postgresql/log/postgres.log &    关闭 ./pg_ctl -D /data/service/postgresql/data stop      登录  ./psql -U pg -d mydb ---------------------- 远程连接 1 修改pg_hba.conf文件 host  all    all    127.0.0.1/32     trust host  all    all    192.168.1.0/24    md5 其中,数字24是子网掩码,表示允许192.168.1.0--192.168.1.255的计算机访问!

相关推荐