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

x0x*_*x0x 6 installation makefile compilation 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
Run Code Online (Sandbox Code Playgroud)

我不知道安装包的任何替代方法,所以考虑编译源代码.

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
Run Code Online (Sandbox Code Playgroud)

那么如何在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
Run Code Online (Sandbox Code Playgroud)

install

[app-domain.rhcloud.com whois-5.2.7]\> which install
/var/lib/openshift/{{ directory_hash }}/python/bin/install
Run Code Online (Sandbox Code Playgroud)

错误消息 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
Run Code Online (Sandbox Code Playgroud)

错误消息 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'.
Run Code Online (Sandbox Code Playgroud)

baf*_*baf 0

更新: 您发布的环境$PATH变量表明系统的install命令可能被pythoninstall命令取代。这就是尝试安装二进制文件时 make 命令失败的原因。

你有两个解决方案。

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

    export PATH=/bin:/usr/bin:/usr/sbin

  • 编辑Makefilepo/Makefile文件并将install命令的固定路径设置为/usr/bin/install. 两个 s 中的行Makefile

    INSTALL = install

    应该读:

    INSTALL = /usr/bin/install


要解决安装时的权限问题,/usr您必须安装whois到自定义目录。本示例将其安装到destdir子目录中。

$ wget http://ftp.debian.org/debian/pool/main/w/whois/whois_5.2.7.tar.xz
$ tar xf whois_5.2.7.tar.xz
$ cd whois-5.2.7/
$ mkdir destdir
$ make
$ make install BASEDIR=./destdir/
$ ./destdir/usr/bin/whois --version
Version 5.2.7.

Report bugs to <md+whois@linux.it>.
Run Code Online (Sandbox Code Playgroud)