http://my.oschina.net/hippora/blog/375292 Download Source and unzip
[root@fnddb ~]# wget https://ftp.postgresql.org/pub/source/v9.4.0/postgresql-9.4.0.tar.bz2[root@fnddb ~]# tar -xjvf postgresql-9.4.0.tar.bz2 [root@fnddb ~]# cd postgresql-9.4.0
Start compiling the installation
[Email protected] postgresql-9.4.0]#./configure ... checkingForLibrary containing shmget ... none requiredcheckingForlibrary containing readline ... noconfigure:error:readline < Span class= "Hljs-keyword" >library not foundif you had readline already installed, see Config.log for details on Thefailure. It is possible the compiler Isn< Span class= "Hljs-attribute" "T looking in the proper Directory . use --without-readline to disable ReadLine support.
Follow the error prompts to install the dependent packages in turn
[[email protected] postgresql-9.4.0]# yum install readline-devel[[email protected] postgresql-9.4.0]# yum install zlib-devel...
Go on
[Root@fnddb postgresql-9.4.0]#. Configure[root @fnddb postgresql- 9.4.0] # make ... All of PostgreSQL successfully made. Ready to install.[ Root @fnddb postgresql-9.4. 0]# Make install ... PostgreSQL installation complete.
Add user
[Root@fnddb postgresql-9.4.0]# Useradd Postgres[root@fnddb postgresql-9.4.0] # passwd postgreschanging Password for user postgres. New password:bad password: it is based on a dictionary wordretype new Span class= "Hljs-attribute" >password: passwd:all authentication tokens updated successfully.
Set up Database cluster target folder.
[root@fnddb postgresql-9.4.0]# mkdir /var/lib/pgsql/data -p[root@fnddb postgresql-9.4.0]# chown -R postgres /var/lib/pgsql
environment variable Settings
[Root@fnddb postgresql-9.4.0]# Su-postgres[postgres@fnddb ~]$ VI. Bash_profile ...# postgresPGDATA=/var/lib/pgsql/ Datapath= /usr/local/pgsql/bin: $PATHexport Span class= "hljs-constant" >pgdata path[postgres @fnddb ~]$: Bash_profile
Create DATABASE Cluster
[Email protected] ~]$ pg_ctl initdb ... Warning:enabling "Trust" authentication for local connectionsyou canChangeThisByEditing pg_hba.confOr UsingTheOption-A,Or--auth-local and--auth-host, the next time you run INITDB.Success. You canNow StartTheDatabase Server Using:/usr/Local/pgsql/Bin/postgres-d/Var/lib/pgsql/Dataor /usr/local/pgsql/bin/pg_ctl-d/var/lib/pgsql/Data- l logfile start
Start a DB instance
After setting the PGDATA environment variable, you can do so without the-D option
start -l /var/lib/pgsql/pgsql.logserver starting
To close a DB instance
stopwaiting for server to shut down.... doneserver stopped
Boot auto-start settings
[[email protected] postgresql-9.4.0]# vi /etc/rc.local…su - c ‘/usr/local/pgsql/bin/pg_ctl start -D /var/lib/pgsql/data -l /var/lib/pgsql/pgsql.log‘
PostgreSQL source installation on Linux