源码安装postgresql934(二)

2015-07-24 07:27:12 · 作者: · 浏览: 5
ep 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