Installing and configuring the OpenShift Application Services CLI

Guide
  • Red Hat OpenShift Application Services 1
  • Updated 22 February 2023
  • Published 29 March 2022

Installing and configuring the OpenShift Application Services CLI

Guide
Red Hat OpenShift Application Services 1
  • Updated 22 February 2023
  • Published 29 March 2022

With the Red Hat OpenShift Application Services rhoas command-line interface (CLI), you can manage your application services from a terminal.

This guide describes how to set up rhoas by doing the following:

Installing the rhoas CLI

You can install rhoas on Linux, macOS, or Windows.

The rhoas Releases page lists the bug fixes and new features for every rhoas release.

Installing the rhoas CLI on Linux

If you are using Linux, you can install rhoas by either using the installation script, or the RPM. The installation script installs the latest version of rhoas by default.

Installation script

Procedure
  1. Review the install.sh installation script.

  2. Run the install.sh script:

    $ curl -o- https://raw.githubusercontent.com/redhat-developer/app-services-cli/main/scripts/install.sh | bash

    The rhoas CLI is installed in $HOME/.local/bin.

  3. Verify that the rhoas installation directory is in a directory on your PATH.

    To check your PATH, run the following command:

    $ echo $PATH
  4. Check the rhoas version to verify that the CLI is installed.

    $ rhoas --version

RPM installation

You can install rhoas as an RPM if you are using Red Hat Enterprise Linux (RHEL), Fedora, or CentOS.

Procedure
  1. Navigate to the rhoas Releases page and choose the version that you’d like to download.

  2. Use dnf/yum to install the desired version of rhoas.

    $ sudo dnf install -y https://github.com/redhat-developer/app-services-cli/releases/download/v<version-num>_/rhoas_<version-num>_linux_amd64.rpm
  3. Check the rhoas version to verify that the CLI is installed.

    $ rhoas --version

Installing the rhoas CLI on macOS

Procedure
  1. Review the install.sh installation script.

  2. Run the install.sh script:

    $ curl -o- https://raw.githubusercontent.com/redhat-developer/app-services-cli/main/scripts/install.sh | bash

    The rhoas CLI is installed in $HOME/bin.

  3. Verify that the rhoas installation directory is in a directory on your PATH.

    To check your PATH, run the following command:

    $ echo $PATH
  4. Check the rhoas version to verify that the CLI is installed.

    $ rhoas --version

Installing the rhoas CLI on Windows

Procedure
  1. Navigate to the rhoas Releases page.

  2. Download the latest rhoas .zip file.

  3. On your computer, create a C:\rhoas folder.

  4. Extract the rhoas.exe file from the .zip file that you downloaded.

  5. Move the rhoas.exe file to C:\rhoas.

  6. If you are using Windows 10, set the PATH variable.

    1. Click Search and type env or environment.

    2. Select Edit environment variables for your account.

    3. In the Variable section, select Path, and click Edit.

    4. Click New, and enter C:\rhoas.

    5. Click OK to save changes.

  7. Open a terminal and check the rhoas version to verify that the CLI is installed.

    $ rhoas --version

Configuring rhoas

After you install the rhoas CLI, you can enable command completion to automatically complete rhoas commands or suggest options when you press Tab.

The procedure for enabling command completion depends on the shell you are using. To determine which shell you are using, run the echo $0 command.

You can enable command completion for each of the following shells:

Prerequisites
  • You have a command-line terminal application.

  • You’ve installed the rhoas CLI.

  • If you’re using macOS, you’ve installed bash-completion configured in your .bash_profile file.

Enabling command completion on Bash

Procedure
  1. Create the rhoas_completions script file.

    $ rhoas completion bash > rhoas_completions
  2. Move the script file to a special Bash completions directory.

    Linux
    $ sudo mv rhoas_completions /etc/bash_completion.d/rhoas
    macOS
    $ sudo mv rhoas_completions /usr/local/etc/bash_completion.d/rhoas
    For macOS, to find the location of your bash-completion directory, check the ~/.bashrc or ~/.bash_profile file.
  3. Open a new terminal window.

    Command completion is enabled.

Enabling command completion on Zsh

Procedure
  1. Install the command completion script.

    $ rhoas completion zsh > "${fpath[1]}/_rhoas"
  2. Unless already installed, enable command completions.

    $ echo "autoload -U compinit; compinit" >> ~/.zshrc
  3. Open a new terminal window.

    Command completion is enabled.

Enabling command completion on Fish

Procedure
  1. Install fish completions.

    $ rhoas completion fish > ~/.config/fish/completions/rhoas.fish
  2. Open a new terminal window.

    Command completion is enabled.

Logging in to rhoas

After rhoas is installed, you can log in to access your application services.

Prerequisites
  • You have a Red Hat account.

  • You’ve installed the rhoas CLI.

Procedure
  1. In a terminal, log in to rhoas.

    $ rhoas login

    Your web browser opens the Red Hat Single Sign-On page.

  2. Enter your credentials to log in to your Red Hat account.

    Welcome pages in the browser notify you that you’ve been logged in to rhoas successfully.

    In your terminal, the rhoas login command indicates that you’re logged in.

Logging out of rhoas

You can log out from the rhoas CLI by using the rhoas logout command.

Procedure
  • Log out of rhoas.

    $ rhoas logout