PGAGENT安装

一、安装前的准备

1、安装好PG,我这里安装的是PG10.3,操作系统是CENTOS7

2、配置好PG的相关环境变量

3、启动PG正常

二、下载相关软件

wxGTK-2.8.12

网址:wget https://github.com/wxWidgets/wxWidgets/releases/download/v2.8.12/wxGTK-2.8.12.tar.gz

pgagent3.4

网址:https://www.pgadmin.org/download/pgagent-source-code/

二、安装

1、安装wxGTK

#检查是否安装 cmake

# cmake --version

cmake version 2.8.12.2

cd /opt/

wget https://github.com/wxWidgets/wxWidgets/releases/download/v2.8.12/wxGTK-2.8.12.tar.gz

tar -zxvf wxGTK-2.8.12.tar.gz

cd wxGTK-2.8.12/

./configure   --enable-shared=no --enable-unicode=yes

在配置的时候可能会遇到报错,如下:

*** Could not run GTK+ test program, checking why... *** The test program failed to compile or link. See the file config.log for the *** exact error that occured. This usually means GTK+ is incorrectly installed. configure: error:The development files for GTK+ were not found. For GTK+ 2, please

这个时候得安装报错提示安装相关包:(在安装的时候,会提示一大波依赖包也要安装,我直接选择全部安装了)

yum install gtk2-devel

安装完之后,再配置一次,然后开始编译

./configure   --enable-shared=no --enable-unicode=yes

make

make install

2、安装pgagent

刚开始我尝试的是源码安装,但是遇到了以下等奇葩报错无法解决,就改用rpm安装了

报错如下图:

export PGDATA=/data/pg/data

export PGHOME=/data/pg

export PATH=$PGHOME/bin:$PATH

export LD_LIBRARY_PATH=$PGHOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/lib:/usr/local/lib:$LD_LIBRARY_PATH

cmake ./ -DCMAKE_INSTALL_PREFIX= /data/pg/data

(在此之前也试过配置了PG的环境变量,用root和postgres用户都试过,还是报错)

rpm安装怎么搞呢?如下:

下载:https://yum.postgresql.org/repopackages.php#pg10

我的版本是centos 7,选择如下

下载下来就直接安装即可

rpm -ivh pgdg-centos10-10-2.noarch.rpm

执行脚本:

psql -h127.0.0.1 -p 5432 -U postgres -d postgres -f /opt/pgAgent-3.4.0-Source/sql/pgagent.sql

psql -h127.0.0.1 -p 5432 -U postgres -d postgres -f /opt/pgAgent-3.4.0-Source/sql/pgagent_upgrade.sql

注意,我这里是在postgres默认数据库执行的,如果你想在别的数据库用上pgagent,那就替换下用户名和数据库名

不过我这里还是有一些报错

[postgres@pg_test ~]$ psql -h127.0.0.1 -p 5432 -U postgres  -d postgres -f /opt/pgAgent-3.4.0-Source/sql/pgagent_upgrade.sql
CREATE FUNCTION
CREATE FUNCTION
COMMENT
psql:/opt/pgAgent-3.4.0-Source/sql/pgagent_upgrade.sql:49: ERROR:  column "jstconnstr" of relation "pga_jobstep" already exists
ALTER TABLE
ALTER TABLE

[postgres@pg_test ~]$ psql
psql (10.3)
Type "help" for help.

postgres=# create extension pgagent;
ERROR:  could not open extension control file "/opt/postgresql-10.3/share/extension/pgagent.control": 没有那个文件或目录
 

不过并没有影响我的使用,很奇怪,在这里记录一下等待日后解决吧

猜你喜欢

转载自blog.csdn.net/germany15914326114/article/details/83538947