网站首页 > 技术文章 正文
一 Ubuntu apt install 下载软件很慢的解决办法
1.打开/etc/apt/sources.list 将内容替换为以下内容(注意把sources.list文件备份一下)
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
2. 最简单的方法:
打开 sources.list 发现地址都是us.archive.ubuntu.com 这样的地址, 将us替换成cn即可
> # vim /etc/apt/sources.list
打开之后依次输入以下命令:
:%s/us.archive/cn.archive/g
回车
:wq
回车(退出vim)
或者替换为 aliyun
> # vim /etc/apt/sources.list
:%s/us.archive.ubuntu.com/mirrors.aliyun.com/g
快捷命令:
sudo sed -i "s@http://.*archive.ubuntu.com@http://mirrors.aliyun.com@g" /etc/apt/sources.list
sudo sed -i "s@http://.*security.ubuntu.com@http://mirrors.aliyun.com@g" /etc/apt/sources.list
更新软件列表
> # apt-get update
注意: aliyun 目前出现问题, 暂时不要使用(20220609)
二 apt install找不到软件的问题
Ubuntu 配置源列表sources.list
在Ubuntu中使用命令下载软件出现sources.list配置错误的问题, 比如执行命令:
sudo apt-get install git
出现错误:
忽略:1 http://mirrors.aliyun.com/ubuntu disco InRelease
忽略:2 http://mirrors.aliyun.com/ubuntu disco-security InRelease
忽略:3 http://mirrors.aliyun.com/ubuntu disco-updates InRelease
忽略:4 http://mirrors.aliyun.com/ubuntu disco-backports InRelease
忽略:5 http://mirrors.aliyun.com/ubuntu disco-proposed InRelease
错误:6 http://mirrors.aliyun.com/ubuntu disco Release
404 Not Found [IP: 117.91.177.241 80]
错误:7 http://mirrors.aliyun.com/ubuntu disco-security Release
404 Not Found [IP: 117.91.177.241 80]
错误:8 http://mirrors.aliyun.com/ubuntu disco-updates Release
404 Not Found [IP: 117.91.177.241 80]
错误:9 http://mirrors.aliyun.com/ubuntu disco-backports Release
404 Not Found [IP: 117.91.177.241 80]
错误:10 http://mirrors.aliyun.com/ubuntu disco-proposed Release
404 Not Found [IP: 117.91.177.241 80]
正在读取软件包列表... 完成
E: 仓库 “http://mirrors.aliyun.com/ubuntu disco Release” 没有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
E: 仓库 “http://mirrors.aliyun.com/ubuntu disco-security Release” 没有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
E: 仓库 “http://mirrors.aliyun.com/ubuntu disco-updates Release” 没有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
E: 仓库 “http://mirrors.aliyun.com/ubuntu disco-backports Release” 没有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
E: 仓库 “http://mirrors.aliyun.com/ubuntu disco-proposed Release” 没有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
解决方法:更新源列表
1.备份原来的源列表
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
2.获取最新的源列表
下载对应版本最新的源列表:https://mirrors.ustc.edu.cn/repogen/, 比如我的ubuntu20.04
deb https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
## Not recommended
# deb https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
3.修改源列表
将上面获取到的源列表复制粘贴到/etc/apt/sources.list。
sudo gedit /etc/apt/sources.list
或者 vim /etc/apt/sources.list
4.更新源列表
sudo apt-get update
5.重新下载
配置完源列表后, 再次重新执行下面的命令即可。
sudo apt-get install git
三 常见的问题: E: Unable to locate package XXX 的解决办法
1.首先尝试update命令
sudo apt-get update
2.如果不行则执行upgrade
sudo apt-get upgrade
上述命令成功以后就能正常使用
sudo apt-get install xxxxx
3.最后上面两项都不行则尝试
sudo apt-get install aptitude
成功以后使用
sudo aptitude install xxxxx
四 为何总是出现 Unable to locate package(无法定位软件包)
> # apt-get install swift swift-proxy python-swiftclient python-keystoneclient python-keystonemiddleware memcached
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package python-swiftclient
E: Unable to locate package python-keystoneclient
E: Unable to locate package python-keystonemiddleware
为何总是出现 "无法定位软件包"
解决方法: 将 python-* 修改为 python3-*
> # apt-get install swift swift-proxy python3-swiftclient python3-keystoneclient python3-keystonemiddleware memcached
五 > # apt-get install neutron-l3-agent
......
W: Failed to fetch ......
W: Some index files failed to download. They have been ignored, or old ones used instead.
解决方法: 添加DNS
> # vim /etc/resolv.conf
nameserver 8.8.8.8
猜你喜欢
- 2024-10-14 Ubuntu19.10系统的软件安装与卸载命令
- 2024-10-14 VMware下安装VMware tools,安装文件没有出现问题的解决
- 2024-10-14 大白话 linux 教程-09-安装和卸载软件包
- 2024-10-14 ubuntu下安装ssh(ubuntu下安装windows10)
- 2024-10-14 蓝易云 - Ubutun开机黑屏解决方法
- 2024-10-14 银河麒麟系统密码忘记了,修改密码和微信安装方法
- 2024-10-14 ubuntu离线apt-get更新源(ubuntu 离线升级)
- 2024-10-14 树莓派安装opencv3.4.0遇到的坑(树莓派安装opencv完整过程)
- 2024-10-14 linux 系统 没有 ifconfig 命令,提示: ifconfig: command not found
- 2024-10-14 go get 命令一直下载不了源站的包解决方案
- 02-21走进git时代, 你该怎么玩?_gits
- 02-21GitHub是什么?它可不仅仅是云中的Git版本控制器
- 02-21Git常用操作总结_git基本用法
- 02-21为什么互联网巨头使用Git而放弃SVN?(含核心命令与原理)
- 02-21Git 高级用法,喜欢就拿去用_git基本用法
- 02-21Git常用命令和Git团队使用规范指南
- 02-21总结几个常用的Git命令的使用方法
- 02-21Git工作原理和常用指令_git原理详解
- 最近发表
- 标签列表
-
- cmd/c (57)
- c++中::是什么意思 (57)
- sqlset (59)
- ps可以打开pdf格式吗 (58)
- phprequire_once (61)
- localstorage.removeitem (74)
- routermode (59)
- vector线程安全吗 (70)
- & (66)
- java (73)
- org.redisson (64)
- log.warn (60)
- cannotinstantiatethetype (62)
- js数组插入 (83)
- resttemplateokhttp (59)
- gormwherein (64)
- linux删除一个文件夹 (65)
- mac安装java (72)
- reader.onload (61)
- outofmemoryerror是什么意思 (64)
- flask文件上传 (63)
- eacces (67)
- 查看mysql是否启动 (70)
- java是值传递还是引用传递 (58)
- 无效的列索引 (74)