系统: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