m1芯片的macbook ubuntu apt换源失败的解决方法
2021/12/12 7:18:24
本文主要是介绍m1芯片的macbook ubuntu apt换源失败的解决方法,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
先上结论
m1芯片的mac应使用以下源(适用20.04版本):
deb http://mirrors.aliyun.com/ubuntu-ports/ focal main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu-ports/ focal-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu-ports/ focal-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu-ports/ focal-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu-ports/ focal-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal-backports main restricted universe multiverse
再讲原因
因为架构的原因,在x86和arm下ubuntu所使用的源是不同的,两者无法混用
在Intel或Amd处理器下,通过Docker安装的ubuntu自带的源为
deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
而在m1芯片下则为
deb http://ports.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
区别就在于前面的archive和ports
以阿里云的镜像源为例,在阿里云镜像的官方网站上为ubuntu 20.04提供的源为
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
不难看出,只需将域名后的ubuntu改为ubuntu-ports即可。
此外,再提供一个可以直接在命令行中使用的换源命令
cd /etc/apt && mv sources.list sources.list.bk && echo -e " deb http://mirrors.aliyun.com/ubuntu-ports/ focal main restricted universe multiverse\n deb http://mirrors.aliyun.com/ubuntu-ports/ focal-security main restricted universe multiverse\n deb http://mirrors.aliyun.com/ubuntu-ports/ focal-updates main restricted universe multiverse\n deb http://mirrors.aliyun.com/ubuntu-ports/ focal-proposed main restricted universe multiverse\n deb http://mirrors.aliyun.com/ubuntu-ports/ focal-backports main restricted universe multiverse\n deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal main restricted universe multiverse\n deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal-security main restricted universe multiverse\n deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal-updates main restricted universe multiverse\n deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal-proposed main restricted universe multiverse\n deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal-backports main restricted universe multiverse" > sources.list
这篇关于m1芯片的macbook ubuntu apt换源失败的解决方法的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-23增量更新怎么做?-icode9专业技术文章分享
- 2024-11-23压缩包加密方案有哪些?-icode9专业技术文章分享
- 2024-11-23用shell怎么写一个开机时自动同步远程仓库的代码?-icode9专业技术文章分享
- 2024-11-23webman可以同步自己的仓库吗?-icode9专业技术文章分享
- 2024-11-23在 Webman 中怎么判断是否有某命令进程正在运行?-icode9专业技术文章分享
- 2024-11-23如何重置new Swiper?-icode9专业技术文章分享
- 2024-11-23oss直传有什么好处?-icode9专业技术文章分享
- 2024-11-23如何将oss直传封装成一个组件在其他页面调用时都可以使用?-icode9专业技术文章分享
- 2024-11-23怎么使用laravel 11在代码里获取路由列表?-icode9专业技术文章分享
- 2024-11-22怎么实现ansible playbook 备份代码中命名包含时间戳功能?-icode9专业技术文章分享