Ubuntu ARM更改国内源解决Some index files failed to download They have been ignored or old ones used instead

树莓派上安装了docker,拉取了Ubuntu的镜像,换源之后,执行了 "sudo apt-get update"却报了错误。

在这里插入图片描述

起初还不明白为什么,最后才知道了原来树莓派使用了ARM架构的处理器,而网上绝大多数换源资料都是关于x86和x86_64的。要为采用ARM系列处理器的设备换源得用到Ubuntu-ports库。

国内的很多镜像网站,都只有ubuntu源的设置说明,没有ubuntu-ports的设置说明。只有中科大,华为云有说明。

为Ubuntu16.04 for ARM设置中科大源

/etc/apt/sources.list 文件中,将软件源的地址改为 http://mirrors.ustc.edu.cn/ubuntu-ports

以下是 Ubuntu 16.04 /etc/apt/sources.list 文件的参考配置内容:

# 默认注释了源码仓库,如有需要可自行取消注释
deb https://mirrors.ustc.edu.cn/ubuntu-ports/ xenial main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ xenial main main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-proposed main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-proposed main restricted universe multiverse
更改完 sources.list 文件后请运行 sudo apt-get update 更新索引以生效。

为Ubuntu18.04 for ARM设置中科大源

deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic universe
 
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-updates universe
 
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic multiverse
 
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-updates multiverse
 
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse
 
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-security main restricted
 
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-security universe
 
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-security multiverse

华为云支持的Ubuntu for ARM的所有型号

英文代号 版本号
eoan 19.10
disco 19.04
cosmic 18.10
bionic 18.04
xenial 16.04
trusty 14.04
precise 12.04

以Ubuntu18.04为例,换源为华为云

1.备份配置文件:
cp -a /etc/apt/sources.list /etc/apt/sources.list.bak
2.选择相应list文件: 
bionic
cosmic
disco
eoan
precise
trusty
xenial
之后执行如下命令:
wget -O /etc/apt/sources.list https://mirrors.huaweicloud.com/repository/conf/Ubuntu-Ports-bionic.list
3、执行apt-get update更新索引

你可能感兴趣的:(Ubuntu ARM更改国内源解决Some index files failed to download They have been ignored or old ones used instead)