I am installing cloud foundry command line in Raspberry P2 running raspbian Jessie, I have tried ways using the Installer and the binary Installation, I have tried to force the architecture amrhf. The result I get when running the cf command on the terminal is "/usr/bin/cf: cannot execute binary file: Exec format error" I have tried to change the mode with this command "chmod +x /usr/bin/cf" the error is still there.
As @Billp3rd says, it seems that the binary (
/usr/bin/cf) is not compiled for ARM architecture.
You need to compile it from source. To do so:
go on your raspi, because
cf is developed in
Do not use
apt-get install golang. If it has been installed from repo, remove it by
apt-get remove golang; apt-get autoremove.
The version 1.3.1 in the repo has known bugs. Instead download arm distribution of
the latest version which is 1.7.1 for now.
root@mypi:~# cd /opt root@mypi:/opt# wget https://storage.googleapis.com/golang/go1.7.1.linux-armv6l.tar.gz root@mypi:/opt# tar xvf go1.7.1.linux-armv6l.tar.gz root@mypi:/opt# cd ~
The archive is extracted to
Create a folder for
GOPATH. I choose
root@mypi:~# mkdir /root/mygopath
Set variables required for
root@mypi:~# export GOROOT=/opt/go root@mypi:~# export GOPATH=/root/mygopath
Download and build
cf-cli. This process takes some time.
root@mypi:~# /opt/go/bin/go get code.cloudfoundry.org/cli
In normal circumtances, the
cli binary should be created under
Copy or move
cli binary compiled for ARM. I prefer to put it under
root@mypi:~# mkdir /opt/cf root@mypi:~# cp /root/mygopath/bin/cli /opt/cf/
Here is output of
cli command on ARM.
root@mypi:~# /opt/cf/cli /opt/cf/cli version BUILT_FROM_SOURCE-BUILT_AT_UNKNOWN_TIME, Cloud Foundry command line tool Usage: /opt/cf/cli [global options] command [arguments...] [command options] Before getting started: config login,l target,t help,h logout,lo Application lifecycle: apps,a logs set-env,se push,p ssh create-app-manifest start,st app stop,sp env,e restart,rs scale restage,rg events