OpenShift ships with a feature rich web console as well as command line tools to provide users with a nice interface to work with applications deployed to the platform. The OpenShift tools are a single executable written in the Go programming language and is available for the following operating systems:
-
Microsoft Windows
-
Apple OS X
-
Linux
During this lab, we are going to download the client tool and add them to our operating system $PATH environment variables so the executable is accessible from any directory on the command line.
The first thing we want to do is download the correct executable for your operating system as linked below:
-
{{DOWNLOAD_CLIENT_WINDOWS}}[Microsoft Windows]
-
{{DOWNLOAD_CLIENT_MAC}}[Apple OS X]
-
{{DOWNLOAD_CLIENT_LIN64}}[Linux 64] {% if DOWNLOAD_CLIENT_LIN32.empty? %}
-
{{DOWNLOAD_CLIENT_LIN32}}[Linux 32] {% endif %}
Once the file has been downloaded, you will need to extract the contents as it is a compressed archive. I would suggest saving this file to the following directories:
Windows:
C:\OpenShift
OS X:
~/OpenShift
Linux:
~/OpenShift
Once you have the tools downloaded, you will need to extract the contents:
Windows:
In order to extract a zip archive on windows, you will need a zip utility installed on your system. With newer versions of windows (greater than XP), this is provided by the operating system. Just right click on the downloaded file using file explorer and select to extract the contents.
OS X:
Open up a terminal window and change to the directory where you downloaded the file. Once you are in the directory, enter in the following command:
$ tar zxvf oc-macosx.tar.gz
The tar.gz file name needs to be replaced by the entire name that was downloaded in the previous step.
Linux:
Open up a terminal window and change to the directory where you downloaded the file. Once you are in the directory, enter in the following command:
$ tar zxvf oc-linux.tar.gz
The tar.gz file name needs to be replaced by the entire name that was downloaded in the previous step.
Windows:
Because changing your PATH on windows varies by version of the operating system, we will not list each operating system here. However, the general workflow is right click on your computer name inside of the file explorer. Select Advanced system settings. I guess changing your PATH is considered an advanced task? :) Click on the advanced tab, and then finally click on Environment variables. Once the new dialog opens, select the Path variable and add ";C:\OpenShift" at the end. For an easy way out, you could always just copy it to C:\Windows or a directory you know is already on your path. For more detailed instructions:
Windows 10 - Follow the directions above.
OS X:
$ export PATH=$PATH:~/OpenShift
Linux:
$ export PATH=$PATH:~/OpenShift
At this point, we should have the oc tool available for use. Let’s test this out by printing the version of the oc command:
$ oc version
You should see the following (or something similar):
{{OC_VERSION}}
If you get an error message, you have not updated your path correctly. If you need help, raise your hand and the instructor will assist.