Since you install the OpenJDK 11 from the extras repository, Make sure it is installed on your Linux 2. #2 Check if amazon-linux-extras is Installed It should allow outbound https connection. So make sure your connectivity is okay.Īdditionally, check your security group. #1 Check if your EC2 instance has internet connectionĪmazon EC2 instance uses public internet to download and install a package. If you are facing problem during installation, make sure to check below things. Optional: Troubleshooting Installation of OpenJDK 11 on Amazon Linux 2 You can do the same with javac if you need. You can enter a number and that version will become your current version. alternatives -config javaĪll the options are shown to you with selection number. If at all you are running more then one version of java, you can switch between them using below command. This step is absolutely optional and just for your information. Step 6: Switch Between Different Java Version (Optional) Least to say you are all ready to developed and run java application on your amazon linux instance. You have successfully installed OpenJDK 11 or Java 11 with JDK and JRE on Linux 2. The installation gets completed and this time when you type javac -version, you get the installed version. Install JDK on amazon linux2 using below command- sudo yum install java-11-openjdk-devel The package that contains JDK 11 is java-11-openjdk-devel and to the surprise it is available in the core repository itself. However, If your purpose is to use the machine for java related development work as well, you will need JDK as well. This is absolutely okay if all you want is to run a Java 11 application on your linux 2 machine. java -versionĪs you run the above command, you will notice that the command sudo amazon-linux-extras install java-openjdk1 1 only installs JRE and not the JDK. Let’s check the installed version of java(runtime) and javac(compiler) using below commands. We have just installed java 11 or openjdk 11 on our linux 2 EC2 instance. Step 4: Verify the OpenJDK 11 Installation Once the installation is complete, you can move ahead to check the installed version in the system. We are already connected to the EC2 instance, let’s run the above command. sudo amazon-linux-extras install java-openjdk11 Run the below command for the same- sudo yum update -y 2 Install OpenJDK 11 on Linux 2Īs we already saw, you can install openjdk 11 on amazon linux 2 using amazon-linux-extras install java-openjdk11 command. It’s always recommended to run a system update to update all the packages to the latest ones before you install new software. Let’s start with the installation of OpenJDK 11. The reason is that whenever you try to install, remove or change any software, you must have root privilege to do such tasks. Note: You’ll have to use sudo(root privilege ) to run the above command. You can install java-openjdk11 from the amazon-linux-extras repository using the below command- sudo amazon-linux-extras install java-openjdk11 You will see that java-openjdk11 is available under it as you can see in the below screenshot. This will list the available packages under this extras repository. To confirm this, you can run the below command and hit enter- amazon-linux-extras Having said that, OpenJDK 8 is present in the core repository however OpenJDK 11 is not available in the core repository rather it is available in amazon-linux-extras repository. For the newer version, they put it on amazon-linux-extras repository. Step 3: Install OpenJDK 11 on the InstanceĪmazon’s core package repository usually contains only super-stable software. Shall we move ahead with the OpenJDK installation now?Īlright, let’s go. Verify that ec2-user is showing in the username field and click Connect.Īnd, you are connected to your instance- Voila !!! You will see the below screen with the default username for a Linux 2 instance which is ec2-user. Select your instance and click Connect as shown belowĢ. How to SSH into the EC2 Instance using the EC2 Instance Connect from the Browserġ. ssh -i /path/my-key-pair.pem prefer the EC2 instance connect to SSH into instances from the browser itself and without managing a key pair. If you want to SSH from your local system, feel free to use the below command from your terminal. Link to tutorial: How to Launch EC2 Linux 2 Instance Step by Step in AWS Step 2: Connect to your Linux 2 instanceĪfter you are done with the first step, you have an up-and-running Linux 2 instance. I have covered it for you in a tutorial already. Let’s get started … Step 1: Launch an EC2 Instance(Linux 2)īefore we install the OpenJDK 11 on our EC2 Linux 2 instance, we’ll need an instance up and running. Switch Between Different Java Version (Optional).Subscribe Steps to Install OpenJDK 11 on the Amazon Linux 2 System
0 Comments
Leave a Reply. |