linux32安装pgsql,Linux安装pgsql

作者QQ:67065435 QQ群:821635552

安装前的准备 yum install \

vim \

wget \

firewalld \

gcc \

gcc-c++ \

openssl-devel \

readline \

readline-devel \

zlib \

zlib-devel \

uuid-devel \

systemd-devel \

-y

安装PostGreSQL cd /home

wget https://ftp.postgresql.org/pub/source/v10.3/postgresql-10.3.tar.gz

tar -zxvf postgresql-10.3.tar.gz

cd postgresql-10.3

./configure \

--prefix=/usr/local/postgres/ \

--with-ossp-uuid \

--with-uuid=ossp \

--with-systemd \

--with-openssl \

make

make install

添加postgres用户并配置数据目录 mkdir /data/

mkdir /data/postgres/

useradd postgres

chown -R postgres:postgres /data/postgres/

chown -R postgres:postgres /usr/local/postgres/

chown -R postgres:postgres /home/postgresql-10.3/

配置启动防火墙 systemctl start firewalld

firewall-cmd --zone=public --add-port=5432/tcp --permanent

firewall-cmd --reload

修改环境变量 vim /etc/profile

export PGHOME=/usr/local/postgres

export PGDATA=/data/postgres

export PATH=$PATH:/usr/local/postgres/bin

ESC

:wq

source /etc/profile

初始化数据库 su postgres

/usr/local/postgres/bin/initdb -D /data/postgres

修改配置 su postgres

vim /data/postgres/pg_hba.conf

local all all trust

host all all 127.0.0.1/32 trust

host all all 0.0.0.0/0 trust

host all all ::1/128 trust

local replication all trust

host replication all 127.0.0.1/32 trust

host replication all 0.0.0.0/0 trust

host replication all ::1/128 trust

ESC

:wq

vim /data/postgres/postgresql.conf

listen_addresses = '*'

ESC

:wq

启动 su postgres

/usr/local/postgres/bin/pg_ctl -D /data/postgres -l logfile start

创建默认数据库及设置密码 su postgres

/usr/local/postgres/bin/createdb postgres

/usr/local/postgres/bin/psql postgres

# 已经进入了postgres控制台

\password

# 接下来输入密码

12345678

# 退出

\q

停止、启动、重启、重载 su postgres

/usr/local/postgres/bin/pg_ctl -D /data/postgres -l logfile stop

/usr/local/postgres/bin/pg_ctl -D /data/postgres -l logfile start

/usr/local/postgres/bin/pg_ctl -D /data/postgres -l logfile restart

/usr/local/postgres/bin/pg_ctl -D /data/postgres -l logfile reload

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值