5

I'm trying to install 'whois' on OpenShift online, I can't install with yum due to the permissions

\> yum install whois
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:

Error: rpmdb open failed

I don't know any alternative ways to install a package, so considering to compile source code.

make is available.

\> 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

so how can I compile source code over SSH on OpenShift? thank you so much!

Edit: I can make the package but cant install the package.

Update: Adds environment variables and related data.

$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

Error message during 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

Error message during 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 Answers2

0

First you should fetch the source code of 'whois':

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

Then it is necessary to extract it:

tar -xf whois_5.2.7.tar.xz

Now you have a directory with the source code, so the last step is to compile it with 'make'.

I think all that can be done through SSH on OpenShift.

guest
  • 1
  • 1
  • I've done all till make, can run the package on shell but can't install. it says, `unbound variable` –  May 06 '15 at 16:10
  • anyway i can install the package after make? –  May 06 '15 at 16:10
  • It's been a while since I've manually compiled a application, but isn't the process to do "make install" after you "make" it? I think that's the step you're missing. Correct me if I'm completely wrong. – Shivang Saxena May 06 '15 at 23:59
  • @Zhinkk thats what the exact process is, but `install` command throws `unbound variable` –  May 09 '15 at 12:30
0

Update: Your posted environment $PATH variable suggests that system's install command is probably overtaken by python's install command. That is why the make command fails, when trying to install binaries.

You have two solutions.

  • temporarily remove the python path from the $PATH variable. It will be restored to original value when you log in to OpenShift next time:

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

  • edit Makefile and po/Makefile files and set fixed path to install command to /usr/bin/install. The line in both Makefiles:

    INSTALL = install

    should read:

    INSTALL = /usr/bin/install


To solve permission issues while installing to /usr you will have to install whois to custom dir. This example installs it to destdir subdirectory.

$ 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>.
baf
  • 4,531
  • 1
  • 21
  • 24
  • same bug, `unbound variable`! have tried changing the `install` to its absolute path, still not working! –  May 18 '15 at 17:07
  • Could you post somewhere the whole output of `make install` including the error message? – baf May 18 '15 at 20:52
  • can i access the installed package with `whois` from the terminal? –  May 19 '15 at 14:39
  • The `whois` binary is installed to `./destdir/usr/bin/whois`. You can run it from terminal specifying full path to the binary. You may also add the path to your `$PATH` variable and run it as `whois` without specifying the path. See how I run it in my answer. – baf May 19 '15 at 15:52
  • I used to execute the made package (with `make`) the same way! so there ain't a way to get it executed with typing just `whois`? what is the point of the installation if it has to run the package just like executing made package? –  May 19 '15 at 15:56
  • `whois` is a dependency and I just want it to be executed with whois, can you look into this? –  May 19 '15 at 16:00
  • You could set path to your `whois` binary in a start hook: `$app/.openshift/action_hooks/start`. Read https://forums.openshift.com/permanently-add-to-path – baf May 19 '15 at 19:07
  • One more help, can you just update what the action_hook for setting up the path for the current installation path? just to make sure it work. thanks. –  May 21 '15 at 07:50
  • Add `PATH=/path_to_whois_binary:$PATH` line to `$app/.openshift/action_hooks/start` file. However note that it will not work in your ssh session. The path will be available to you app. If you have more questions I suggest you ask new question describing you application and you goals – baf May 21 '15 at 09:50