脚本宝典收集整理的这篇文章主要介绍了CentOS7使用yum安装PostgreSQL和PostGIS的方法,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
1.更新yum源
CentOS7默认yum源的PostgreSQL版本过低,不适合在本版本上使用。在https://yum.postgresql.org/repopackages.php上找到适合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
2.安装PostgreSQL
使用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
3.配置数据库
如果要求所有IP都是使用密码登录,则配置为host all all 0.0.0.0/0 md5。
4.安装PostGIS
使用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安装完毕。
总结
以上所述是小编给大家介绍的CentOS7使用yum安装PostgreSQL和PostGIS,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!
以上是脚本宝典为你收集整理的CentOS7使用yum安装PostgreSQL和PostGIS的方法全部内容,希望文章能够帮你解决CentOS7使用yum安装PostgreSQL和PostGIS的方法所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。