陈友旺,不思议迷宫 永恒王座,商陵君养龙
更新yum源
centos7默认yum源的postgresql版本过低,不适合在本版本上使用。在上找到适合centos7的rpm源,复制其url地址,使用yum安装。
同时安装epel(extra packages for enterprise linux 7),为了稳定性,centos7的默认yum源缺少很多组件,这些组件可以在epel上找到。
命令:
yum install -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
yum -y install epel-release
yum search postgre
命令可以看到多个版本的postgresql,这里我选择了postgresql10。yum install -y postgresql10-server postgresql10-contrib
/usr/pgsql-10/bin/postgresql10-setup initdb
systemctl enable postgresql-10
systemctl start postgresql-10
/var/lib/pgsql/10/data/postgresql.conf
,找到listen_addresses,如果想对所有ip开放,把listen_addresses的值改为‘*’,如果只对部分ip开放,多个ip之间用,
(逗号加空格)隔开。/var/lib/pgsql/10/data/pg_hba.conf
,文件分为5列,分别是type、database、user、address、method,可以对不同ip地址的用户设置不同数据库的访问权限。最后一列method的解析如下:host all all 0.0.0.0/0 md5
。yum search postgis
命令可以看到多个版本的postgis,这里我选择postgis25,yum install -y postgis25_10
,安装完毕后切换为postgres用户,开启扩展。// 开启插件 # su postgres # psql // 开启pgsql的插件 postgres=# create extension postgis; postgres=# create extension postgis_topology; postgres=# create extension fuzzystrmatch; postgres=# create extension address_standardizer; postgres=# create extension address_standardizer_data_us; postgres=# create extension postgis_tiger_geocoder;
至此,postgresql和postgis安装完毕。
https://www.cnblogs.com/easonjim/p/9023607.html
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
linux下文本编辑器vim的使用方法(复制、粘贴、替换、行号、撤销、多文件操作)
网友评论