postgre--源碼安裝

  1. 下載源碼

打開官網,選擇源碼分區,選擇要下載的版本,這裏我要下載10的版本,所以選這個:
postgre源碼下載

在linux中輸入:

[root@node1 ~]# wget --no-check-certificate  https://ftp.postgresql.org/pub/source/v10.0/postgresql-10.0.tar.gz

解壓下載好的壓縮包:

[root@node1 ~]# tar -xvf postgresql-10.0.tar.gz 
  1. 運行configure程序配置編譯選項

先準備好編譯環境和安裝必要的包:

[root@node1 ~]# yum groupinstall "Development tools"
[root@node1 ~]# yum install -y bison flex readline-devel zlib-devel

configure程序配置編譯選項:

[root@node1 ~]# cd postgresql-10.0
[root@node1 postgresql-10.0]# ./configure --help | less
...
Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local/pgsql]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]
 
By default, `make install' will install all the files in
`/usr/local/pgsql/bin', `/usr/local/pgsql/lib' etc.  You can specify
an installation prefix other than `/usr/local/pgsql' using `--prefix',
for instance `--prefix=$HOME'.
...

對軟件目錄和端口進行指定:

[root@node1 postgresql-10.0]# ./configure --prefix=/opt/pg10/ --with-pgport=1921
  1. 編譯安裝
[root@node1 postgresql-10.0]# gmake
[root@node1 postgresql-10.0]# gmake install
....
/usr/bin/install -c -m 755 ./missing '/opt/pg10/lib/postgresql/pgxs/config/missing'
gmake[1]: Leaving directory `/root/postgresql-10.0/config'
PostgreSQL installation complete.

安裝成功後,查看數據庫版本。

[root@node1 postgresql-10.0]# /opt/pg10/bin/postgres --version
postgres (PostgreSQL) 10.0
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章