1:创建用户
useradd testuser
添加用户密码
passwd 123456user
重复输入一次
2:切换到用户目录下
cd /home/testuser
3:安装jdk
拷入jdk包
解压
tar -zxvf jdk-8u201-linux-x64.tar.gz
4:配置Java环境变量
vi .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
JAVA_HOME=/home/nctest/jdk1.8.0_201
CLASSPATH=.:$JAVA_HOME/bin/tools.jar
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$JAVA_HOME/bin
export PATH JAVA_HOME CLASSPATH
重启下配置文件
source .bash_profile