如何下载,编译和编辑在没有安装PostgreSQL的服务器上仅安装libpq源 [英] How to download, compile & install ONLY the libpq source on a server that DOES NOT have PostgreSQL installed
问题描述
如何下载,编译,制作&在没有安装PostgreSQL的服务器(Ubuntu)上仅安装libpq源?
How can I download, compile, make & install ONLY the libpq source on a server (Ubuntu) that DOES NOT have PostgreSQL installed?
我在此处找到了libpq源.但是,它似乎不能与整个PostgreSQL分开.预先感谢.
I have found the libpq source here. However it does NOT seem to be separable from the entire PostgreSQL. Thanks in advance.
我不想安装整个PostgreSQL.我想使用libpq作为安装了DIFFERENT服务器(也是Ubuntu)上的PostgreSQL的C接口.
I DO NOT want to install the entire PostgreSQL. I want to use libpq as a C interface to PostgreSQL on a DIFFERENT server (also Ubuntu) that DOES have it installed.
我还找到了此旧链接,该链接指示以上内容是可行的,但不可行.
I also found this old link which indicates that the above is POSSIBLE but not HOW to do it.
推荐答案
我在这里找到了libpq源.但是,它似乎不能与整个PostgreSQL分开.
I have found the libpq source here. However it does NOT seem to be separable from the entire PostgreSQL.
它必须配置有整个源代码树,因为这是生成必需的Makefile
部分的原因.但是配置后,make
&& make install
可以单独在src/interfaces/libpq
目录中运行,其余部分则完全被排除在外.
It has to be configured with the entire source tree because that's what generates the necessary Makefile
parts. But once configured, make
&& make install
can run inside the src/interfaces/libpq
directory alone, and the rest being left out completely.
分步进行:
- 下载源代码存档,例如 https://ftp.postgresql.org/pub/source/v9.4.1/postgresql-9.4.1.tar.bz2
- 解压到构建目录中:
tar xjf ~/Downloads/postgresql-9.4.1.tar.bz2
-
apt-get install libssl-dev
(如果尚未安装) - cd进入并配置:
cd postgresql-9.4.1; ./configure --with-openssl --without-readline
- 假设配置成功,将CD插入
src/interfaces/libpq
并运行make
- 仍在
libpq
目录中,以root用户身份运行make install:sudo make install
.
- download the source code archive, for example https://ftp.postgresql.org/pub/source/v9.4.1/postgresql-9.4.1.tar.bz2
- unpack into a build directory:
tar xjf ~/Downloads/postgresql-9.4.1.tar.bz2
apt-get install libssl-dev
if it's not installed already- cd into it and configure:
cd postgresql-9.4.1; ./configure --with-openssl --without-readline
- Assuming configure succeeds, cd into
src/interfaces/libpq
and runmake
- still in the
libpq
directory, run make install as root:sudo make install
.
这将作为独立于库并与Ubuntu中打包的库隔离的库安装在/usr/local/pgsql
和子目录中(如果恰好已安装).要将其安装在其他位置,请在configure
的--prefix
选项中指定位置.
That will install into /usr/local/pgsql
and subdirectories as a library independent and insulated from the one packaged in Ubuntu if it happens to be installed. To install it elsewhere, specify the location with the --prefix
option to configure
.
这篇关于如何下载,编译和编辑在没有安装PostgreSQL的服务器上仅安装libpq源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!