1.在root用户下复制/etc/skel到es用户
cp -r /etc/skel /home/es
2.上传安装包
3.解压安装包
tar -zxvf jdk-8u231-linux-i586.tar.gz
4.编辑.bash_profile 文件
vim ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
#PATH=$PATH:$HOME/.local/bin:$HOME/bin
export JAVA_HOME=/home/es/java/jdk1.8.0_231
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
#export PATH
5.source ~/.bash_profile
注:要想让jdk永久生效,切换到root,将4放入/etc/bashrc,执行source /etc/bashrc