centos7安装postgresql和postgis
1、安装步骤
-- 安装对应的rpm文件(其他系统的rpm包,请自行到https://yum.postgresql.org/下载)
yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
-- 查询postgresql的版本
yum search postgresql
-- 安装对应的版本(我安装的是postgresql9.6+postgis2.4)
yum -y install postgresql96.x86_64 postgresql96-server.x86_64 postgresql96-devel.x86_64
-- 安装对应的postgis插件
yum install postgis24_96.x86_64
如果出现如下图所示错误,

请执行如下命令:rpm -ivh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
执行完毕后,继续执行yum install postgis24_96.x86_64
至此整个安装过程完毕!
2、初始化运行环境
-- 初始化数据库
/usr/pgsql-9.6/bin/postgresql96-setup initdb
-- 启动psql服务器
systemctl start postgresql-9.6
--设置开机自启动
systemctl enable postgresql-9.6
--开发防火墙
firewall-cmd--permanent --add-port=5432/tcp
firewall-cmd--reload
-- 修改pg_hba.conf和postgresql.conf
/var/lib/pgsql/9.6/data/pg_hba.conf 将配置文件中记录的method的ident修改为trust(可以实现用户名和密码访问数据库)
/var/lib/pgsql/9.6/data/postgresql.conf 修改listen_addresses = 'localhost'为listen_addresses= '*',允许所有远程访问
(这样可以在其它客户机上远程登陆服务器,比如在windows机器上使用pgadmin客户端)
-- 初始化数据库
su postgresql
--登录到数据库
psql(可以默认登陆到用户名为:postgres 数据库名为postgres的数据库)
--查看当前连接到的数据库
\c
--查看当前的数据库信息
\l
--查看当前数据库的表信息
\d
--导入sql脚本
第一种方法:\i sql脚本的路径信息
第二种:psql -U 用户 -d 数据库 -h 主机 -p 端口 -f 脚本路径
至此基本的安装,初始化过程就结束了, 如果你在过程中有任何疑问,欢迎交流学习!
centos7安装postgresql和postgis的更多相关文章
- CentOS7使用yum安装PostgreSQL和PostGIS
更新yum源 CentOS7默认yum源的PostgreSQL版本过低,不适合在本版本上使用.在https://yum.postgresql.org/repopackages.php上找到适合Cent ...
- ubuntu安装postgresql与postgis
版本信息 ubuntu 14.04.1LTS postgresql 9.3.5 postgis 2.1.2 今天尝试着安装了postgis 2.1.2,(较简便的包安装,不是源码 ...
- ubuntu16.04搭建geodjango+postgresql+postgis的WebGIS框架(二))安装postgresql和postgis
卸载老版本sudo dpkg --purge postgis postgresql-9.3-postgis1.安装postgresql sudo apt-cache search postgresql ...
- CentOS7安装Postgresql
执行命令 Yum install postgresql-server Yum install postgresql-contrib 安装完成后,检查postgresql的服务状态 Systemctl ...
- Centos7安装 PostgreSQL步骤
1. 安装服务器即可. Yum install postgresql-server Yum install postgresql-contrib 2. 验证是否安装成功: rpm -aq| grep ...
- CentOS7 安装Postgresql 11+ 源码编译安装Postgis-2.5.2
####安装Postgresql-11yum install zlib-devel gcc makegroupadd postgresuseradd -g postgres postgrespassw ...
- 阿里云ecs centos7安装 postgresql 9.4
rpm -Uvh http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-3.noarch.rpm yum insta ...
- centos7 安装 PostgreSql
确定你是管理员,然后运行命令: yum -y install postgresql-server postgresql-contrib 初始化数据库 postgresql-setup initdb 启 ...
- Centos7 源码安装PostgreSQL Citus集群 (转载)
citus的分布式集群目前在苏宁大规模应用,苏宁陈华军也做了很多技术分享和博客介绍.目前所有的教程都是rpm和pg一起安装,个人不喜欢,毕竟citus定位是个插件,我想在我已安装的pg上源码装一个ci ...
随机推荐
- [Other]THUWC2020 游记
Dec. 20th 一下飞机,\(\text{FJ}\) 选手感觉 \(\text{BJ}\) 好冷 下午去了鸟巢,晚上回 \(\text{GLHT}\) 酒店吃泡面 写了洛谷上的线段树分治模板题之后 ...
- Mysql一分钟定位 Next-Key Lock,你需要几分钟
连接与线程 查看连接信息 show processlist +----+------+------------------+------+---------+------+----------+--- ...
- 将一条路由约束到一组指定的值 约束路由 URL路由
- Matplotlib API汉化 Pyplot API
https://www.cnblogs.com/chenxygx/p/9554443.html
- CentOS7下部署2套Python版本共存
参考地址:https://www.cnblogs.com/xuaijun/p/7985245.html 源码的安装一般由3个步骤组成:配置(configure).编译(make).安装(make in ...
- 工具之sed
转自:http://www.cnblogs.com/dong008259/archive/2011/12/07/2279897.html sed是一个很好的文件处理工具,本身是一个管道命令,主要是以行 ...
- linux容器技术之chroot
linux容器技术之chroot linux chroot 机制的由来 root 用户启动一个daemon,必须用root 用户来启动,比如一个web 服务器(nginx/apapce 80端口)是在 ...
- Win10系统下如何将中文登录名改为英文登录名
需求:本人每次在换完系统后是默认,图方便,登录名就直接是自己的名字,造成以后安装个别软件时会莫名其妙的出错. 解决办法: 1.在当前用户开始处-点击右键(Windows键+X)-注销 2.切换到Adm ...
- es学习(三):分词器介绍以及中文分词器ik的安装与使用
什么是分词 把文本转换为一个个的单词,分词称之为analysis.es默认只对英文语句做分词,中文不支持,每个中文字都会被拆分为独立的个体. 示例 POST http://192.168.247.8: ...
- Dubbo(二):深入理解Dubbo的服务发现SPI机制
一.前言 用到微服务就不得不来谈谈服务发现的话题.通俗的来说,就是在提供服务方把服务注册到注册中心,并且告诉服务消费方现在已经存在了这个服务.那么里面的细节到底是怎么通过代码实现的呢,现在我们来看看D ...