代码改变世界

Learning Experience of Big Data: Connect CentOs to Xshell and set Java environment on CentOS

2018-07-12 18:04  ovols  阅读(183)  评论(0编辑  收藏  举报

  1.set up connections between vitural machine and Xshell:

  After we connect the virtural machine to network,we can used an application named "Xshell" to operate the machine instead of the inconvenient way to operate it.Definitely,we should connect our machine to Xshell in order to operate it .

  After we press the option called "new",a view will be shown like this:

  We choose the ssh protocol and insert our ip in the host blank.You will be asked to choose accept for this time or accept and save.Definitely we choose accept and save if we don't want to enter our password over and over again.

Then you'll be asked to enter username and password to enter CentOS you have just installed.(Don't forget to press remember if you don't want to enter again)

Only if you are into the interface which is same as the following pictures are you succees.

2.set Java runtime environment:

  It can be seen that Java runs based on JDK,so if we want to set environment,we must download JDK to our machine.As you can see--I have already downloaded it to my machine(Remember to download the file which is prepared for Linux---whose Suffix name is .tar.gz).

  Then I insert the instruction to decompression it:

  As you can see,I succeed to decompression it.And then it will be setting Java environment variable.First,we should use vi editor to open a file named profile,which is under the folder named etc:

  The you should insert three settings into the file:JAVA_HOME,PATH, and CLASSPATH.JAVA_PATH is the location of your jdk ,PATH and CLASSPATH are based on your JAVA_PATH,so be careful with your JAVA_PATH:

And then save it with the instuction :wq .After that,we should insert a instruction to make sense of this file:

 

Then we will insert the instruction to test if the Java runtime environment is setted success:

It shows that the java version which I use is "1.8.0_161",which means that I have succeed in setting the environment.