三三世界-百宝箱

文章 分类 标签
130 9 247

公告

暂无站点公告

Debian apt源问题,解决Debian系统错误:E: Unable to locate package vim

三三 2022-03-07 3569 0条评论 Linux使用 debiansources

首页 / 正文

错误:E: Unable to locate package vim

平时很少使用Debian,今天使用镜像是基于Debian Linux9的。没有文本编辑命令vim和vi,就想安装个,但是使用apt-get install vim直接给我报了开篇的错误提示。经查,这是因为用的源地址在国外,问题找到了,那解决方向就很明白了,换个能访问的地址就行了。
其实这些都很简单,问题是,网上大量的错误导向,害得我浪费了不少时间。
比如

root@1b4671904bfa:/#  mv /etc/apt/sources.list /etc/apt/sources.list.bak
root@1b4671904bfa:/#  echo "deb http://mirrors.163.com/debian/ jessie main non-free contrib" >/etc/apt/sources.list
root@1b4671904bfa:/#  echo "deb http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list
root@1b4671904bfa:/#  echo "deb-src http://mirrors.163.com/debian/ jessie main non-free contrib" >>/etc/apt/sources.list
root@1b4671904bfa:/#  echo "deb-src http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list

意思很简单,先备份sources.list,然后往里面写自定的内容。
其他我就不一一举例了,大概都这样。

但是我证明,这些真没用。

我们先来看一下,原生的sources.list里都有些啥。

# deb http://snapshot.debian.org/archive/debian/20200130T000000Z stretch main
deb http://deb.debian.org/debian stretch main
# deb http://snapshot.debian.org/archive/debian-security/20200130T000000Z stretch/updates main
deb http://security.debian.org/debian-security stretch/updates main
# deb http://snapshot.debian.org/archive/debian/20200130T000000Z stretch-updates main
deb http://deb.debian.org/debian stretch-updates main

可能去掉注释看得更清楚一点。

deb http://deb.debian.org/debian stretch main
deb http://security.debian.org/debian-security stretch/updates main
deb http://deb.debian.org/debian stretch-updates main

在网上找了一大堆,都没有好使的,看了看人家原生的内容,我就想,直接把我访问了域名替换成国内的源行不行?

执行命令:

nano /etc/apt/sources.list

增加下列行:

deb http://mirrors.163.com/debian stretch main
deb http://security.debian.org/debian-security stretch/updates main
deb http://mirrors.163.com/debian stretch-updates main

修改后,执行下面的命令来试试:

apt-get update -y

没有出现任务404,或W、E的提示。

debian官方镜像列表:

https://www.debian.org/CD/http-ftp/#mirrors

注意,下面如果还有类似的问题,镜像选备选方案也列在表中。

北交大
deb https://mirror.bjtu.edu.cn/debian/ hardy main restricted universe multiverse
deb https://mirror.bjtu.edu.cn/debian/ hardy-backports restricted universe multiverse
deb https://mirror.bjtu.edu.cn/debian/ hardy-proposed main restricted universe multiverse
deb https://mirror.bjtu.edu.cn/debian/ hardy-security main restricted universe multiverse
deb https://mirror.bjtu.edu.cn/debian/ hardy-updates main restricted universe multiverse
deb-src https://mirror.bjtu.edu.cn/debian/ hardy main restricted universe multiverse
deb-src https://mirror.bjtu.edu.cn/debian/ hardy-backports main restricted universe multiverse
deb-src https://mirror.bjtu.edu.cn/debian/ hardy-proposed main restricted universe multiverse
deb-src https://mirror.bjtu.edu.cn/debian/ hardy-security main restricted universe multiverse
deb-src https://mirror.bjtu.edu.cn/debian/ hardy-updates main restricted universe multiverse

中科大
deb https://mirrors.ustc.edu.cn/debian/ hardy main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/debian/ hardy main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/debian/ hardy-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/debian/ hardy-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/debian/ hardy-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/debian/ hardy-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/debian/ hardy-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/debian/ hardy-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/debian/ hardy-proposed main multiverse restricted universe
deb-src https://mirrors.ustc.edu.cn/debian/ hardy-proposed main restricted universe multiverse

台湾大学

deb http://debian.csie.ntu.edu.tw/debian hardy main restricted universe multiverse
deb-src http://debian.csie.ntu.edu.tw/debian hardy main restricted universe multiverse
deb http://debian.csie.ntu.edu.tw/debian hardy-updates main restricted universe multiverse
deb-src http://debian.csie.ntu.edu.tw/debian hardy-updates main restricted universe multiverse
deb http://debian.csie.ntu.edu.tw/debian hardy-backports main restricted universe multiverse
deb-src http://debian.csie.ntu.edu.tw/debian hardy-backports main restricted universe multiverse
deb http://debian.csie.ntu.edu.tw/debian hardy-security main restricted universe multiverse
deb-src http://debian.csie.ntu.edu.tw/debian hardy-security main restricted universe multiverse
deb http://debian.csie.ntu.edu.tw/debian hardy-proposed main multiverse restricted universe
deb-src http://debian.csie.ntu.edu.tw/debian hardy-proposed main restricted universe multiverse

阿里云:debian 10.x (buster)
deb http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb http://mirrors.aliyun.com/debian-security buster/updates main
deb-src http://mirrors.aliyun.com/debian-security buster/updates main
deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib

评论(0)

当前没有评论,还不快来留下第一个脚印吧


Copyright 2021 三三世界-百宝箱. All Rights Reserved.

最新评论

  • 三三

    @Doug Shume it's ok for me , you can post here.

  • refugiaguenther

    Saved as a favorite, I like your website!

  • josefa

    If some one wishes to be updated with hottest technologies after that he must be visit this site and be up to date daily.

  • Penzu

    Heello would you mind sharing which blog platform you're using? I'm planning to start my own blog in the near future but I'm having a tough time making a decision between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your layout seems different then moost blogs and I'm looking for something completely unique. P.S Apologies forr being off-topic butt I had to ask!

  • Yupoo Fendi

    Thanks to my father who shared with me regarding this webpage, this website is genuinely amazing.

  • Doug Shume

    Hi, I have an overflow of customers that I'd like to send to you but I want to make sure you can handle more leads, let me know if you'd like me to send you more info.

  • SuperWind

    zh.us.to 有效
    kms.03k.org 有效
    kms.chinancce.com
    kms.shuax.com 有效
    kms.dwhd.org 有效
    kms.luody.info 有效
    kms.digiboy.ir 有效
    kms.lotro.cc 有效
    www.zgbs.cc 有效
    cy2617.jios.org 有效

  • 三三

    @         权限问题,试试sudo 再加命令。

  •         

    你好提示Permission denied 怎么办啊

日历

2024年05月

   1234
567891011
12131415161718
19202122232425
262728293031 

文章目录

上一张 下一张