ubuntu源配置文件/etc/apt/sources.list不存在
若使用命令
sudo apt-get update
报错:apt-get:找不到命令,八成是源配置文件/etc/apt/sources.list不存在。但是一般来说不会不存在,若真的不小心删除的话,我们也可以进行恢复。
首先创建/etc/apt/sources.list文件,然后vim编辑内容,原内容可以访问https://developer.aliyun.com/mirror/ubuntu进行查看,如ubuntu16.04的sources.list如下:
deb https://mirrors.aliyun.com/ubuntu/ xenial main
deb-src https://mirrors.aliyun.com/ubuntu/ xenial main
deb https://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src https://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb https://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src https://mirrors.aliyun.com/ubuntu/ xenial universe
deb https://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src https://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb https://mirrors.aliyun.com/ubuntu/ xenial-security main
deb-src https://mirrors.aliyun.com/ubuntu/ xenial-security main
deb https://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src https://mirrors.aliyun.com/ubuntu/ xenial-security universe