离线安装 postgres 记录

下载postgresql-11.10.tar.gz和ossp-uuid_1.6.2.orig.tar.gz


$  useradd postgres
$  chown -R postgres.postgres /home/postgres/
$  tar -zxvf ossp-uuid_1.6.2.orig.tar.gz 
$  cd uuid-1.6.2/
$  ./configure
$  make
$  make install
$  tar -zxvf postgresql-11.10.tar.gz
$  cd postgresql-11.10/
$  ./configure --prefix=/home/postgres --enable-thread-safety --with-uuid=ossp --with-libs=/usr/local/lib --with-includes=/usr/local/include
$  make
$  make install
$  cd contrib
$  make
$  make install
$  find / -name libuuid.so.16
$  ln -s /usr/local/lib/libuuid.so.16 /home/postgres/lib
$  su - postgres

$  vim .bashrc
PGHOME=/home/postgres
export PGHOME
PGDATA=$PGHOME/data
export PGDATA
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$PGHOME/bin
export LD_LIBRARY_PATH=/home/postgres/lib
export PATH
$  source .bashrc
$  initdb -D $PGDATA  
$  pg_ctl start -D $PGDATA
$  vim $PGDATA/pg_hba.conf 
# IPv4 local connections:
host    all             all             0.0.0.0/0            trust
$  vim $PGDATA/postgresql.conf
listen_addresses = '*'
port = 5432 
$  pg_ctl restart -D $PGDATA

$  psql -U postgres
password
$  firewall-cmd --zone=public --add-port=5432/tcp --permanent 
$  firewall-cmd --reload
$  ps -ef|grep postgresql

原文地址:https://www.cnblogs.com/SuperDust/p/14384432.html