[root@localhost app]# tar xzf postgresql-9.6.1.tar.gz [root@localhost app]# cd postgresql-9.6.1 [root@localhost postgresql-9.6.1]# ./configure --prefix=/mnt/app/pgsql [root@localhost postgresql-9.6.1]# make [root@localhost postgresql-9.6.1]# make install
2. 插件安装
1 2
[root@localhost postgresql-9.6.1]# cd contrib/ [root@localhost contrib]# make install
补充: 安装一个插件
1 2
[root@localhost postgresql-9.6.1]# cd contrib/pgcrypto/ [root@localhost pgcrypto]# mkdir install
3. 环境变量设置
1 2 3 4
[root@localhost postgresql-9.6.1]# echo 'export PGSQL_HOME=/mnt/app/pgsql' | tee /etc/profile.d/postgresql.sh [root@localhost postgresql-9.6.1]# echo 'export PGSQL_BIN=${PGSQL_HOME}/bin' | tee -a /etc/profile.d/postgresql.sh [root@localhost postgresql-9.6.1]# echo 'export PATH=${PGSQL_BIN}:$PATH' | tee -a /etc/profile.d/postgresql.sh [root@localhost postgresql-9.6.1]# source /etc/profile
[root@localhost postgresql-9.6.1]# su - smallasa [smallasa@localhost ~]$ /mnt/app/pgsql/bin/initdb -D /mnt/data/pgsql/
2. 设置访问权限
1 2 3 4 5 6
[smallasa@localhost ~]$ vim /mnt/data/pgsql/pg_hba.conf local all all trust host all all 127.0.0.1/32 trust host all all ::1/128 trust host replication repl 192.168.0.0/16 md5 =>追加语句 host all all 192.168.0.0/16 md5 =>其它用户访问策略