源码安装postgresql934
发布时间:2020-12-13 17:26:06 所属栏目:百科 来源:网络整理
导读:0 [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 readli
0
[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 -rw-r--r--. 1 root root 359981 Sep 19 17:26 config.log -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,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 Sep 19 17:31 include drwxr-xr-x. 4 root daemon 4096 Sep 19 17:31 lib drwxr-xr-x. 8 root daemon 4096 Sep 19 17:31 share 9 [root@pghost pgsql9.3.4]# mkdir pgdata [root@pghost pgsql9.3.4]# chown postgres:postgres pgdata/ [root@pghost pgsql9.3.4]# ll total 20 drwxr-xr-x. 2 root daemon 4096 Sep 19 17:31 bin drwxr-xr-x. 6 root daemon 4096 Sep 19 17:31 include drwxr-xr-x. 4 root daemon 4096 Sep 19 17:31 lib drwxr-xr-x. 2 postgres postgres 4096 Sep 19 17:48 pgdata drwxr-xr-x. 8 root daemon 4096 Sep 19 17:31 share 10 [root@pghost postgresql-9.3.4]# su - postgres [postgres@pghost ~]$ initdb -D $PGDATA -E UTF8 --locale=C -U postgres -W ... ... syncing data to disk ... ok WARNING: enabling "trust" authentication for local connections You can change this by editing pg_hba.conf or using the option -A,or --auth-local and --auth-host,the next time you run initdb. Success. You can now start the database server using: postgres -D /opt/pgsql9.3.4/pgdata or pg_ctl -D /opt/pgsql9.3.4/pgdata -l logfile start [postgres@pghost ~]$ 11 [root@pghost opt]# ll pgsql9.3.4/ total 20 drwxr-xr-x. 2 root daemon 4096 Sep 19 17:31 bin drwxr-xr-x. 6 root daemon 4096 Sep 19 17:31 include drwxr-xr-x. 4 root daemon 4096 Sep 19 17:31 lib drwx------. 15 postgres postgres 4096 Sep 22 11:51 pgdata drwxr-xr-x. 8 root daemon 4096 Sep 19 17:31 share 12 [root@pghost opt]# vi pgsql9.3.4/pgdata/pg_hba.conf # IPv4 local connections: host all all 0.0.0.0/0 md5 13 [root@pghost opt]# vi pgsql9.3.4/pgdata/postgresql.conf listen_addresses = '*' #listen_addresses = 'localhost' unix_socket_directories = '.' #unix_socket_directories = '/tmp' unix_socket_permissions = 0700 #unix_socket_permissions = 0777 14 [postgres@pghost ~]$ pg_ctl -D /opt/pgsql9.3.4/pgdata/ -l /opt/pgsql9.3.4/pgdata/pg_log/startup.log start server starting [postgres@pghost ~]$ [postgres@pghost ~]$ ps -ef | grep postgres postgres 33829 1 0 15:26 pts/1 00:00:00 /opt/pgsql9.3.4/bin/postgres -D /opt/pgsql9.3.4/pgdata postgres 33831 33829 0 15:26 ? 00:00:00 postgres: checkpointer process postgres 33832 33829 0 15:26 ? 00:00:00 postgres: writer process postgres 33833 33829 0 15:26 ? 00:00:00 postgres: wal writer process postgres 33834 33829 0 15:26 ? 00:00:00 postgres: autovacuum launcher process postgres 33835 33829 0 15:26 ? 00:00:00 postgres: stats collector process [postgres@pghost ~]$ 15 [root@pghost ~]# vi /etc/sysconfig/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT [root@pghost ~]# /etc/init.d/iptables restart 16 [root@hostalonetest ~]# /opt/PostgreSQL/9.3/bin/psql -h 192.168.19.77 -Upostgres Password for user postgres: psql.bin (9.3.5,server 9.3.4) Type "help" for help. postgres=#
参考:http://www.postgresql.org/docs/9.3/interactive/tutorial-install.html
----------------- blog.csdn.net/beiigang (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |