Categories
Linux PostgreSQL tips n trick

Centos: Installing PostgreSQL

Sometime we face situation to install postgresql in server environment without internet connection. Bellow is step – by – step to manually install postgresql locally.

[alert type=”alert-warning” close=”no”]

Download following files from here:

  • postgresql94-9.4.5-1PGDG.rhel6.x86_64.rpm
  • postgresql94-contrib-9.4.5-1PGDG.rhel6.x86_64.
  • postgresql94-libs-9.4.5-1PGDG.rhel6.x86_64.rpm
  • postgresql94-server-9.4.5-1PGDG.rhel6.x86_64.rpm

[/alert]

Installation Steps:

# rpm -ivh postgresql94-libs-9.4.5-1PGDG.rhel6.x86_64.rpm 
warning: postgresql94-libs-9.4.5-1PGDG.rhel6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:postgresql94-libs-9.4.5-1PGDG.rhe################################# [100%]
# rpm -ivh postgresql94-9.4.5-1PGDG.rhel6.x86_64.rpm 
warning: postgresql94-9.4.5-1PGDG.rhel6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:postgresql94-9.4.5-1PGDG.rhel6   ################################# [100%]
# rpm -ivh postgresql94-server-9.4.5-1PGDG.rhel6.x86_64.rpm 
warning: postgresql94-server-9.4.5-1PGDG.rhel6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:postgresql94-server-9.4.5-1PGDG.r################################# [100%]
service postgresql-9.4 initdb
Initializing database:                                     [  OK  ]
# chkconfig postgresql-9.4 on
# service postgresql-9.4 start
Starting postgresql-9.4 (via systemctl):                   [  OK  ]
# su - postgres
$ psql
psql
psql (9.2.13, server 9.4.5)
WARNING: psql version 9.2, server version 9.4.
         Some psql features might not work.
Type "help" for help.

postgres=# create database testdb;
CREATE DATABASE
Categories
Linux tips n trick Uncategorised

Centos: Allow incoming connection for specific port

By Default Centos REJECT all incoming connection. To open specific port bellow is simple instruction to allow incoming connection from port 80 and 443:

iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
service iptables save
service iptables restart
iptables -vnL
pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:80
  131 21120 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:443

done.