banner



How To Install Java In Ec2

Last weekend, I was planning to load examination an awarding. Instead of giving tough time to my car 💻, i decided to setup JMeter on a EC2 instance on AWS. Before installing JMeter, i needed to install Java on the case.

This post is for anyone trying to install Java on the AWS EC2 case.

Start things first, login in to your Amazon AWS panel and search for EC2. Click on the EC2 service. On the dashboard, Click Launch Example.

No alt text provided for this image

Choose your specifications for the example as needed and launch your instance. Also, brand sure to download the.pem file during the final steps. You will demand the.pem to connect to your EC2 example from your terminal. Configuration of the EC2 instance is pretty piece of cake and you can search for resources on the web, if needed.

Connect to your EC2 instance from your concluding using the.pem file. Go to the download location of the pem file and change the file permission before connecting to the EC2.

> chmod 400 mypemfile.pem        

After irresolute the file permission, connect to you EC2 example from your concluding.

> ssh -i mypemfile.pem ec2-user@xx.x.xx.xxx        

During the SSH procedure, make sure you lot are in the same directory where your pem file resides. First thing, you need to be a super user.

[ec2-user@ip-xxx-xx-20-xxxx ~]$ sudo su        

Also, you need to make sure everything is up to date on the server.

[ec2-user@ip-30-xx-xx-xxxx ~]$ yum update        

Past default, the EC2 instance does not have Java installed. You can bank check it using the command in the EC2 panel.

[ec2-user@ip-thirty-20-20-xxxx ~]$ java -version        

Now, create a sub-directory named jvm inside /usr/lib/jvm. You lot can access this folder by accessing the basic file system using cd .. ii times.

[ec2-user@ip-xxx-xx-xx-xxxx /]$ cd ..  [ec2-user@ip-xxx-20-xx-xxxx /]$ cd ..        

Yous need to alter the file permission of the jvm folder. Become to your /usr/lib/ directory and type in the following control.

[ec2-user@ip-thirty-xx-xx-xxxx lib]$ chmod u=rwx,chiliad=rwx,o=rwx jvm        

Now, y'all need to upload the jdk file to this jvm binder from your machine. Get out from the EC2 concluding and copy the downloaded jdk file to your instance using the following control.

> sudo scp -i mypemfile.pem jdk-16.0.2_linux-x64_bin.tar.gz ec2-user@10.xx.thirty.xxx:/usr/lib/jvm/        

Depending upon y'all internet speed, information technology will take up to a few minutes. Now you tin can connect back to your instance and navigate to your jvm folder. Unzip the tar file using the following command. Hit Enter.

[ec2-user@ip-30-twenty-20-xxxx jvm]$ tar zxvf jdk-xvi.0.2_linux-x64_bin.tar.gz        

Now, y'all demand to add the environmental variables so that the linux installation knows where our coffee resides. Equally a super user (sudo su), you demand to modify the environment file in the /etc/ folder.

[ec2-user@ip-thirty-xx-twenty-xxxx jvm]$ sudo su  [ec2-user@ip-30-xx-xx-xxxx jvm]$ nano /etc/environment        

On the Nano editor, add the following path.

PATH= "/usr/lib/jvm/jdk-jdk-16.0.ii/bin" JAVA_HOME= "/usr/lib/jvm/jdk-jdk-16.0.ii"        

Save the changes using, ctrl-10 and press yes and hit enter.

Now, you need to update the system about the java information (java) and java compile (javac)

[ec2-user@ip-thirty-20-xx-xxxx jvm]$ update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk-16.0.2/bin/java" 0  [ec2-user@ip-xxx-xx-twenty-xxxx jvm]$ update-alternatives --install "/usr/bin/coffee" "java" "/usr/lib/jvm/jdk-sixteen.0.2/bin/javac" 0        

Now, you can check the Java version on your server. Smash 😎, yous now have Coffee installed on your AWS Instance 🔥

Source: https://www.linkedin.com/pulse/how-install-java-your-amazon-ec2-instance-manzeel-uprety-1e

Posted by: allmanwhispectilly.blogspot.com

0 Response to "How To Install Java In Ec2"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel