Linux deploy PostgreSQL database and create SDE

One. Yum installation process in the networked state

1 Overview

Environment: operating system centos7.5, PostgreSQL 9.5.23, ArcMap desktop 10.7

2. Steps

(1) Download the source package
Download the latest update source package corresponding to the operating system from the official website: https://yum.postgresql.org/repopackages/

(2) Import source package update

yum install pgdg-redhat-repo-latest.noarch.rpm

(3) View the list of installable packages

yum list postgres*

(4) Install the database

yum install postgresql95-server.x86_64

(5) Initialize the database

sudo /usr/pgsql-9.5/bin/postgresql95-setup initdb
#Initializing database ... OK

(6) Start PostgreSQL service
Start PostgreSQL service

sudo systemctl start postgresql-9.5

Set PostgreSQL service to start at boot

sudo systemctl enable postgresql-9.5

Note: If it is 12, start the PostgreSQL service sudo systemctl start postgresql-12)

(7) Connect to the database
Cannot connect directly with the root account, you need to switch to the user postgres (postgres operating system users are automatically created)

$ sudo su - postgres
-bash-4.2$ psql
psql (9.5.23)
Type "help" for help.
postgres=#

(8) Modify the password (the password is also set to postgres)

psql
\password postgres

(9) Configure the remote access
open port (or directly close the firewall)

sudo firewall-cmd --add-port=5432/tcp --permanent
sudo firewall-cmd –reload

Modify monitoring
Modify the configuration file
vi /var/lib/pgsql/9.5/data/postgresql.conf The
default listen_addresses configuration is commented out, so you can directly add this line at the beginning of the configuration file.

listen_addresses='*'

Configure IP access
Modify the configuration file
vi /var/lib/pgsql/9.5/data/pg_hba.conf
to add at the end of the file (allow all IP access):

host all all 0.0.0.0/0 md5

Restart PostgreSQL service

sudo systemctl restart postgresql-9.5

(10) Copy database support files
Finally, copy the files, and copy the corresponding version of the database support files to the following similar lib location and restart the pg service, then create SDE on the desktop.
Insert picture description here
The uploaded database support file (root) needs to be given 0755 permissions, refer to the official help:
Insert picture description here
(11) Create SDE with desktop tools
Insert picture description here

two. Source source code deployment in offline state

1 Overview

Environment : operating system centos7.5, PostgreSQL 9.5.12, ArcMap desktop 10.7

Installation method by obtaining offline packages online:
by modifying the /etc/yum.conf file: 0 to 1
keepcache=1

Copy:
execute yum install xxx on a machine with network to download the installation package to /var/cache/yum/.../base/packages, and then copy to a machine without network, rpm -ivh *.rpm --force -nodeps installation Offline package.

The official download address of the source package : https://www.postgresql.org/ftp/source/

2. Steps

(1) Additional installation environment package

yum -y install gcc
yum -y install readline-devel
yum install zlib-devel
yum install libxml2 libxml2-devel

(2) Turn off the firewall

sudo systemctl stop firewalld
systemctl disable firewalld

(3) Deployment process

The overall steps can be installed according to the following blog tutorial: https://blog.csdn.net/u010177412/article/details/82150207

The config step needs to be modified to:

./configure --prefix=/bigdata/work/postgresql --with-libxml

(4) Database support file copy
File copy to:
Insert picture description here
(5) Problems encountered in it
Similar problems: http://zhihu.geoscene.cn/question/35625

Desktop creation SDE error:
Insert picture description here
Solution : When compiling config, add –with-libxml parameter

Guess you like

Origin blog.csdn.net/suntongxue100/article/details/108534712