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 and configuration of Postgresql9.6.6 under Centos6.6

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

I. Introduction to Environment

Platform: CentOS release 6.6 (Final)

Postgresql:postgresql-9.6.6

SELINUX=disabled

Iptables Close

II. Installation process

1. Install dependency packages

yum -y install gcc*yum -y install readline-devel

2. Source package acquisition

wget http://ftp.postgresql.org/pub/source/v9.6.6/postgresql-9.6.6.tar.gz

3. decompression

tar zxf postgresql-9.6.6.tar.gz

5. Create user, set password

adduser postgrespasswd postgres

6. compile and install

cd postgresql-9.6.6./ configure --prefix=/home/postgres/pgsqlgmakegmake install

7. set the environment variable

vim /etc/profile

add a line

PATH=$PATH:$HOME/bin:/home/postgres/pgsql/binsource /etc/profile

8. Create database directory

mkdir /home/postgres/pgsql/data

Create database operation history file

touch /home/postgres/pgsql/.pgsql_history

Change group

chown -R postgres:postgres /home/postgres/pgsql/*

9. Switch to postgre user, initialize database

su - postgres/home/postgres/pgsql/bin/initdb -D /home/postgres/pgsql/dataexit

10. compile startup command

Copy linux from the postgres folder to/etc/init.d/

cp /root/postgresql-9.6.6/contrib/start-scripts/linux /etc/init.d/postgresqlvim /etc/init.d/postgresql

Modify the following two lines:

prefix=/home/postgres/pgsqlPGDATA="/home/postgres/pgsql/data"

save and exit

Add executable permissions

chmod +x /etc/init.d/postgresql

11. Start postgres database

/etc/init.d/postgresql start

12. test uses

[root@MidApp ~]#su - postgres[postgres@MidApp ~]$ psqlpsql (9.6.6)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

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