Ubunutu安装时,默认没有给apt-get配置国内镜像源,其默认配置的镜像源国内不能访问到,安装软件处处失败,所以我们需要配置国内镜像源:
首先避免出错,我们先备份原sources.list文件,这是一个好习惯。避免出错
cp /etc/apt/sources.list /etc/sources.list.bak
删除sources.list中的原内容,ubuntu16.04添加如下内容,可以使用阿里云的镜像源:
deb http://mirrors.aliyun.com/ubuntu/ xenial main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe
最后使用命令更新源信息:
sudo apt-get update