标签:java repository -- etc yum openjdk1.8 linux HOME 安装
使用yum查找jdk: yum search java|grep jdk
[root@localhost network-scripts]# yum search java|grep jdk One of the configured repositories failed (Unknown), and yum doesn't have enough cached data to continue. At this point the only safe thing yum can do is fail. There are a few ways to work "fix" this: 1. Contact the upstream for the repository and get them to fix the problem. 2. Reconfigure the baseurl/etc. for the repository, to point to a working upstream. This is most often useful if you are using a newer distribution release than is supported by the repository (and the packages for the previous distribution release still work). 3. Run the command with the repository temporarily disabled yum --disablerepo=<repoid> ... 4. Disable the repository permanently, so yum won't use it by default. Yum will then just ignore the repository until you permanently enable it again or use --enablerepo for temporary usage: yum-config-manager --disable <repoid> or subscription-manager repos --disable=<repoid> 5. Configure the failing repository to be skipped, if it is unavailable. Note that yum will try to contact the repo. when it runs most commands, so will have to try and fail each time (and thus. yum will be be much slower). If it is a very temporary problem though, this is often a nice compromise: yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true Cannot find a valid baseurl for repo: base/7/x86_64
使用yum时遇到上图所示问题,解决办法(修改dns配置):
vi /etc/resolv.conf 在文件/etc/resolv.conf最后写入:nameserver 114.114.114.114(这是国内的dns服务器系统,还是比较好用的。谷歌的可以使用8.8.8.8)
之后再使用yum查找jdk: yum search java|grep jdk
执行安装命令:yum install java-1.8.0-openjdk
如下图 输入y即可:
安装成功后,默认安装路径在/usr/lib/jvm/下边
验证java是否安装成功 查看java版本:java -version
安装开发环境:yum install java-1.8.0-openjdk-devel.x86_64
验证java是否安装成功 执行:javac
设置环境变量
修改/etc/profile文件:vi /etc/profile
# set java env JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64 JRE_HOME=$JAVA_HOME/jre CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin export JAVA_HOME JRE_HOME CLASS_PATH PATH
使环境变量生效执行:source /etc/profile
安装完成!!!
标签:java,repository,--,etc,yum,openjdk1.8,linux,HOME,安装 来源: https://www.cnblogs.com/minutes/p/14867039.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。