Installation method: Source Package Installation
Installation Environment: Linux-centos 6.5
- Download PostgreSQL Source Package
wget http://ftp.postgresql.org/pub/source/v9.3.9/postgresql-9.3.9.tar.bz2
#地址可更改, need other package into Http://ftp.postgresql.org/pub/source find download
- Unzip the file
Tar xjvf postgresql-9.3.9.tar.bz2
- Enter the extracted directory
CD postgresql-9.3.9/
- View the install file.
The short version section of the install file explains how to install PostgreSQL commands, requirements section describes the Lib that is dependent on the installation of PostgreSQL, long, first configure try, if error occurs, Then you need to check whether the requirements requirements are met.
If you report an error such as Rebline missing, you need to install the appropriate 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 order, such as the previous short, to start compiling and installing the Postgrepsql database.
1)./configure
In this step may be reported lack of redeline or zlib and other environmental dependency missing problem, download the relevant missing software through Yum. For example: Yum install-y readline-devel
2) Make
3) make install
4) Add PostgreSQL admin 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 User
Su-postgres
8) Bind 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?
#这一步是用pg_ctl命令指定数据目录启动 start-up logs in LogFile and other startup methods can also be
10) Create test database--test and insert 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
Query to the inserted data, at which point the database deployment is complete.
The next article on the 9.3.9 version is based on the method of the dual-machine hot standby mode of stream replication.
postgresql9.3.9 Version Deployment