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用戶并配置數(shù)據(jù)目錄 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
修改環(huán)境變量 vim /etc/profile
export PGHOME=/usr/local/postgres
export PGDATA=/data/postgres
export PATH=$PATH:/usr/local/postgres/bin
ESC
:wq
source /etc/profile
初始化數(shù)據(jù)庫 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
創(chuàng)建默認數(shù)據(jù)庫及設(shè)置密碼 su postgres
/usr/local/postgres/bin/createdb postgres
/usr/local/postgres/bin/psql postgres
# 已經(jīng)進入了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
總結(jié)
以上是生活随笔為你收集整理的linux32安装pgsql,Linux安装pgsql的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux+向进城发送信号,信号 - i
- 下一篇: c语言求5个数最小公倍数,C语言,求从键