Installing Amazon Corretto 21 on Ubuntu
Learning Objectives:
By the end of this lesson, you will be able to:
- Add the Amazon Corretto repository to your Ubuntu system
- Install Amazon Corretto 21 using the package manager
- Configure essential environment variables for Java development
- Verify the successful installation of Amazon Corretto 21
Let's begin the installation process for Amazon Corretto 21 on Ubuntu. We'll use the command line interface (Terminal) for most of these steps, so open your Terminal to get started.
Step 1: Update Package Index First, we need to update the package index:
Step 2: Install Required Dependencies:
Step 3: Import the Amazon Corretto Public Key
Step 4: Add the Amazon Corretto Repository
Step 5: Update Package Index Again
Step 6: Install Amazon Corretto 21
Step 7: Set Up Environment Variables
Add the following lines at the end of the file:
Save the file and exit the editor. Then, reload your .bashrc
file:
Step 8: Verify the Installation
You should see output similar to this:
This output confirms that Amazon Corretto 21 is installed and ready to use on your system.
Congratulations! You've successfully installed Amazon Corretto 21 on your Ubuntu machine. This Java Development Kit provides you with all the tools you need to start writing, compiling, and running Java programs.
Summary:
In this lesson, we've walked through the process of installing Amazon Corretto 21 on Ubuntu. We've covered updating the package index, installing dependencies, adding the Amazon Corretto repository, installing the JDK, setting up essential environment variables, and verifying the installation. By following these steps, you've set up a robust Java development environment that will serve you well as you embark on your Java programming journey.