pgagent
作為postgresql的一個任務調度代理,在postgresql 9.0 以前 是附帶在pgadmin 包下面的,只是默認不安裝,9.0之后作為了一個單獨是的安裝包。所以要使用pgagent
定時任務調度的話還得單獨安裝。
在安裝pgagent之前還需要安裝另外的2個依賴包,cmake
以及wxGTK
.
這里我選擇的軟件版本分別是
postgresql 9.5.1
pgagent-3.4.0下載地址:https://www.pgadmin.org/download/pgagent.php
cmake-2.8.5 下載地址:http://cmake.org/download/
wxGTK-2.8.12 下載地址:http://www.wxwidgets.org/downloads/
一、postgresql 的安裝
(略)
二、cmake的安裝
將安裝包上傳至服務器並解壓,解壓后進入解壓后生成的cmake-2.8.5目錄,執行以下命令。
[root@lsrac97 ~]# tar zxvf pgagent-3.4.0.tar.gz
[root@lsrac97 ~]# cd cmake-2.8.5
[root@lsrac97 cmake-2.8.5]# ./bootstrap && make && make install
三、wxGTK-2.8.12 的安裝
首先配置.bash_profile
參數文件
[root@lsrac97 ~]#vi .bash_profile
#加入以下內容:
PATH=$PATH:$HOME/bin:/usr/local/wxGTK-2.8.12/bin
export LD_LIBRARY_PATH=/usr/local/wxGTK-2.8.12/lib:$LD_LIBRARY_PATH
#並生效參數文件,命令如下:
[root@lsrac97 ~]#source .bash_profile
接着解壓該安裝包並進入其目錄,然后編譯和安裝
[root@lsrac97 wxGTK-2.8.12 ]# ./configure --enable-shared=no --enable-unicode=yes --prefix=/usr/local/wxGTK-2.8.12
[root@lsrac97 wxGTK-2.8.12 ]# make && make install
四、pgagent的安裝
上傳安裝包至服務器並解壓,進入目錄執行如下命令:
[root@lsrac97 pgAgent-3.4.0-Source]# cmake ./
提示報錯:沒有安裝postgresql
CMake Error at cmake/FindPG.cmake:131 (MESSAGE):
No PostgreSQL installation could be found.
Call Stack (most recent call first):
CMakeLists.txt:107 (FIND_PACKAGE)
這里需要先指定postgresql環境變量
[root@lsrac97 pgAgent-3.4.0-Source]# source /home/postgres/.bash_profile
[root@lsrac97 pgAgent-3.4.0-Source]# cmake ./
--
-- ================================================================================
-- Configuration summary:
--
-- Project : pgagent
-- Description : pgAgent is a job scheduling engine for PostgreSQL
-- Version : 3.4.0
--
-- PostgreSQL version string : PostgreSQL 9.5.1
-- PostgreSQL version parts : 9.5.1
-- PostgreSQL path : /app/postgresql/pg951
-- PostgreSQL config binary : /app/postgresql/pg951/bin/pg_config
-- PostgreSQL include path : /app/postgresql/pg951/include
-- PostgreSQL library path : /app/postgresql/pg951/lib
-- PostgreSQL share path : /app/postgresql/pg951/share
--
-- wxWidgets version : 2.8.12
-- wxWidgets path : /usr/local/wxGTK-2.8.12
-- wxWidgets config binary : /usr/local/wxGTK-2.8.12/bin/wx-config
-- wxWidgets Static linking : YES
-- wxWidgets Debug? : NO
-- ================================================================================
--
-- Configuring done
-- Generating done
-- Build files have been written to: /app/pgAgent-3.4.0-Source
然后編譯安裝 make && make install
即可
[root@lsrac97 pgAgent-3.4.0-Source]# make && make install
--
-- ================================================================================
-- Configuration summary:
--
-- Project : pgagent
-- Description : pgAgent is a job scheduling engine for PostgreSQL
-- Version : 3.4.0
--
-- PostgreSQL version string : PostgreSQL 9.5.1
-- PostgreSQL version parts : 9.5.1
-- PostgreSQL path : /app/postgresql/pg951
-- PostgreSQL config binary : /app/postgresql/pg951/bin/pg_config
-- PostgreSQL include path : /app/postgresql/pg951/include
-- PostgreSQL library path : /app/postgresql/pg951/lib
-- PostgreSQL share path : /app/postgresql/pg951/share
--
-- wxWidgets version : 2.8.12
-- wxWidgets path : /usr/local/wxGTK-2.8.12
-- wxWidgets config binary : /usr/local/wxGTK-2.8.12/bin/wx-config
-- wxWidgets Static linking : YES
-- wxWidgets Debug? : NO
-- ================================================================================
--
-- Configuring done
-- Generating done
-- Build files have been written to: /app/pgAgent-3.4.0-Source
Scanning dependencies of target pgagent
[ 12%] Building CXX object CMakeFiles/pgagent.dir/job.cpp.o
[ 25%] Building CXX object CMakeFiles/pgagent.dir/win32.cpp.o
[ 37%] Building CXX object CMakeFiles/pgagent.dir/precomp.cpp.o
[ 50%] Building CXX object CMakeFiles/pgagent.dir/misc.cpp.o
[ 62%] Building CXX object CMakeFiles/pgagent.dir/unix.cpp.o
[ 75%] Building CXX object CMakeFiles/pgagent.dir/pgAgent.cpp.o
[ 87%] Building CXX object CMakeFiles/pgagent.dir/connection.cpp.o
Linking CXX executable pgagent
[ 87%] Built target pgagent
Scanning dependencies of target run
[ 87%] Generating pgagent--3.4.sql, pgagent.control
[100%] Built target run
[root@lsrac97 pgAgent-3.4.0-Source]# make install
[ 87%] Built target pgagent
[100%] Built target run
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/bin/pgagent
-- Removed runtime path from "/usr/local/bin/pgagent"
-- Installing: /usr/local/share/pgagent.sql
-- Installing: /usr/local/share/pgagent_upgrade.sql
-- Installing: /usr/local/./README
-- Installing: /usr/local/./LICENSE
-- Installing: /app/postgresql/pg951/share/extension/pgagent--3.4.sql
-- Installing: /app/postgresql/pg951/share/extension/pgagent.control
-- Installing: /app/postgresql/pg951/share/extension/pgagent--unpackaged--3.4.sql
編譯安裝完之后切換postgres
用戶
進入數據庫中,執行create extension pgagent;
即可。
postgres=# create extension pgagent ;
CREATE EXTENSION
如此pgagent擴展安裝完成。
下面是其中遇到的問題:
安裝wxWidGets
報錯:
checking for GTK+ version...
checking for pkg-config... /usr/bin/pkg-config
checking for GTK+ - version >= 2.6.0... no
*** 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 occurred. This usually means GTK+ is incorrectly installed.
checking for pkg-config... (cached) /usr/bin/pkg-config
checking for GTK+ - version >= 3.0.0... no
*** 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.
checking for gtk-config... no
checking for GTK - version >= 1.2.7... no
*** The gtk-config script installed by GTK could not be found
*** If GTK was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the GTK_CONFIG environment variable to the
*** full path to gtk-config.
checking for gtk-config... (cached) no
checking for GTK - version >= 1.2.3... no
*** The gtk-config script installed by GTK could not be found
*** If GTK was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the GTK_CONFIG environment variable to the
*** full path to gtk-config.
configure: error:
The development files for GTK+ were not found. For GTK+ 2, please
ensure that pkg-config is in the path and that gtk+-2.0.pc is
installed. For GTK+ 1.2 please check that gtk-config is in the path,
and that the version is 1.2.3 or above. Also check that the
libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
--libs' are in the LD_LIBRARY_PATH or equivalent.
解決:
需要安裝gtk2-devel和binutils
yum -y install gtk2-devel binutils-devel
然后wxWidGets
繼續安裝即可。
參考:
postgresql pgagent 的安裝及使用(linux 5.8)
CentOS7安裝wxWidgets錯誤解決