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

[Postgresql] postgresql9.3.9 version deployment

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

Share

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

Installation method: source package installation

Installation environment: linux-Centos 6.5

Download Postgresql source code package wget http://ftp.postgresql.org/pub/source/v9.3.9/postgresql-9.3.9.tar.bz2# address can be changed, need other packages into http://ftp.postgresql.org/pub/source to find and download to extract the file

Tar xjvf postgresql-9.3.9.tar.bz2 enters the directory after decompression.

Cd postgresql-9.3.9/ views the INSTALL file.

The Short Version section of the INSTALL file explains how to install the postgresql command, and the Requirements section describes the lib that the installation of postgresql depends on. If it is long, try configure first. If error appears, then you need to check whether the requirements of Requirements are met.

If you report an error such as missing rebline, you need to install the corresponding dependency package first.

Short Version./configuregmakesugmake installadduser postgresmkdir / usr/local/pgsql/datachown postgres/usr/local/pgsql/ datasu-postgres/usr/local/pgsql/bin/initdb-D / usr/local/pgsql/data/usr/local/pgsql/bin/postgres-D / usr/local/pgsql/data > logfile 2 > & 1 & / usr/local/pgsql/bin/createdb test/usr/local/pgsql/bin/psql test execute the commands in the above short in order to start compiling and installing the postgrepsql database.

1). / configure

In this step, missing environment dependency problems such as missing redeline or zlib may be reported, and you can download the missing software through yum. For example: yum install-y readline-devel

2) make

3) make install

4) add Postgresql management to start user postgres

Useradd postgres

Passwd postgres

5) create a database file storage folder

Mkdir / usr/local/pgsql/data

6) change the permissions of the folder in the previous directory

Chown-R postgres.postgres / usr/local/pgsql

7) switch users

Su-postgres

8) bind the database file storage directory

/ usr/local/pgsql/bin/initdb-D / usr/local/pgsql/data

# or: export PATH=$PATH:/usr/local/pgsql/bin/

9) start the database

/ usr/local/pgsql/bin/pg_ctl-D / usr/local/pgsql/data > > logfile 2 > & 1

# this step is to use the pg_ctl command to specify the data directory startup log to be placed in Logfile. Other startup methods can also be used.

10) create the test database-- test, and insert the data test (optional)

/ usr/local/pgsql/bin/createdb test

/ usr/local/pgsql/bin/psql test

Psql (9.3.9) Type "help" for help.test=#test=# create table table1 (test (# id integertest (#); CREATE TABLEtest=#test=# insert into table1 values (1); INSERT 0 1test=# select * from table1;Id

The inserted data is queried, and the database deployment is complete.

The next article talks about the 9.3.9 version based on stream replication and dual hot standby.

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: 235

*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