Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Installation of postgresql9.6.9 in centos 6.8

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Installation of postgresql9.6.9 in centos 6.8

First, prepare before installation

System: centos 6.8

Server IP:192.168.1.211

Modify SELINUX=disabled

Vi / etc/selinux/config

Turn off the firewall or allow port 5432 to open

/ etc/init.d/iptables stop

Chkconfig iptables off

II. Deploy the postgresql environment

2.1 install dependency packages

Yum-y install gcc* readline-devel wget

2.2 create a user-set password

Adduser postgres

Passwd postgres

Download postgresql installation

Wget https://ftp.postgresql.org/pub/source/v9.6.9/postgresql-9.6.9.tar.gz

Tar zxvf postgresql-9.6.9.tar.gz

Cd postgresql-9.6.9

. / configure-- prefix=/home/postgres/pgsql

Gmake

Gmake install

2.4 set environment variables

Vi / etc/profile

Add below the last line

# postgresql

PATH=$PATH:$HOME/bin:/home/postgres/pgsql/bin

Environmental entry into force

Source / etc/profile

2.5 create data directory weighting

Mkdir / home/postgres/pgsql/data

Touch / home/postgres/pgsql/.pgsql_history

Chown-R postgres:postgres / home/postgres/pgsql

2.6 initialize the database

Su-postgres

/ home/postgres/pgsql/bin/initdb-D / home/postgres/pgsql/data

Quit

Exit

2.7 modify startup script

Cp / root/postgresql-9.6.9/contrib/start-scripts/linux / etc/init.d/postgresql

Vi / etc/init.d/postgresql

Save exit

Increase the executive authority

Chmod + x / etc/init.d/postgresql

Start postgresql

/ etc/init.d/postgresql start

2.8Test postgresql

Su-postgres

[postgres@post01 ~] $psql

Psql (9.6.9)

Type "help" for help.

Postgres=#\ l

List of databases

Name | Owner | Encoding | Collate | Ctype | Access privileges

-+-

Postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |

Template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | = c/postgres +

| | postgres=CTc/postgres |

Template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | = c/postgres +

| | postgres=CTc/postgres |

(3 rows)

Postgres=#\ Q

Create a database named ybdb

Createdb ybdb

2.9 modify postgresql.conf

Vi pgsql/data/postgresql.conf

Restart postgresql

/ etc/init.d/postgresql restart

2.10 add users and empower

Create user ybdba WITH PASSWOD 'ybdba#2018'

GRANT ALL PRIVILEGES ON DATABASE ybdb TO ybdba

Remote login postgresql

Modify ph_ha.conf if there is an error in the above figure

2.11 modify ph_ha.conf

Note: my local IP is 192.168.1.79

Vi pgsql/data/pg_hba.conf

User superuser runs SELECT pg_reload_conf ()

Remote login successful

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report