[root@pghost ~]# uname -a
Linux pghost 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@pghost ~]# cat /etc/issue
CentOS release 6.5 (Final)
Kernel \r on an \m
1
yum -y install readline readline-devel zlib zlib-devel openssl openssl-devel pam-devel libxml2-devel libxslt-devel python-devel tcl-devel gcc make flex bison perl perl-devel perl-ExtUtils*
2
useradd postgres
3
vi /home/postgres/.bash_profile
export PGPORT=5432
export PGDATA=/opt/pgsql9.3.4/pgdata
export LANG=en_US.utf8
export PGHOME=/opt/pgsql
export LD_LIBRARY_PATH=$PGHOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/lib:/usr/local/lib:$LD_LIBRARY_PATH
export PATH=$PGHOME/bin:$PATH:.
export MANPATH=$PGHOME/share/man:$MANPATH
export PGUSER=postgres
export PGHOST=$PGDATA
4
[root@pghost ~]# cd /root/backup/
[root@pghost backup]# ll
total 21356
-rw-r--r--. 1 root root 21865589 Sep 7 09:21 postgresql-9.3.4.tar.gz
[root@pghost backup]# tar -zxvf postgresql-9.3.4.tar.gz
[root@pghost backup]# ll
total 21360
drwxrwxrwx. 6 1107 1107 4096 Mar 18 2014 postgresql-9.3.4
5
[root@pghost backup]# cd postgresql-9.3.4
[root@pghost postgresql-9.3.4]# ./configure --prefix=/opt/pgsql9.3.4 --with-pgport=5432 --with-perl --with-tcl --with-python --with-openssl --with-pam --without-ldap --with-libxml --with-libxslt --enable-thread-safety --with-wal-blocksize=8 --with-blocksize=8 && gmake world
...
...
gmake[2]: Leaving directory `/root/backup/postgresql-9.3.4/contrib/xml2'
gmake[1]: Leaving directory `/root/backup/postgresql-9.3.4/contrib'
PostgreSQL, contrib, and documentation successfully made. Ready to install.
[root@pghost postgresql-9.3.4]#
[root@pghost postgresql-9.3.4]# ll
total 1448
-rwxr-xr-x. 1 root root 39791 Sep 19 17:26 config.status
-rw-r--r--. 1 root root 3618 Sep 19 17:26 GNUmakefile
drwxrwxrwx. 15 1107 1107 4096 Sep 19 17:26 src
6
[root@pghost postgresql-9.3.4]# gmake install-world
...
...
gmake[2]: Leaving directory `/root/backup/postgresql-9.3.4/contrib/xml2'
gmake[1]: Leaving directory `/root/backup/postgresql-9.3.4/contrib'
PostgreSQL, contrib, and documentation installation complete.
[root@pghost postgresql-9.3.4]#
7
[root@pghost postgresql-9.3.4]# ll /opt/
total 8
drwxr-xr-x. 6 root root 4096 Sep 19 17:31 pgsql9.3.4
drwxr-xr-x. 2 root root 4096 Nov 22 2013 rh
[root@pghost postgresql-9.3.4]# ln -s /opt/pgsql9.3.4 /opt/pgsql
[root@pghost postgresql-9.3.4]# ll /opt/
total 8
lrwxrwxrwx. 1 root root 15 Sep 19 17:33 pgsql -> /opt/pgsql9.3.4
drwxr-xr-x. 6 root root 4096 Sep 19 17:31 pgsql9.3.4
drwxr-xr-x. 2 root root 4096 Nov 22 2013 rh
[root@pghost postgresql-9.3.4]#
[root@pghost postgresql-9.3.4]# ll /opt/pgsql9.3.4/
total 16
drwxr-xr-x. 2 root root 4096 Sep 19 17:31 bin
drwxr-xr-x. 6 root root 4096 Sep 19 17:31 include
drwxr-xr-x. 4 root root 4096 Sep 19 17:31 lib
drwxr-xr-x. 8 root root 4096 Sep 19 17:31 share
8
[root@pghost ~]# chown -R root:daemon /opt/pgsql9.3.4/
[root@pghost ~]# ll /opt/
total 8
lrwxrwxrwx. 1 root root 15 Sep 19 17:33 pgsql -> /opt/pgsql9.3.4
drwxr-xr-x. 6 root daemon 4096 Sep 19 17:31 pgsql9.3.4
drwxr-xr-x. 2 root root 4096 Nov 22 2013 rh
[root@pghost ~]# ll /opt/pgsql9.3.4/
total 16
drwxr-xr-x. 2 root daemon 4096 Sep 19 17:31 bin
drwxr-xr-x. 6 root daemon 4096 S