Linux發行版:Ubuntu 16.04 LTS
1.安裝依賴庫: apt install build-essential zlib1g-dev libreadline6-devweb
2.編譯安裝
./configure --prefix=/opt/pg-10.1
make world
make install
進入contrib目錄 make install -- 把擴展都安裝上數據庫
3.安裝後配置環境變量 /etc/profile加入
JAVA_HOME=/opt/jdk1.8.0_151/bin
PATH=/opt/pg-10.1/bin:$JAVA_HOME/bin:$PATH
export PGDATA=/opt/pgdata
export PGDATABASE=web
export PGUSER=postgres
export PGPORT=5432
export LD_LIBRARY_PATH=/opt/pg-10.1/lib:$LD_LIBRARY_PATH
export PATH JAVA_HOMEpost
4.建立數據庫管理的用戶postgres:adduser postgresui
5.建立數據庫Cluster的目錄 mkdir /opt/pgdatait
受權給postgres chown postgres.postgres /opt/pgdata編譯
6.初始化 su - postgres後 initdb變量
7.啓動數據庫 pg_ctl start擴展