腾讯云服务器安装Java环境问题:

系统:Ubuntu Server 18.04.1 LTS 64位 安装:Maven、Java环境时抛错: E: Unable to locate package upgrade

解决办法: 对于Ubuntu操作系统,很多同学在使用apt-get install的时候 会发现很多源都找不到,原因是系统初始的资源库找不到指定的包,解决方法:

1、执行下面的命令,编辑系统资源库列表:

vi /etc/apt/sources.list

2、修改为以下内容(原来的内容可以注释一下):

deb mirrors.aliyun.com/ubun bionic main restricted universe multiverse deb-src mirrors.aliyun.com/ubun bionic main restricted universe multiverse deb mirrors.aliyun.com/ubun bionic-security main restricted universe multiverse deb-src mirrors.aliyun.com/ubun bionic-security main restricted universe multiverse deb mirrors.aliyun.com/ubun bionic-updates main restricted universe multiverse deb-src mirrors.aliyun.com/ubun bionic-updates main restricted universe multiverse deb mirrors.aliyun.com/ubun bionic-backports main restricted universe multiverse deb-src mirrors.aliyun.com/ubun bionic-backports main restricted universe multiverse deb mirrors.aliyun.com/ubun bionic-proposed main restricted universe multiverse deb-src mirrors.aliyun.com/ubun bionic-proposed main restricted universe multiverse

3、执行下面的命令,更新系统资源库列表:

sudo apt-get update

sudo apt-get upgrade

4、重新执行sudo apt-get install xxxx 试试

安装openjdk

1、更新软件包列表: sudo apt-get update

2、安装openjdk-8-jdk: sudo apt-get install openjdk-8-jdk

3、查看java版本,看看是否安装成功: java -version


v2-021ab737aea4d2faedb2f1e58559d100_b.png

你可能感兴趣的:(腾讯云服务器安装Java环境问题:)