CentOS7 jdk安装

上传jdk-8u231-linux-x64.tar.gz到/opt目录
cd /opt
tar -xvf jdk-8u231-linux-x64.tar.gz -C /opt

cat >> /etc/profile <<"EOF"
AVA_HOME=/opt/jdk1.8.0_231
CLASSPATH=.:$JAVA_HOME/lib.tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH
EOF

在/etc/init.d/functionsPATH后面追加JDK路径,如:
sed -i 's$PATH="/sbin:/usr/sbin:/bin:/usr/bin"$PATH="/sbin:/usr/sbin:/bin:/usr/bin:/opt/jdk1.8.0_231/bin"$g'

source /etc/profile
java -version



---
配置JCE加密算法强度不受限授权
cd ~/
mkdir tmp
cd tmp
wget -v --header "Cookie: oraclelicense=accept-securebackup-cookie" https://edelivery.oracle.com/otn-pub/java/jce/8/jce_policy-8.zip -O jce_policy-8.zip
unzip jce_policy-8.zip
cd UnlimitedJCEPolicyJDK8/
mkdir original
mv /opt/jdk1.8.0_231/jre/lib/security/local_policy.jar original
mv /opt/jdk1.8.0_231/jre/lib/security/US_export_policy.jar original
cp local_policy.jar US_export_policy.jar /opt/jdk1.8.0_231/jre/lib/security/
ls -lrt /opt/jdk1.8.0_231/jre/lib/security/
最终确认local_policy.jar、US_export_policy.jar替换成功

rm -rf ~/tmp


---
在某些操作系统如CentOS 7,JDK第一次生成随机数会非常慢,参考:
https://docs.oracle.com/cd/E13209_01/wlcp/wlss30/configwlss/jvmrand.html
我们需要将修改$JAVA_HOME/jre/lib/security/java.security文件

sed -i 's$securerandom.source=file:/dev/random$securerandom.source=file:/dev/urandom$g' $JAVA_HOME/jre/lib/security/java.security

  

posted @ 2020-08-05 15:38  肖哥哥  阅读(229)  评论(0编辑  收藏  举报
生命不息  奋斗不止  每天进步一点点