如何在OpenShift上编译和安装源代码?

时间:2015-05-06 15:10:22

标签: compilation installation makefile openshift openshift-cartridge

我正在尝试在线安装OpenShift上的'whois', 由于权限

,我无法使用yum进行安装
\> yum install whois
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:

Error: rpmdb open failed

我不知道安装软件包的其他方法,所以考虑编译源代码。

make可用。

\> make -version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for x86_64-redhat-linux-gnu

那么如何在OpenShift上通过SSH编译源代码? 非常感谢你!

编辑: 我可以make包裹,但不能install包裹。

更新: 添加环境变量和相关数据。

$PATH

[app-domain.rhcloud.com whois-5.2.7]\> echo $PATH
/var/lib/openshift/{{ directory_hash }}/python//virtenv/bin:/var/lib/openshift/{{ directory_hash }}/python//bin:/opt/rh/python27/root/usr/bin:/bin:/usr/bin:/usr/sbin

install

[app-domain.rhcloud.com whois-5.2.7]\> which install
/var/lib/openshift/{{ directory_hash }}/python/bin/install

make install

期间的错误消息
[app-domain.rhcloud.com whois-5.2.7]\> make install BASEDIR=./destdir/
install -d ./destdir//usr/bin/
/var/lib/openshift/{{ directory_hash }}/python//bin/install: line 10: version: unbound variable
make: *** [install-whois] Error 1

make /path/to/install

期间的错误消息
[app-domain.rhcloud.com whois-5.2.7]\> make /var/lib/openshift/{{ directory_hash }}/python/bin/install BASEDIR=./destdir/
make: Nothing to be done for `/var/lib/openshift/{{ directory_hash }}/python/bin/install'.

2 个答案:

答案 0 :(得分:1)

首先,您应该获取' whois':

的源代码
wget http://ftp.debian.org/debian/pool/main/w/whois/whois_5.2.7.tar.xz

然后有必要提取它:

tar -xf whois_5.2.7.tar.xz

现在你有一个包含源代码的目录,所以最后一步是用' make'进行编译。

我认为所有这些都可以通过SSH在OpenShift上完成。

答案 1 :(得分:1)

<强>更新 您发布的环境$PATH变量表明系统的install命令可能已被python的{​​{1}}命令所取代。这就是make命令在尝试安装二进制文件时失败的原因。

你有两个解决方案。

  • 暂时从install变量中删除python路径。下次登录OpenShift时,它将恢复为原始值:

    $PATH

  • 修改export PATH=/bin:/usr/bin:/usr/sbinMakefile个文件,并将po/Makefile命令的固定路径设置为install/usr/bin/install s中的行:

    Makefile

    应为:

    INSTALL = install

要在安装到INSTALL = /usr/bin/install时解决权限问题,您必须将/usr安装到自定义目录。此示例将其安装到whois子目录。

destdir