1. postgresql download , tar
wget http://ftp.postgresql.org/pub/source/v9.2.2/postgresql-9.2.2.tar.gz tar -xvzf postgresql-9.2.2.tar.gz2. install dependency
yum install -y make yum install -y gcc yum install -y bison yum install -y readline-devel yum install -y zlib-devel3. configure && gmake && gmake install
./configure --prefix=/srv/postgresql gmake gmake install4. useradd (Optional)
useradd luvu chown -Rf luvu.luvu /srv/postgresql5. initialize
su - luvu mkdir /srv/postgresql/data # make data directory /srv/postgresql/bin/initdb -D /srv/postgresql/data [luvu@postgresql01 postgresql]$ /srv/postgresql/bin/initdb -D /srv/postgresql/data The files belonging to this database system will be owned by user "luvu". This user must also own the server process. The database cluster will be initialized with locale "ko_KR.UTF-8". The default database encoding has accordingly been set to "UTF8". initdb: could not find suitable text search configuration for locale "ko_KR.UTF-8" The default text search configuration will be set to "simple". fixing permissions on existing directory /srv/postgresql/data ... ok creating subdirectories ... ok selecting default max_connections ... 100 selecting default shared_buffers ... 32MB creating configuration files ... ok creating template1 database in /srv/postgresql/data/base/1 ... ok initializing pg_authid ... ok initializing dependencies ... ok creating system views ... ok loading system objects' descriptions ... ok creating collations ... ok creating conversions ... ok creating dictionaries ... ok setting privileges on built-in objects ... ok creating information schema ... ok loading PL/pgSQL server-side language ... ok vacuuming database template1 ... ok copying template1 to template0 ... ok copying template1 to postgres ... 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: /srv/postgresql/bin/postgres -D /srv/postgresql/data or /srv/postgresql/bin/pg_ctl -D /srv/postgresql/data -l logfile start [luvu@postgresql01 postgresql]$5. useradd
[luvu@postgresql01 bin]$ ./psql -d postgres psql (9.2.2) Type "help" for help. postgres=# alter user luvu with password 'newpassword'; ALTER ROLE postgres=#6. service registration
[luvu@postgresql01 bin]$ cp /srv/src/postgresql-9.2.2/contrib/start-scripts/linux /etc/init.d/postgresql vi /etc/init.d/postgresql ## EDIT FROM HERE # Installation prefix prefix=/srv/postgresql # Data directory PGDATA="/srv/postgresql/data" # Who to run the postmaster as, usually "postgres". (NOT "root") PGUSER=luvu [luvu@postgresql01 bin]$ chmod +x /etc/init.d/postgresql [luvu@postgresql01 bin]$ chkconfig --add postgresql7. postgresql service configuration
vi /srv/postgresql/data/postgresql.conf # PostgreSQL configuration file vi /srv/postgresql/data/pg_hba.conf # PostgreSQL Client Authentication Configuration File*) reference - http://www.postgresql.org/docs/9.2/static/config-setting.html#CONFIG-SETTING-- CONFIGURATION-FILE - http://www.postgresql.org/docs/9.2/static/auth-pg-hba-conf.html 8. start postgresql
service postgresql start # start service service postgresql stop # stop service9. firewall
iptables -I INPUT -p tcp --dport 5432 -j ACCEPT service iptables save service iptables restartetc. remote access authentication example
vi postgresql.conf # - Connection Settings - listen_addresses = '*' port = 5432 vi pg_hba.conf host all all 192.168.0.0/0 password service postgresql restartNext Step
- HA 구성
- replication 설정
Reference :
http://www.postgresql.org/docs/9.2/static/install-procedure.html
http://wiki.apache.org/cassandra/