CentOS7怎么使用yum安装PostgreSQL和PostGIS

发布时间:2022-05-07 16:30:26 作者:iii
来源:亿速云 阅读:747

今天小编给大家分享一下CentOS7怎么使用yum安装PostgreSQL和PostGIS的相关知识点,内容详细,逻辑清晰,相信大部分人都还太了解这方面的知识,所以分享这篇文章给大家参考一下,希望大家阅读完这篇文章后有所收获,下面我们一起来了解一下吧。

1.更新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

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;

以上就是“CentOS7怎么使用yum安装PostgreSQL和PostGIS”这篇文章的所有内容,感谢各位的阅读!相信大家阅读完这篇文章都有很大的收获,小编每天都会为大家更新不同的知识,如果还想学习更多的知识,请关注亿速云行业资讯频道。

推荐阅读:
  1. centos7使用yum安装mongodb
  2. centos7使用yum安装mysql5.7

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

centos7 yum postgresql

上一篇:Centos7安装ElasticSearch入门实例分析

下一篇:centos7怎么禁止root登录及sshd端口自定义

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》