From b3ac5b03d2fb1af08a97822cf03da7e6eb67e9b3 Mon Sep 17 00:00:00 2001 From: lime <531404991@qq.com> Date: Wed, 22 Mar 2023 14:40:11 +0000 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0postgres-gis=E6=89=A9?= =?UTF-8?q?=E5=B1=95=E5=AE=89=E8=A3=85=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lime <531404991@qq.com> --- postgres/gis-install.sh | 55 ++++++++++++++++++++++ postgres/postgres-install.sh | 88 ++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+) create mode 100644 postgres/gis-install.sh create mode 100644 postgres/postgres-install.sh diff --git a/postgres/gis-install.sh b/postgres/gis-install.sh new file mode 100644 index 0000000..82d8be7 --- /dev/null +++ b/postgres/gis-install.sh @@ -0,0 +1,55 @@ +#!/bin/bash +#Copyright lime qq:531404991 +#shell instalL gis +#tar gz +#Copyright lime +#gis 扩展安装 +#geos install,gisdir为gis安装包存放目录 +#set -e 遇到错误立即停止 +set -e +#确定不少依赖,不可少步骤,否则安装失败回退困难 +sudo yum -y install bzip2 wget gcc gcc-c++ readline-devel zlib-devel make systemtap systemtap-sdt-devel perl perl-devel python python-devel tcl tcl-devel perl-ExtUtils-Embed sgml-common docbook stylesheets openjade sgml-tools xsltproc libxslt libxslt-devel libxml2 libxml2-devel zlib zlib-devel openssl openssl-devel pam pam-devel libreadline6-dev bison flex postgresql-libs postgresql-devel +gisdir=/opt/fwsoft/postgis +#geos install +cd $gisdir +tar -xvf geos-3.7.0.tar && cd geos-3.7.0 +./configure --prefix=/usr/local/geos-3.7.0 +make +make install +#proj install +cd $gisdir +tar -zxvf proj-5.2.0.tar.gz && cd proj-5.2.0 +./configure --prefix=/usr/local/proj-5.2.0 +make +make install +#jdal install +cd $gisdir +tar -zxvf gdal-2.3.2.tar.gz && cd gdal-2.3.2 +./configure --prefix=/usr/local/gdal-2.3.2 --with-pg=/usr/local/postgresql-10.5/bin/pg_config +make +make install +#json install +cd $gisdir +tar -zxvf json-c-0.13.1-20180305.tar.gz && cd json-c-json-c-0.13.1-20180305 +./configure --prefix=/usr/local/json-c-0.13.1 +make +make install +#libxml install +cd $gisdir +tar -zxvf libxml2-2.9.8.tar.gz +cd libxml2-2.9.8 +./configure --prefix=/usr/local/libxml2-2.9.8 +make +make install +#gis install +sed -i '1 a /usr/local/postgresql-10.5/lib\n/usr/local/proj-5.2.0/lib\n/usr/local/gdal-2.3.2/lib\n/usr/local/geos-3.7.0/lib\n#/usr/local/sfcgal-1.3.6/lib64\n/usr/local/json-c-0.13.1/lib\n/usr/local/libxml2-2.9.8/lib\n#/usr/local/protobuf-2.6.1/lib\n#/usr/local/protobuf-c-1.3.1/lib\n' /etc/ld.so.conf +ldconfig -v +sleep 3 +cd $gisdir +tar -zxvf postgis-2.5.0.tar.gz && cd postgis-2.5.0 +./configure --prefix=/usr/local/postgresql-10.5 --with-gdalconfig=/usr/local/gdal-2.3.2/bin/gdal-config --with-pgconfig=/usr/local/postgresql-10.5/bin/pg_config --with-geosconfig=/usr/local/geos-3.7.0/bin/geos-config --with-projdir=/usr/local/proj-5.2.0 --with-xml2config=/usr/local/libxml2-2.9.8/bin/xml2-config --with-jsondir=/usr/local/json-c-0.13.1 +make +make install +sleep 3 +#cd /opt/soft/shell/ +#sh start.sh diff --git a/postgres/postgres-install.sh b/postgres/postgres-install.sh new file mode 100644 index 0000000..9d9f50b --- /dev/null +++ b/postgres/postgres-install.sh @@ -0,0 +1,88 @@ +#!/bin/bash +#Copyright lime qq:531404991 +#shell instalL postgres-10.5 +#tar gz +#可选 +#cd contrib/fuzzystrmatch/ +#make +#make install +fdir=/opt/soft/postgres #压缩包上传目录 +echo "安装即将开始,请确认已经将dba给的整个soft目录上传至服务器的/opt/目录" +sleep 5 +sudo sed -i "7s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config +sudo firewall-cmd --zone=public --add-port=5432/tcp --permanent +sudo firewall-cmd --reload +sudo firewall-cmd --list-ports +sleep 1 +sudo yum -y install wget bzip2 gcc gcc-c++ readline-devel zlib-devel make systemtap systemtap-sdt-devel perl perl-devel python python-devel tcl tcl-devel sgml-common stylesheets openjade sgml-tools xsltproc libxslt libxslt-devel libxml2 libxml2-devel zlib zlib-devel openssl openssl-devel pam pam-devel libreadline6-dev flex +#postgres 安装 +cd $fdir +pwd +sleep 1 +sudo tar -xzvf postgresql-10.5.tar.gz && cd postgresql-10.5 +sudo mkdir /usr/local/postgresql-10.5 +./configure --prefix=/usr/local/postgresql-10.5 >> $fdir/postgres初始化信息.txt +sudo make && make install +sudo cd contrib/ +sudo make && make install +sudo cd ~ +sudo useradd postgres +sudo echo postgres | passwd --stdin postgres +sudo mkdir /data/postgres/ +sudo chown -R postgres:postgres /data/postgres/ +#修改配置文件先导版本 +su - postgres <