In this Lab we will look at how to install the OpenShift CLI tools.
Installing the Command-line Tools
After completing this section, you should be able to:
-
Locate the binaries for the OpenShift Container Platform command-line interface (OCP CLI)
-
Install the OCP CLI tools.
-
CLI basic configuration
Locating the binaries
The OCP CLI exposes commands for managing applications, as well as lower-level tools to interact with each component of a system. The binaries for Mac, Windows, and Linux are available for download from the this GitHub repository via the following URL. Please download the file appropriate for your operating system.
Installing the CLI tools
The CLI is provided as compressed files that can be decompressed to any
directory. In order to make it simple for any user to access the OCP
CLI, it is recommended that it is made available in a directory mapped
to the environment variable called PATH
from the OS. More information
can be found about installation process here:
-
OSX and Linux:
1.1. Copy the binary to the
/usr/local/bin
directory, or one of the paths listed in thePATH
environment variable. -
Windows:
2.1. Use oc.exe to open an OpenShift shell. If you getting error from running oc, go to git-scm.com to download git bash for Windows (during installation you need to specify in the selection to integrate with the command prompt)
CLI basic configuration
The easiest way to initially setup the OpenShift CLI is to use the
oc login
command. It will interactively ask you a server URL, username
and password. The information is automatically saved in a CLI
configuration file that is then used for subsequent commands.
To login to a remote server use:
$ oc login <hostname>:<port>