Developing Event-driven Applications with Apache Kafka and Red Hat AMQ Streams
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.
| Software | Minimum version | Maximum version |
|---|---|---|
| Git | 2 | * |
| OpenJDK 11 | 11.0.12 | * |
| Python | 3.6 | 3.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
Download and install Git on your operating system.
On Windows, download and install the latest Git binary.
On macOS, download and install the latest Git binary.
On Linux, install the latest Git binary.
Then, verify the successful installation by using the command line:
[user@host ~]$
git --versiongit version 2.31.1Note
The Git version on your system might differ. Any recent version of Git will work with this course.
Install the Eclipse Temurin OpenJDK 11 distribution.
On Windows, download the MSI JDK 11 installer from Eclipse Temurin Latest Releases and follow the Windows MSI installation instructions.
Warning
Make sure to select the option Set JAVA_HOME variable during the installation.
On macOS, download the PKG JDK 11 installer from Eclipse Temurin Latest Releases and follow the macOS PKG installation instructions.
Warning
If you are using a Mac with an Apple silicon processor, you should install the
x64 architecturebinary. Although thex64 architecturebinary is intended for Intel processors, currently, there is no silicon version for OpenJDK 11. Your Mac should automatically use Rosetta[https://support.apple.com/en-us/HT211861] in the background to run thex64 architecturebinary.At the same time, be aware that versions prior to
11.0.12contain a bug that affects the section called “Guided Exercise: Preventing Duplication and Data Loss”. For more information, see JDK-8261397.On Linux, follow the Linux (RPM/DEB) installation instructions.
Then, verify the successful installation by using the command line:
[user@host ~]$
java -versionopenjdk 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)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 --versionPython 3.9.7On Windows, execute the
pythoncommand:PS C:\Users\user>
python --versionPython 3.9.7Warning
Python >= 3.10 is not yet supported.
Make sure that your Python version is >= 3.6 and < 3.10.
Install the Red Hat OpenShift Container Platform (RHOCP) command line interface (CLI).
In the RHOCP web console, click the question mark icon next to your username in the top right. Then click .
Figure 1.3: Navigate to the command line tools pageDownload the relevant
ocarchive for your platform.Unzip the compressed archive file, and then copy the
ocbinary to a directory of your choice. Ensure that this directory is in thePATHvariable for your system.On macOS and Linux, copy the
ocbinary to/usr/local/binand make it executable:[user@host ~]$
sudo cp oc /usr/local/bin/[user@host ~]$sudo chmod +x /usr/local/bin/ocFor Windows systems, decompress the downloaded archive into a directory of your choice. Then, add the full path of the directory with the
ocbinary to yourPATHenvironment variable. Follow the instructions at https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ee537574(v=office.14)#to-add-a-path-to-the-path-environment-variable to edit thePATHenvironment variable.
Verify the successful installation by using the command line:
[user@host ~]$
oc version --clientClient Version: 4.6.40
Create the workspace directory, install the grading scripts for this course, and initialize the Kafka RHOCP configuration.
Create the workspace directory and navigate to that directory.
[user@host ~]$
mkdir ~/AD482[user@host ~]$cd ~/AD482Create and activate a new Python virtual environment.
[user@host AD482]$
python3 -m venv .venv[user@host AD482]$source .venv/bin/activateImportant
On the Windows operating system, use the
pythoncommand instead of thepython3command:PS C:\Users\user\AD482>
python -m venv .venvPS C:\Users\user\AD482>./.venv/Scripts/Activate.ps1Upgrade 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 pipInstall the
rht-labs-ad482course 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/simpleSelect the
ad482course scripts by using thelabcommand.(.venv) [user@host AD482]$
lab select ad482Initialize the workspace and user-specific RHOCP configuration.
(.venv) [user@host AD482]$
lab start eda-setupThis 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-setupevery time that you delete your lab environment.
Generate a
truststore.jksfile withpasswordas 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 -nopromptCertificate was added to keystoreNote
The
keytoolutility is a part of the JDK. If you cannot executekeytool, then try using the full path.For example, on Windows, try using
%JAVA_HOME%/bin/keytoolin the preceding command.Clone the
AD482-appsrepository to yourAD482workspace.Note
This course uses the
AD482-appsrepository 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.
From the
AD482workspace directory, clone theAD482-appsrepository to your workstation:(.venv) [user@host AD482]$
git clone https://github.com/redhattraining/AD482-appsCloning into 'AD482-apps'... ...output omitted...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
headcommand in PowerShell as follows:PS C:\Users\user\AD482\AD482-apps>
type README.md
This concludes the guided exercise.
