最近由于项目的需求,要对所有发送到客户FTP的文档进行不对称加密,所以需要用到gnugpg这款开源的加密解密软件,因此需要在Linux下进行安装,由于Linux是Redhat4,没有Yum这类在线安装软件,需要源代码编译安装,安装过程有点复杂而且遇到一些问题,特此记录下来,以备后查:
1、解压下载的文件包:
tar -xjf gnupg-2.0.21.tar.bz2
2、./configure
configure: (libgpg-error-1.9)
***
*** You need libgpg-error to build this program.
** This library is for example available at
*** ftp://ftp.gnupg.org/gcrypt/libgpg-error
*** (at least version 1.11 is required.)
***
configure: (libgcrypt-1.5.3)
***
*** You need libgcrypt to build this program.
** This library is for example available at
*** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
*** (at least version 1.4.0 using API 1 is required.)
***
configure: (libassuan-2.1.0)
***
*** You need libassuan to build this program.
*** This library is for example available at
*** ftp://ftp.gnupg.org/gcrypt/libassuan/
*** (at least version 2.0.0 (API 2) is required).
***
configure: (libksba-1.3.0)
***
*** You need libksba to build this program.
*** This library is for example available at
*** ftp://ftp.gnupg.org/gcrypt/libksba/
*** (at least version 1.0.7 using API 1 is required).
***
configure: (pth-2.0.7)
***
*** It is now required to build with support for the
*** GNU Portable Threads Library (Pth). Please install this
*** library first. The library is for example available at
*** ftp://ftp.gnu.org/gnu/pth/
*** On a Debian GNU/Linux system you can install it using
*** apt-get install libpth-dev
*** To build GnuPG for Windows you need to use the W32PTH
*** package; available at:
*** ftp://ftp.g10code.com/g10code/w32pth/
***
configure: error:
***
*** Required libraries not found. Please consult the above messages
*** and install them before running configure again.
***
逐个在上面指定的FTP上下载所依赖的包,上传到Linux服务器,一个个解压后均运行:./configure、make、 make install 命令进行编译安装。
3. 以上的包安装完成后再次运行GnuGpg的安装脚本。
./cofigure、make、 make install
但运行到make 的时候遇到以下错误提示:
“gpg2: error while loading shared libraries: libassuan.so.0: cannot open shared object file: No such file or directory”
解决方法:
在/etc/ld.so.config.d文件夹下创建 gpg2.conf 文件,在此文件内加入一行:/usr/local/lib. 保存
使用ldconfig -v 即可以查询到 /usr/local/lib.