Bookmark this page

Guided Exercise: Configuring a Developer Environment

In this exercise you will install the required software for the course.

Outcomes

You should be able to:

  • Install Git

  • Install the Java Development Kit (JDK)

  • Install Python

  • Install the Red Hat OpenShift Container Platform CLI

  • Install the grading scripts

  • Create KeyStore files

  • Clone the sample code

To perform this exercise, ensure you have an account with administration permissions on your workstation.

In the exercise, you will install several software applications. The following table states the minimum and maximum versions required to perform the course. The asterisk symbol (*) indicates no upper version limit.

SoftwareMinimum versionMaximum version
Git2*
OpenJDK 1111.0.12*
Python3.63.9
Red Hat OpenShift command line interface (OC)4.6.40*

Important

If you face problems installing the required software, then you can use the cloud workstation. When using the cloud workstation, you must start this exercise from step 5.

Procedure 1.1. Instructions

  1. Download and install Git on your operating system.

    Then, verify the successful installation by using the command line:

    [user@host ~]$ git --version
    git version 2.31.1

    Note

    The Git version on your system might differ. Any recent version of Git will work with this course.

  2. Install the Eclipse Temurin OpenJDK 11 distribution.

    Then, verify the successful installation by using the command line:

    [user@host ~]$ java -version
    openjdk 11.0.15 2022-04-19
    OpenJDK Runtime Environment Temurin-11.0.15+10 (build 11.0.15+10)
    OpenJDK 64-Bit Server VM Temurin-11.0.15+10 (build 11.0.15+10, mixed mode)
  3. Install Python 3.

    • On Windows, download and install the latest Python installer.

      Execute the installer, select the Add Python 3.9 to PATH check box, click Install Now, and follow the installation setup prompts.

    On the macOS and Linux operating system, Python should be installed.

    Then, verify the successful installation by using the command line:

    [user@host ~]$ python3 --version
    Python 3.9.7

    On Windows, execute the python command:

    PS C:\Users\user> python --version
    Python 3.9.7

    Warning

    Python >= 3.10 is not yet supported.

    Make sure that your Python version is >= 3.6 and < 3.10.

  4. Install the Red Hat OpenShift Container Platform (RHOCP) command line interface (CLI).

    1. In the RHOCP web console, click the question mark icon next to your username in the top right. Then click Command Line Tools.

      Figure 1.3: Navigate to the command line tools page
    2. Download the relevant oc archive for your platform.

    3. Unzip the compressed archive file, and then copy the oc binary to a directory of your choice. Ensure that this directory is in the PATH variable for your system.

    4. Verify the successful installation by using the command line:

      [user@host ~]$ oc version --client
      Client Version: 4.6.40
  5. Create the workspace directory, install the grading scripts for this course, and initialize the Kafka RHOCP configuration.

    1. Create the workspace directory and navigate to that directory.

      [user@host ~]$ mkdir ~/AD482
      [user@host ~]$ cd ~/AD482
    2. Create and activate a new Python virtual environment.

      [user@host AD482]$ python3 -m venv .venv
      [user@host AD482]$ source .venv/bin/activate

      Important

      On the Windows operating system, use the python command instead of the python3 command:

      PS C:\Users\user\AD482> python -m venv .venv
      PS C:\Users\user\AD482> ./.venv/Scripts/Activate.ps1
    3. Upgrade pip.

      (.venv) [user@host AD482]$ pip install --upgrade pip
      ...output omitted...

      Important

      Windows users must upgrade pip as follows:

      PS C:\Users\user\AD482> python -m pip install --upgrade pip
    4. Install the rht-labs-ad482 course scripts into the Python virtual environment.

      (.venv) [user@host AD482]$ pip install rht-labs-ad482 \
       --extra-index-url \
       https://pypi.apps.tools-na.prod.nextcle.com/repository/labs/simple
      ...output omitted...

      Important

      Windows users must adapt line-breaking characters in multi-line commands throughout the course.

      In PowerShell, use the backtick character (`) to introduce a line break in a command. For example, to run the preceding command in Windows PowerShell, you must run it as follows:

      PS C:\Users\user\AD482> pip install rht-labs-ad482 `
       --extra-index-url `
       https://pypi.apps.tools-na.prod.nextcle.com/repository/labs/simple
    5. Select the ad482 course scripts by using the lab command.

      (.venv) [user@host AD482]$ lab select ad482
    6. Initialize the workspace and user-specific RHOCP configuration.

      (.venv) [user@host AD482]$ lab start eda-setup
      
      This script configures the connection parameters to access the OpenShift cluster for your lab scripts.
      
      ? Enter your workspace directory: ...output omitted...
      ...output omitted...

      Note

      You should run lab start eda-setup every time that you delete your lab environment.

  6. Generate a truststore.jks file with password as the store password. Store the KeyStore files in your workspace.

    (.venv) [user@host AD482]$ keytool -import -trustcacerts -alias root \
     -file kafka-cluster.crt -keystore truststore.jks \
     -storepass password -noprompt
    Certificate was added to keystore

    Note

    The keytool utility is a part of the JDK. If you cannot execute keytool, then try using the full path.

    For example, on Windows, try using %JAVA_HOME%/bin/keytool in the preceding command.

  7. Clone the AD482-apps repository to your AD482 workspace.

    Note

    This course uses the AD482-apps repository to create the directory structure for the guided exercise and lab activities.

    See the section called “Lab Directory Structure Considerations” for more information about the directory structure.

    1. From the AD482 workspace directory, clone the AD482-apps repository to your workstation:

      (.venv) [user@host AD482]$ git clone https://github.com/redhattraining/AD482-apps
      Cloning into 'AD482-apps'...
      ...output omitted...
    2. Verify that the cloned repository contains the repository content and return to the workspace directory.

      (.venv) [user@host AD482]$ cd AD482-apps
      (.venv) [user@host AD482-apps]$ head README.md
      # AD482 Application Repository
      ...output omitted...
      (.venv) [user@host AD482-apps]$ cd ..

      Important

      Windows users must replace the preceding head command in PowerShell as follows:

      PS C:\Users\user\AD482\AD482-apps> type README.md

Finish

Use the lab command to complete this exercise. This is important to ensure that resources from previous exercises do not impact upcoming exercises.

[user@host AD482]$ lab finish eda-setup

This concludes the guided exercise.

Revision: ad482-1.8-cc2ae1c