xshell连接kali Linux虚拟机安装jdk8

一、xshell连接kali Linux虚拟机

root@kali:~# vi /etc/ssh/sshd_config
添加三行
image.png

root@kali:~# /etc/init.d/ssh start
root@kali:~# /etc/init.d/ssh status
root@kali:~# ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
root@kali:~# ssh-keygen -t dsa -f /etc/ssh/ssh_host_rsa_key
一直确定,设置密码为空
重启ssh
root@kali:~# /etc/init.d/ssh start
root@kali:~# /etc/init.d/ssh status

xshell连接kali linux成功。

二、安装jdk8

root@kali:/opt/java/# tar -zxvf jdk-8u181-linux-x64.tar.gz 
root@kali:/opt/java/jdk1.8.0_181# echo export JAVA_HOME=/opt/java/jdk1.8.0_181 >> /etc/profile
root@kali:/opt/java/jdk1.8.0_181# echo export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar >> /etc/profile
root@kali:/opt/java/jdk1.8.0_181# echo export PATH=$PATH:${JAVA_HOME}/bin >> /etc/profile
root@kali:/opt/java/jdk1.8.0_181# source /etc/profile
root@kali:/opt/java/jdk1.8.0_181# java -version
openjdk version "11.0.3" 2019-04-16
OpenJDK Runtime Environment (build 11.0.3+1-Debian-1)
OpenJDK 64-Bit Server VM (build 11.0.3+1-Debian-1, mixed mode, sharing)
root@kali:/opt/java/jdk1.8.0_181# update-alternatives  --config  java
有 2 个候选项可用于替换 java (提供 /usr/bin/java)。

  选择       路径                                          优先级  状态
------------------------------------------------------------
* 0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      自动模式
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      手动模式
  2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      手动模式

要维持当前值[*]请按<回车键>,或者键入选择的编号:2
update-alternatives: 使用 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 来在手动模式中提供 /usr/bin/java (java)
root@kali:/opt/java/jdk1.8.0_181# java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-8u212-b01-1-b01)
OpenJDK 64-Bit Server VM (build 25.212-b01, mixed mode)