Home Database Mysql Tutorial Liunx环境下源码安装PostgreSQL+PostGIS

Liunx环境下源码安装PostgreSQL+PostGIS

Jun 07, 2016 pm 05:19 PM
postgresql

Liunx环境下源码安装PostgreSQL+PostGIS,检查功能的函数,如Touches(), Contains(), Disjoint() 还有一些空间操作函数,如Inter

生产环境中安装postgreSQL + postGIS

生产环境如下:

操作系统:

CentOS release 5.5 (Final)

需要安装:

postgresql 地址:

postgis 地址:

proj 地址:

geos 地址:

安装步骤:

postgre的安装 版本为9.1.3

  • wget
  • tar -jxvf postgresql-9.1.3.tar.bz2
  • cd postgresql-9.1.3
  • ./configure
  • gmake --> All of PostgreSQL successfully made. Ready to install.
  • gmake install --> PostgreSQL installation complete.
  • vim INSTALL 可以查看其官方安装步骤:

  • ./configure
  • gmake
  • su
  • gmake install 安装软件到指定的配置阶段prefix指定的目录下
  • adduser postgres 添加postgres用户,postgreSQL的默认超级管理员
  • mkdir /usr/local/pgsql/data 创建存放数据的目录
  • chown postgres /usr/local/pgsql/data 改变文件拥有者
  • su - postgres 切换到postgres用户
  • /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data 初始化磁盘上的数据库的存储区间
  • -- 成功后会提醒 /usr/local/pgsql/bin/postgres -D /data/pgsql or /usr/local/pgsql/bin/pg_ctl -D /data/pgsql -l logfile start
  • /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 & 指定数据目录启动数据库服务器(输出重定向到logfile,并且运行在后台,也可以用pg_ctl来启动)
  • /usr/local/pgsql/bin/createdb test 创建测试数据库,确认安装顺利完成
  • ...

    配置一下环境变量:

    LD_LIBRARY_PATH=/usr/local/pgsql/lib 动态连接库的所在目录

    PATH=/usr/local/pgsql/bin:$PATH 为了方便使用,添加命令的搜索路径

    输入pg_config 查看

  • BINDIR = /usr/local/pgsql/bin
  • DOCDIR = /usr/local/pgsql/share/doc
  • HTMLDIR = /usr/local/pgsql/share/doc
  • INCLUDEDIR = /usr/local/pgsql/include
  • PKGINCLUDEDIR = /usr/local/pgsql/include
  • INCLUDEDIR-SERVER = /usr/local/pgsql/include/server
  • LIBDIR = /usr/local/pgsql/lib
  • PKGLIBDIR = /usr/local/pgsql/lib
  • LOCALEDIR = /usr/local/pgsql/share/locale
  • MANDIR = /usr/local/pgsql/share/man
  • SHAREDIR = /usr/local/pgsql/share
  • SYSCONFDIR = /usr/local/pgsql/etc
  • PGXS = /usr/local/pgsql/lib/pgxs/src/makefiles/pgxs.mk
  • CONFIGURE =
  • CC = gcc
  • CPPFLAGS = -D_GNU_SOURCE
  • CFLAGS = -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv
  • CFLAGS_SL = -fpic
  • LDFLAGS = -Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags
  • LDFLAGS_EX =
  • LDFLAGS_SL =
  • LIBS = -lpgport -lz -lreadline -ltermcap -lcrypt -ldl -lm
  • VERSION = PostgreSQL 9.1.3
  • postgreSQL 安装完毕。

    注意事项:安装postgres 时

    readline库(默认),命令行编辑功能,这个库虽然不是必须的(可以在配置阶段通过 --without-readline选项来取消),但是强烈建议安装readline,

    使用psql时,可以使用方向键来选择和编辑前面键入的命令

    查看是否安装过 rpm -qa | grep readline

    zlib库(默认),主要用于pg_dump和pg_restore两个操作的数据压缩功能,这个库也不是必须的(可以在配置阶段通过--without-zlib选项来取消),

    查看是否安装过 rpm -qa | grep zlib

    在编译程序前必须要安装这些包,否则无法通过编译,此外,还有在配置阶段还有很多可选包,可以通过./configure --help查看

    选项 描述

    – prefix = prefix安装到prefix指向的目录;默认为/usr/local/pgsql

    – bindir = dir安装应用程序到dir;默认为prefix/bin

    – with-d ocdir= dir安装文档到dir;默认为prefix/doc

    – with-p gport= port设置默认的服务器端网络连接服务TCP端口号

    – with-t cl为服务端提供Tcl存储过程支持

    – with-p erl为服务端提供Perl存储过程支持

    – with-p ython为服务端提供Python存储过程支持

    PostGIS 的安装 版本为 PostGIS 1.5.4 Release

    首先下载源码包 proj-4.8.0,geos-3.3.3,libxml2-2.6.26,虽然这三个库不是安装postgis强制的,但是,没有这三个包,

    postgis一定程度上失去了空间数据库的意义。因为Proj4提供了投影的相关操作,如postgis中的transform()函数,,geos则为postgis提供了很多拓扑

    linux

    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    Video Face Swap

    Video Face Swap

    Swap faces in any video effortlessly with our completely free AI face swap tool!

    Hot Article

    Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
    3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    Nordhold: Fusion System, Explained
    3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
    3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

    Hot Tools

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)

    Hot Topics

    Java Tutorial
    1666
    14
    PHP Tutorial
    1273
    29
    C# Tutorial
    1252
    24
    MySQL and PostgreSQL: Performance comparison and optimization tips MySQL and PostgreSQL: Performance comparison and optimization tips Jul 13, 2023 pm 03:33 PM

    MySQL and PostgreSQL: Performance Comparison and Optimization Tips When developing web applications, the database is an indispensable component. When choosing a database management system, MySQL and PostgreSQL are two common choices. They are both open source relational database management systems (RDBMS), but there are some differences in performance and optimization. This article will compare the performance of MySQL and PostgreSQL and provide some optimization tips. Performance comparison comparing two database management

    MySQL and PostgreSQL: Best Practices in Web Development MySQL and PostgreSQL: Best Practices in Web Development Jul 14, 2023 pm 02:34 PM

    MySQL and PostgreSQL: Best Practices in Web Development Introduction: In the modern world of web development, databases are an essential component. When choosing a database, common choices are MySQL and PostgreSQL. This article will cover best practices for using MySQL and PostgreSQL in web development and provide some code examples. 1. Applicable scenarios MySQL is suitable for most web applications, especially those that require high performance, scalability and ease of use.

    MySQL and PostgreSQL: How to optimize database query performance? MySQL and PostgreSQL: How to optimize database query performance? Jul 12, 2023 pm 03:15 PM

    MySQL and PostgreSQL: How to optimize database query performance? Overview: Database query performance is an important consideration when developing applications. Good query performance improves application responsiveness and user experience. This article will introduce some methods to optimize database query performance, focusing on two commonly used databases, MySQL and PostgreSQL. Optimization of database indexes: Database indexes are an important factor in improving query performance. Indexes can speed up data search and reduce query scanning time.

    MySQL and PostgreSQL: Data Security and Backup Strategies MySQL and PostgreSQL: Data Security and Backup Strategies Jul 13, 2023 pm 03:31 PM

    MySQL and PostgreSQL: Data Security and Backup Strategies Introduction: In modern society, data has become an indispensable part of business and personal life. For database management systems, data security and backup strategies are crucial, both to protect data from loss or damage and to ensure the reliability and integrity of recovered data. This article will focus on the data security and backup strategies of two mainstream relational database systems, MySQL and PostgreSQL. 1. Data security: (1) User rights

    Learn database functions in Go language and implement addition, deletion, modification and query operations of PostgreSQL data Learn database functions in Go language and implement addition, deletion, modification and query operations of PostgreSQL data Jul 31, 2023 pm 12:54 PM

    Learn the database functions in the Go language and implement the addition, deletion, modification, and query operations of PostgreSQL data. In modern software development, the database is an indispensable part. As a powerful programming language, Go language provides a wealth of database operation functions and toolkits, which can easily implement addition, deletion, modification and query operations of the database. This article will introduce how to learn database functions in Go language and use PostgreSQL database for actual operations. Step 1: Install the database driver in Go language for each database

    Database capacity planning and scaling: MySQL vs. PostgreSQL Database capacity planning and scaling: MySQL vs. PostgreSQL Jul 12, 2023 pm 01:43 PM

    Database capacity planning and expansion: MySQL vs. PostgreSQL Introduction: With the rapid development of the Internet and the advent of the big data era, database capacity planning and expansion has become increasingly important. MySQL and PostgreSQL are two popular relational database management systems (RDBMS). They have different characteristics and applicable scenarios in database capacity planning and expansion. This article will compare the two databases and give some code examples to demonstrate their differences. 1. MySQ

    How to use PostgreSQL database in PHP programming? How to use PostgreSQL database in PHP programming? Jun 12, 2023 am 09:27 AM

    With the development of database technology, database management systems also present a variety of choices. Developers can choose the most suitable database according to their needs and preferences. As an advanced open source relational database system, PostgreSQL is attracting more and more attention and use by developers. So, how to use PostgreSQL database in PHP programming? 1. Install and configure the PostgreSQL database. Before using PostgreSQL, you need to install and configure it. first

    Using PostgreSQL in Go: The Complete Guide Using PostgreSQL in Go: The Complete Guide Jun 18, 2023 am 09:28 AM

    Go language is a fast and efficient programming language suitable for building web services and back-end applications. PostgreSQL is an open source relational database management system that promises to provide higher reliability, scalability and data security. In this article, we’ll take a deep dive into using PostgreSQL with Go and provide some practical code examples and tips. Installing and setting up PostgreSQL First, we need to install and set up PostgreSQL. Can be found on the official website

    See all articles