赞
踩
yum -y \
install \
openssl-devel \
readline \
readline-devel \
zlib \
zlib-devel \
uuid-devel \
systemd-devel
cd /home
wget --no-check-certificate -c https://ftp.postgresql.org/pub/source/v10.3/postgresql-10.3.tar.gz
tar -xf 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
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 unmask firewalld
systemctl enable firewalld
systemctl start firewalld
firewall-cmd --permanent --zone=public --add-port=5432/tcp
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
# 接下来输入密码
**************
# 退出
\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
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。