postgreSql-9.6.9 安裝

1.下載安裝包

wget https://ftp.postgresql.org/pub/source/v9.6.9/postgresql-9.6.9.tar.gz

2.配置postgresql環境

yum -y install gcc* readline-devel

adduser postgres

3.編譯安裝

tar zxvf postgresql-9.6.9.tar.gz

cd postgresql-9.6.9

./configure --prefix=/home/postgres/pgsql

gmake

gmake install

4.設置環境變量

vim /etc/profile

PATH=$PATH:$HOME/bin:/home/postgres/pgsql/bin

source /etc/profile

5.創建數據目錄賦權

mkdir /home/postgres/pgsql/data

touch /home/postgres/pgsql/.pgsql_history

chown -R postgres:postgres /home/postgres/

6.初始化數據庫

su - postgres

/home/postgres/pgsql/bin/initdb -D /home/postgres/pgsql/data

exit

7.修改啓動腳本

cp /root/postgresql-9.6.9/contrib/start-scripts/linux /etc/init.d/postgresql

vim /etc/init.d/postgresql

prefix=/home/postgres/pgsql

# Data directory
PGDATA="/home/postgres/pgsql/data"

增加執行權限

chmod +x /etc/init.d/postgresql

啓動postgresql

/etc/init.d/postgresql start

8.測試postgresql

su - postgres

[postgres@centos ~]$ psql

psql (9.6.9)

Type "help" for help.

postgres=# \l

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章