ubuntu系統下postgres安裝python語言、postgres安裝圖資料AgensGraph
一、首先安裝python,ubuntu預設有python2.7,python3.5,我採用的是python3.6.5版本。
2. 解壓檔案 $> tar -zxvf Python-3.6.5.tgz -C /usr/local/
重新命名 $ usr/local > mv Python-3.6.5 python3.6
進入bin目錄配置檔案 $ usr/local/python3.6/bin > ./configure --prefix=/usr/local/ –enable-shared
編譯 $ usr/local/python3.6/bin > make
安裝 $ usr/local/python3.6/bin > make install
3. 讓ubuntu 預設使用python3.6
在usr/bin 目錄下
$ /usr/bin > ln -s /usr/local/python3.6/python python3.6
$ /usr/bin > rm python
$/usr/bin > ln -s python3.6 python
進入 usr/lib/usr/local/python3.6 目錄
$ /usr/local/python3.6 > cp libpython3.6m.so.1.0* /usr/lib
二、AgensGraph安裝
1. 進入 /usr/local
2. $ /usr/local > sudo apt-get install git
3. $ /usr/local > git clone https://github.com/bitnine-oss/agensgraph.git
4. $ /usr/local > sudo apt-get install build-essential libreadline-dev zlib1g-dev flex bison
5. $ /usr/local/agensgraph/bin > ./configure --prefix=$(pwd) --with-python (重點 )
6. $ /usr/local/agensgraph/bin> make install
7.$ /usr/local/agensgraph/bin> echo "export PATH= /usr/local/agensgraph/bin:\$PATH" >> ~/.bashrc
8. $/usr/local/agensgraph/bin> echo "export LD_LIBRARY_PATH= /usr/local/agensgraph/lib:\$LD_LIBRARY_PATH" >> ~/.bashrc
9.$/usr/local/agensgraph/bin> make install-world
10.$/usr/local/agensgraph/bin> echo "export AGDATA= /usr/local/agensgraph/data" >> ~/.bashrc
11. 建立使用者 $> useradd postgres (自己去設定密碼)
12. 改變檔案許可權 $> chown -R postgres:postgres /user/local/agensgraph
13. 新建資料夾 $> mkdir /usr/local/agensgraph/data
14.初始化postgres資料庫 $/usr/local/agensgraph/bin> ./initdb -D ../data/
15.資料庫引數設定 在data目錄下
postgresql.conf 修改如下:
pg_hba.conf 修改如下:
16.啟動資料庫 $/usr/local/agensgraph/bin> ./ag_ctl -D ../data/ -l logfile start
三、用 pgAdmin連線資料庫,建立語言,在測試圖功能。
提示: AgensGraph 自帶 postgres 10 不需要安裝postgres。