OpenShift oc command line with Cygwin - cygwin

I'm running Cygwin 64bit but can't seem to get OpenShift oc command line to work
I downloaded oc.tar.gz ( from here https://mirror.openshift.com/pub/openshift-v3/clients/3.6.173.0.5/linux/oc.tar.gz ), unzipped it and placed it in my path in /usr/bin
When I try to run: oc login I get the following.
-bash: /usr/bin/oc: cannot execute binary file: Exec format error
Do I need to somehow 'install' the executable ?
Any help would be much appreciated.

In addition to #Graham Dumpleton's answer:
open cygwin and check for directory /usr/local/bin
mkdir -p local/bin
$ cd /usr/local/bin
if it does not exists:
$ mkdir -p local/bin
finally extract the windows package:
$ cp /cygdrive/c/Users/me/Downloads/oc-3.5.5.31.24-windows.zip /usr/local/bin/
unzip oc-3.5.5.31.24-windows.zip
$ oc version
oc v3.5.5.31.24
kubernetes v1.5.2+43a9be4
features: Basic-Auth

Use the Windows binary from the following page:
https://github.com/openshift/origin/releases

From project homepage
https://www.cygwin.com/
Cygwin is not:
a way to run native Linux apps on Windows. You must rebuild your
application from source if you want it to run on Windows.
a way to magically make native Windows apps aware of UNIX®
functionality like signals, ptys, etc. Again, you need to build your
apps from source if you want to take advantage of Cygwin
functionality.

Related

Opening AppImage does nothing. What can I do?

I am a complete newbie to Linux and trying to open an AppImage called Magick which is an Imagemagick application.
I tried right clicking on the AppImage and checked "run file as an executable" option but that didn't work. Another thing that I tried is running this command,
chmod a+x magick.AppImage
This gives me an error,
chmod: cannot access 'magick.AppImage': No such file or directory
I have also tried running the file by navigating into the folder that contains the file and opening up the terminal there but still no luck.
I am running Ubuntu on Oracle VM VirtualBox.
ImageMagick is a command-line tool, you don't run it by clicking on it.
To run it in a terminal you need to
Set the executable flag on the .AppImage (once for all): chmod +x TheApp.AppImage
Then to run it just invoke the AppImage: ./TheApp.AppImage <arg1> <arg2> ....
If the directory with your .AppImage is in your PATH, you can remove the ./ (or whatever directory the AppImage is in).
ImageMagick is also available as a regular application from your Ubuntu repository: sudo apt install imagemagick

Cytoscape and linux

Trying to install Cytoscape program on linux cytoscape. And I don't know how because first install button transfers me to HTML page and nothing is downloadable. (I have java installed). I tried to download tar.gz file but I am stuck, because there is no configure file and it says I have no permission for it. What should I do?
Once java 11 is installed on your computer try this:
ctrl+alt+T #open Ubuntu's console
cd /home/fulanita/Downloads #this is the directory where my computer has cytoscape.
chmod +x ./Cytoscape_3_8_1_unix.sh
./Cytoscape_3_8_1_unix.sh #3.8.1 is the last version for Ubuntu
the program will start to install
If anyone comes here in search for an answer I found a solution.
You go to you directory where you keep extracted tar.gz
with cd -Folderdestination/ you locate a folderwhere you keep a file named cytoscape.sh, and with command
sudo sh cytoscape.sh
install the program.

how to run non-installed(portable) application using linux terminal

I'm new to Linux and i use Kali Linux. I downloaded the eclipse ide. Every time, when i need to run it, i should navigate to eclipse folder and run the eclipse file. there are other softwares like pycharm have the same issue.
If there's any method to run these programs just typing "eclipse" or "pycharm" on terminal (like firefox, atom) it's very helpful. If anyone know how to do it please let me know. I already searched a solution for this problem and i couldn't find any solution.
-Thanks (sorry for my English)
Modify your ~/.bashrc and add the PATH of your application(you use PATH rather then CONFIG_PATH)
export PATH=$PATH:/path/to_directory_containing_program
export CONFIG_PATH=/my_path_to_PROGRAM/PROGRAM/config/
Another solution is Create a shorcut in your desktop
Go to cd /usr/local/bin (or cd /usr/bin) and do:
sudo ln -s /path/to/eclipse where eclipse is the binary that you are used to launch.
/usr/local/bin and /usr/bin directories should already be in your PATH, so you don't need to modify ~/.bashrc.

SlamData install Linux

does anyone know how to install SlamData on linux? I've download the file on my machine, and double click it, but it opens a green screen and nothing happens. Thanks.
Download the linux installer file;
add executable permission
chmod +x slamdata_unix_2_1_8.sh
Run the executable and follow instructions;
./slamdata_unix_2_1_8.sh
After installation, To start SlamData, cd to your installation dir, issue the following command;
./SlamData
For further documentation visit http://slamdata.com/documentation/

Composer & Cygwin

Composer doesn't run correctly in Cygwin if you try to install it "globally".
Putting composer.phar into /usr/local/bin/composer, then trying to run it will result in the error:
Could not open input file: /usr/local/bin/composer
Just tripped over the same problem and found a solution. Posting it here, just in case I'll ever have to look it up again.
Set up a bin directory right under /home/my-username:
cd ~
mkdir bin
Move the composer.phar (or any other of those nifty new PHP imps that are on the rise)
into the ~/bindirectory and make sure to set it's execution bit:
# Notice how I got rid of the superfluous `.phar` extension
mv /path/to/composer.phar ~/bin/composer
chmod +x ~/bin/composer
Tell cygwin to include your ~/bin directory in the search path:
Open up the file ~/.bash_profile and uncomment the following paragraph ...
# Set PATH so it includes user's private bin if it exists
if [ -d "${HOME}/bin" ] ; then
PATH="${HOME}/bin:${PATH}"
fi
Now, for the most important part:
A wrapper script that helps Win's native PHP resolve Unix style paths (which is causing
the problem after all as Windows doesn't know how to handle /cygdrive/... paths).
cd ~/bin
touch php
chmod +x php
After editing the wrapper script ~/bin/php should read:
#!/bin/bash
# e.g. php="/cygdrive/c/Program Files (x86)/php/php.exe"
php="/path/to/php.exe"
for ((n=1; n <= $#; n++)); do
if [ -e "${!n}" ]; then
# Converts Unix style paths to Windows equivalents
path="$(cygpath --mixed ${!n} | xargs)"
case 1 in
$(( n == 1 )) )
set -- "$path" "${#:$(($n+1))}";;
$(( n < $# )) )
set -- "${#:1:$((n-1))}" "$path" ${#:$((n+1)):$#};;
*)
set -- "${#:1:$(($#-1))}" "$path";;
esac
fi
done
"$php" "$#"
Now restart your shell and it should correctly invoke the PHP interpreter whenever it
stumbles upon a #!/usr/bin/env php shebang. Simply issue a:
composer --help
How about this one?
In ~/.bashrc, add: alias composer='php c:\\your\\path\\to\\composer.phar'
Restart cygwin or reload the bashrc by running source ~/.bashrc
Works for me using both Cygwin's native php.exe and XAMPP's Windows-specific one.
I think what might work is to build a proxy instead:
Put composer.phar in /usr/local/bin/composer.phar
Create a bash proxy as /usr/local/bin/composer with the following:
#!/bin/sh
c:/path/to/php c:/path/to/composer.phar $#
chmod +x /usr/local/bin/composer
Try this:
Install Cygwin PHP and use it to run composer in Cygwin.
You can choose one of two ways to work fine with PHP+Composer in Cygwin:
Install Cygwin PHP and install composer.phar in Cygwin.
Install Windows PHP and install Winodows Composer, then call then from Cygwin. (Windows XAMMP+Composer with alias in cmd)
Your problem is caused by that Cygwin Composer is ruining by Windows PHP on Cygwin, so it can not recognize the file path.
After install Cygwin PHP, the composer will integrates with Cygwin PHP then fit to Cygwin's filepath.
Cygwin PHP extensions for composer usage:
php
php-json
php-mbstring
php-phar
php-zip
php-posix
You can install other PHP extension when composer's package is needed such as php-xmlwriter, php-tokenizer, php-ctype.
Installation commands guide:
If you have already installed apt-cyg, there are installation command above:
apt-cyg install php php-json php-mbstring php-phar php-zip php-posix
apt-cyg install php-xmlwriter php-tokenizer php-ctype
Then install Composer via Cygwin PHP:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
chmod +x ./composer.phar
mv ./composer.phar /usr/bin/composer
composer -v
Conclusion
I recommend using Windows PHP + Windows Composer, and call then in Cygwin, it because the Cygwin PHP is not much stable than Windows PHP.
I had the same problem. After reading the final instruction from composer installer, it says that the $PATH variable should be reloaded. I rebooted my computer and then linked the Composer bin to /usr/local/bin.
First locate the composer bin :
/cygdrive/c/ProgramData/ComposerSetup/bin/composer
Then according to Seldaek answer, after trying a non-working symlink, I did :
nano /usr/local/bin/composer
#!/bin/sh
/cygdrive/c/ProgramData/ComposerSetup/bin/composer $#
chmod +x /usr/local/bin/composer
And it's working.
What I did (very simple):
Install Composer normally with the Windows installer
Open a Cygwin console an type composer you will see something like Could not open input file: /c/route/to/your/composer/installation/bin
Create an alias composer='composer.bat' on your bash profile or bashrc or whatever
Done
I'm running Windows 8.1
I was having this issue. Most of the responses were over my head but I fixed it with no problems.
Step 1) Reinstall Composer globally as per https://getcomposer.org/download/
Step 2) Leave it alone. All the special stuff you want to do, don't do that.
Step 3) Download the latest setup-xxx.exe from https://cygwin.com/
Step 4) Click it with your mouse.
NOTE: During step 5 you will feel a sudden urge to read instructions, browse the web for info and start checking little boxes on the menu. Don't do that.
Step 5) Click 'next' until it stops asking. It will look at your existing
settings, fix things up and add any missing dependencies.
This worked for me.
Getting composer to work globally inside Cygwin is a pain in the butt...
The solutions I have come up with:
Don't use it globally. If you are using the PHP CLI from a Windows installation, it won't recognize the Linux paths that Cygwin uses.
What I have done is put it in the base directory of all the projects I use composer with, and do ../composer.phar to run it.
It works fine this way, and it's almost globally available...
Download, and compile your own PHP binaries within Cygwin... Yea, kind of a overkill.
I solved the problem like this in a Cygwin/XAMPP setup:
Install composer.phar to XAMPP's php directory
Create an executable Bash script named composer in XAMPP's php directory:
#!/bin/bash
script_dir=$(cygpath -w $(dirname $0))
php "$script_dir/composer.phar" $#
It's important to use cygpath -w to convert the path to a path in Windows form.
Make sure XAMPP's php directory is accessible in Cygwin's $PATH:
$ export PATH=$PATH:/cygdrive/i/dev/server/xampp/php
Now it's possible to call composer from anywhere you like without problems:
$ composer -V
Composer version 264f433ca3f007d39568b3722b4bf418f58ba15b
I fixed it by adding a /usr/local/bin/composer file:
nano /usr/local/bin/composer
with the following content:
#!/bin/bash
/cygdrive/c/wamp/bin/php/php5.4.3/php "C:\wamp\bin\php\php5.4.3\composer"
Basically, you have to call PHP with a Windows style path, not a cygwin path.
The easiest way is to install composer using the Windows installer from their website and then copy the two files 'composer' and 'composer.phar' from "C:\ProgramData\Composer" into a directory which is in the PATH variable. E.g. you could copy the files into the /bin/ directory of cygwin. Afterwards you can again uninstall the "Windows version" of composer.
Update! This is what I did:
Install PHP and needed modules from the Cygwin Ports project
Download the latest composer snapshot
Rename 'composer.phar' to 'composer' and save it to /usr/local/bin
Open /bin/dash.exe and run '/usr/bin/rebaseall'
Also if 4. gives you an error, composer should run now
I suggest you use babun, it is based cygwin, but you can install package by pact, you can do this:
pact install php php-json php-phar
php -r "readfile('https://getcomposer.org/installer');" | php
then enjoy yourself.
I was having trouble getting Composer to work in Cygwin and none of the solutions above were resolving my problem. Eventually I stumbled across this comment in the Composer github bugs discussion:
Yeah TBH using php from cygwin isn't a great idea, cygwin is just too different an environment. Too many hacks that create failures.. In any case closing here as there isn't much we can do I'm afraid :)
I don't know precisely where composer/Cygwin/php was tripping up, but, broadly, my problem was that I had two conflicting installations of PHP in environmental variables, one from an installation of WAMP, and another installed with Cygwin. The Cygwin PHP installation seemed to be struggling with some sort of path issue. I removed it, using only the WAMP PHP, and composer ran in Cygwin just fine.

Resources