閱讀740 返回首頁    go 阿裏雲 go 技術社區[雲棲]


ubuntu14.04源碼安裝postgresql 9.1

項目需要使用gisgraphy,怎奈gisgraphy3.0隻支持postgis1.5.因此隻能安裝老版本的posgresql和postgis了,從postgis的support matrix圖可以看到postgis不同版本支持的postgresql,


我安裝的是postgresql9.1.14.

1.下載postgresql9.1版本的源碼,https://www.postgresql.org/docs/9.1/static/install-short.html

2.解壓縮,然後切換到解壓縮後的文件夾下

3.運行命令:./configure

  此處可能會出現如下錯誤:

configure: error: readline library not found
我的解決辦法是:安裝libreadline6-dev

 sudo apt-get install libreadline6-dev

問題得到解決

4.運行命令:

  make

  make install

5.驗證安裝是否成功,輸入命令:

ls -l usr/local/pgsql/

如果 bin include lib 和 share都出現,說明安裝成功,


6.設置用戶賬戶

adduser postgres

passwd postgres

輸入密碼

7.創建postgresql 數據目錄:

mkdir /usr/local/pgsql/data/

chown postgres:postgres /usr/local/pgsql/data
ls -ld /usr/local/pgsql/data

會出現如下界麵

8.初始化postgresql數據目錄

su postgres

/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data/

9.驗證postgresql數據目錄

ls -l /usr/local/pgsql/data

出現如下界麵:

10.啟動pgsql數據庫

/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 &
cat logfile

出現如下界麵:

11.創建postgresql 數據庫,並驗證安裝是否成功

/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test

要是出現如下界麵,則恭喜你,安裝成功



最後更新:2017-04-03 05:39:49

  上一篇:go 【算法小總結】母函數模板
  下一篇:go 如何在BIOS中設置RAID?