Header Ad

Tuesday, 6 December 2016

How to install Postgresql & Pgagent CentOS 7.X.XX Redhat 7.X.XX


Prepare to install postgresql and agent to follow below required steps.

# yum install epel-release -y

# yum install postgresql -y
  
# cd /tmp/

# wget   wget https://ftp.postgresql.org/pub/pgadmin3/release/pgagent/pgAgent-3.3.0-Source.tar.gz

# yum install wxGTK.x86_64 wxGTK-devel.x86_64 cmake

# wget http://excellmedia.dl.sourceforge.net/project/wxwindows/2.8.12/wxWidgets-2.8.12.tar.gz

# tar -zxvf wxWidgets-2.8.12.tar.gz

# cd wxWidgets-2.8.12/

# ./configure --with-gtk --enable-gtk2 --enable-unicode

# make

# su -c "make install; /sbin/ldconfig"

# tar -zxvf pgAgent-3.3.0-Source.tar.gz

# cd pgAgent-3.3.0-Source/

# cmake -D PG_CONFIG_PATH:FILEPATH=/usr/bin/pg_config -D STATIC_BUILD:BOOL= OFF .

# make

# su -c "make install"

# vi /var/lib/pgsql/data/pg_hba.conf

line no 80 change peer to trust 

# systemctl restart postgresql.service

# cd pgAgent-3.3.0-Source/

# psql -U postgres -d postgres -f pgagent.sql

# su -c "echo '/usr/include/pgsql/server/lib' >> /etc/ld.so.conf.d/postgres.conf"

Create a startup file to enable when server boot.

# vi /etc/rc.d/init.d/pgagent

####################################################
#!/bin/bash
#
# /etc/rc.d/init.d/pgagent
#
# Manages the pgagent daemon
#
# chkconfig: - 65 35
# description: PgAgent PostgreSQL Job Service
# processname: pgagent
. /etc/init.d/functions


RETVAL=0
prog="PgAgent"

start() {
    echo -n $"Starting $prog: "
    daemon "/usr/local/bin/pgagent hostaddr=127.0.0.1 dbname=postgres user=postgres"
    RETVAL=$?
    echo
}
stop() {
    echo -n $"Stopping $prog: "
    killproc /usr/local/bin/pgagent
    RETVAL=$?
    echo
}

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  reload|restart)
    stop
    start
    RETVAL=$?
    ;;
  status)
    status /usr/local/bin/pgagent
    RETVAL=$?
    ;;
  *)
    echo $"Usage: $0 {start|stop|restart|reload|status}"
    exit 1
esac

exit $RETVAL
##########################################

# su -c "/sbin/service pgagent start"

# cd /etc/init.d/

# chmod 755 pgagent

# su -c "/sbin/service pgagent start"

# su -c "/sbin/chkconfig --level 345 pgagent on"

No comments:

Post a Comment