腾讯云服务器安装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 http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ 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

image
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容