linux中安裝postgresl12+postgis

系統(tǒng)環(huán)境說明:

??[root@slave1 ~]# cat /etc/redhat-release
??CentOS Linux release 7.4.1708 (Core)

開始

??1、Postgresql12的安裝
????https://www.postgresql.org/download/linux/redhat/

版本選擇.png

1、下載安裝
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum install postgresql12
yum install postgresql12-server
yum install postgresql12-libs
yum install postgresql12-contrib
yum install postgresql12-devel

2、數(shù)據(jù)庫初始化與設(shè)置自啟動
/usr/pgsql-12/bin/postgresql-12-setup initdb
systemctl enable postgresql-12
systemctl start postgresql-12

3、編輯遠程訪問
cd /var/lib/pgsql/12/data
vi postgresql.conf
修改前:
#listen_address = ‘localhost’
i進入,下移光標
修改為 listen_address = ‘*’   注意:這里將#去掉
Esc退出編輯模式,shift和:鍵,輸入wq進行保存并退出,q表示只退出不保存
vi pg_hba.conf
添加IPv4
host all all 0.0.0.0/32 md5

4、重新啟動服務
systemctl restart postgresql-12
退出當前文件回到根目錄
cd /

5、登錄數(shù)據(jù)庫
su postgres
psql –U postgres
\password   //修改密碼
\q 退出postgres命令

6、卸載
yum remove postgresql*

??2、Postgis的安裝

yum install postgis30_12
新建庫,添加postgis擴展
create extension postgis; //sql語句必須以;結(jié)尾
\q退出postgres命令
Logout或者exit退出bash
新建用戶
create user map_tz with password 'dl123';
新建庫
create database dl owner map_tz;
賦權(quán)限
grant all privileges on database dl to map_tz;
添加postgis擴展
create extension postgis;
create extension postgis_topology;
最后

??結(jié)果如圖


postgresql.png
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容