百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 编程网 > 正文

apt install 安装软件常见的问题 apt install -d

yuyutoo 2024-10-20 13:12 3 浏览 0 评论

一 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

相关推荐

微软Win10/Win11版Copilot上线:支持OpenAI o3推理模型

IT之家4月3日消息,科技媒体WindowsLatest昨日(4月2日)发布博文,报道称Windows10、Windows11新版Copilot应用已摘掉Beta帽...

WinForm 双屏幕应用开发:原理、实现与优化

在当今的软件开发领域,多屏幕显示技术的应用越来越广泛。对于WinForm应用程序来说,能够支持双屏幕显示不仅可以提升用户体验,还能满足一些特定场景下的业务需求,比如在演示、监控或者多任务处理等场景...

推荐一个使用 C# 开发的 Windows10 磁贴美化小工具

...

OpenJDK 8 安装(openjdk 8 windows)

通常OpenJDK8和11都能互相编译和通用。我们建议使用11,但是如果你使用JDK8的话也是没有问题的。建议配置使用OpenJDK,不建议使用OracleJDK,主要是因为版...

基于 Linux 快速部署 OpenConnect VPN 服务(ocserv 实战指南)

一、前言在如今远程办公和内网穿透需求日益增长的背景下,搭建一套安全、稳定、高效的VPN系统显得尤为重要。OpenConnectServer(ocserv)是一个开源、高性能的VPN服务端软件...

巧妙设置让Edge浏览器更好用(edge怎么设置好用)

虽然现在新版本的Edge浏览器已经推出,但是毕竟还处于测试的状态中。而Win10系统里面自带的老版Edge浏览器,却越来越不被人重视。其实我们只需要根据实际情况对老版本的Edge浏览器进行一些简单的设...

WPF做一个漂亮的登录界面(wpf页面设计)

...

微软开源博客工具Open Live Writer更新:多项Bug修复

OpenLiveWriter前身是WindowsLiveWriter,是微软WindowsLive系列软件之一,曾经是博主们非常喜爱的一款所见即所得博文编辑工具,支持离线保存,还支持图像编辑...

基于OpenVINO的在线设计和虚拟试穿 | OPENAIGC大赛企业组优秀作品

在第二届拯救者杯OPENAIGC开发者大赛中,涌现出一批技术突出、创意卓越的作品。为了让这些优秀项目被更多人看到,我们特意开设了优秀作品报道专栏,旨在展示其独特之处和开发者的精彩故事。...

C#开源免费的Windows右键菜单管理工具

...

Windows10或11中隐藏的功能,用它再也不用担心电脑中病毒!

...

Python open函数详解(python open函数源码)

演示环境,操作系统:Win1021H2(64bit);Python解释器:3.8.10。open是Python的一个内置函数,一般用于本地文件的读写操作。用法如下。my_file=open(fi...

Windows 11 安装 Docker Desktop(Windows 11 安装助手 Windows 易升 关系)

...

Windows 11 新版发布:屏幕亮度自适应控制,小组件界面重新设计!

...

世界上最好用的Linux发行版之一,OpenSUSE安装及简单体验

背景之前无意在论坛里看到openSUSE的Linux发行版,被称为世界上最好用的Linux发行版之一(阔怕),一直想体验一下,于是这期做一个安装和简单体验教程吧。...

取消回复欢迎 发表评论: