【Debain-sources.list】更新Debain系统镜像源
一、问题
在Debain系统中,使用apt-get install 命令的时候,会提示:E: Unable to locate package xxx
而不能正确安装软件。
问题出在,系统自带的镜像源是国外镜像源,apt进行更新的时候访问不到就会报错。
解决:使用国内镜像源。
二、更新镜像源
1、备份原镜像源文件
mv /etc/apt/sources.list /etc/apt/sources.list.bak
2、添加国内镜像源
echo "deb http://mirrors.163.com/debian stretch main" >> /etc/apt/sources.list
echo "deb http://security.debian.org/debian-security stretch/updates main" >> /etc/apt/sources.list
echo "deb http://mirrors.163.com/debian stretch-updates main" >> /etc/apt/sources.list
3、apt更新以及安装
3.1 apt 更新
apt-get update -y
3.2 apt 安装
apt-get install lsof
apt-get install -y vim
安装vim可能出现如下问题:
# 依赖库版本过低导致
Depends: libtinfo5 (>= 6) but it is not going to be installed
解决:
apt update && apt install -y libtinfo5 --allow-remove-essential
apt-get -y install vim