CentOS7下PostgreSQL12+PostGIS3.0完整安装指南

需积分: 50 8 下载量 123 浏览量 更新于2024-09-03 收藏 529KB DOCX 举报
"该文档详述了如何在CentOS7 x64操作系统上安装和配置PostgreSQL 12以及PostGIS 3.0的步骤。" 在安装PostgreSQL之前,首先需要从PostgreSQL官方网站下载软件。然后,通过RPM安装PostgreSQL的存储库,以便能够使用`yum`命令进行安装。在CentOS7上,可以运行`yum install postgresql-server`来安装PostgreSQL服务器。安装完成后,需要执行初始化数据库的步骤,这通常包括创建一个名为`postgres`的系统用户,以及设置数据库的初始状态。 为了使数据库在系统启动时自动启动,可以使用`systemctl enable postgresql.service`命令。接着,通过`systemctl status postgresql`来检查服务状态,并使用`passwd postgres`为`postgres`用户设置新密码。 连接到PostgreSQL数据库需要切换到`postgres`用户,然后使用`psql`命令。首次连接时,可能需要修改`postgres`用户的密码。数据库配置文件`postgresql.conf`位于PostgreSQL的数据目录下,这里需要将`listen_addresses`从`localhost`改为`*`,允许所有IP地址连接。每次修改配置文件后,都必须重启数据库服务,如使用`systemctl restart postgresql`命令。 此外,还需要修改认证配置文件`pg_hba.conf`,将IP限制从`127.0.0.1/32`更改为`0.0.0.0/0`,并将认证方法从`ident`改为`md5`,以启用MD5密码认证。同样,修改配置文件后需要重启数据库服务。 在安装PostGIS扩展时,首先要确保所有依赖包都已安装。如果遇到连接超时或认证失败的问题,可能需要检查防火墙设置,允许5432端口的TCP连接。如果出现“Ident认证失败”的错误,检查`pg_hba.conf`中的配置,确保认证方式正确。对于“Relhasoids”错误,可能是因为扩展安装时缺少某些对象,需要确保安装过程无误。 安装PostGIS扩展可以通过`CREATE EXTENSION`命令在数据库中完成,例如创建一个名为`sptial_testdb`的数据库,并使用`psql`命令来执行扩展安装。在成功安装PostGIS后,就可以利用其空间功能处理地理数据了。 这个文档提供了一个完整的流程,指导用户在CentOS7环境中安装和配置PostgreSQL 12与PostGIS 3.0,包括安装、初始化、配置、安全设置以及安装和使用PostGIS扩展的细节。遵循这些步骤,用户可以建立一个支持地理数据处理的开源数据库环境。
2018-04-23 上传
Create and manage spatial data with PostGIS Key Features Import and export geographic data from the PostGIS database using the available tools Maintain, optimize, and fine-tune spatial data for long-term viability Utilize the parallel support functionality that was introduced in PostgreSQL 9.6 Book Description PostGIS is a spatial database that integrates the advanced storage and analysis of vector and raster data, and is remarkably flexible and powerful. PostGIS provides support for geographic objects to the PostgreSQL object-relational database and is currently the most popular open source spatial databases. If you want to explore the complete range of PostGIS techniques and expose related extensions, then this book is for you. This book is a comprehensive guide to PostGIS tools and concepts which are required to manage, manipulate, and analyze spatial data in PostGIS. It covers key spatial data manipulation tasks, explaining not only how each task is performed, but also why. It provides practical guidance allowing you to safely take advantage of the advanced technology in PostGIS in order to simplify your spatial database administration tasks. Furthermore, you will learn to take advantage of basic and advanced vector, raster, and routing approaches along with the concepts of data maintenance, optimization, and performance, and will help you to integrate these into a large ecosystem of desktop and web tools. By the end, you will be armed with all the tools and instructions you need to both manage the spatial database system and make better decisions as your project's requirements evolve. What you will learn Import and export geographic data from the PostGIS database using the available tools Structure spatial data using the functionality provided by a combination of PostgreSQL and PostGIS Work with a set of PostGIS functions to perform basic and advanced vector analyses Connect PostGIS with Python Learn to use programming frameworks around PostGIS Maintain, optimize, and fine-tune spatial data for long-term viability Explore the 3D capabilities of PostGIS, including LiDAR point clouds and point clouds derived from Structure from Motion (SfM) techniques Distribute 3D models through the Web using the X3D standard Use PostGIS to develop powerful GIS web applications using Open Geospatial Consortium web standards Master PostGIS Raster Who This Book Is For This book is for developers who need some quick solutions for PostGIS. Prior knowledge of PostgreSQL and spatial concepts would be an added advantage. Table of Contents Chapter 1. MOVING DATA IN AND OUT OF POSTGIS Chapter 2. STRUCTURES THAT WORK Chapter 3. WORKING WITH VECTOR DATA THE BASICS Chapter 4. WORKING WITH VECTOR DATA ADVANCED RECIPES Chapter 5. WORKING WITH RASTER DATA Chapter 6. WORKING WITH PGROUTING Chapter 7. Into the Nth Dimension Chapter 8. POSTGIS PROGRAMMING Chapter 9. POSTGIS AND THE WEB Chapter 10. MAINTENANCE OPTIMIZATION AND PERFORMANCE TUNING Chapter 11. USING DESKTOP CLIENTS Chapter 12. Introduction to Location Privacy Protection Mechanisms