具体方法如下:
Ubuntu系统中,软件源文件地址为:/etc/apt/sources.list
1.备份原来的源,将以前的源备份一下,以防以后可以用的。
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
老板原地址
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | #deb cdrom:[Ubuntu 20.04.4 LTS _Focal Fossa_ - Release amd64 (20220223)]/ focal main restricted # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http: //cn.archive.ubuntu.com/ubuntu/ focal main restricted # deb-src http://cn.archive.ubuntu.com/ubuntu/ focal main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http: //cn.archive.ubuntu.com/ubuntu/ focal-updates main restricted # deb-src http://cn.archive.ubuntu.com/ubuntu/ focal-updates main restricted ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. deb http: //cn.archive.ubuntu.com/ubuntu/ focal universe # deb-src http://cn.archive.ubuntu.com/ubuntu/ focal universe deb http: //cn.archive.ubuntu.com/ubuntu/ focal-updates universe # deb-src http://cn.archive.ubuntu.com/ubuntu/ focal-updates universe ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. deb http: //cn.archive.ubuntu.com/ubuntu/ focal multiverse # deb-src http://cn.archive.ubuntu.com/ubuntu/ focal multiverse deb http: //cn.archive.ubuntu.com/ubuntu/ focal-updates multiverse # deb-src http://cn.archive.ubuntu.com/ubuntu/ focal-updates multiverse ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. deb http: //cn.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse # deb-src http://cn.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse ## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. ## This software is not part of Ubuntu, but is offered by Canonical and the ## respective vendors as a service to Ubuntu users. # deb http://archive.canonical.com/ubuntu focal partner # deb-src http://archive.canonical.com/ubuntu focal partner deb http: //security.ubuntu.com/ubuntu focal-security main restricted # deb-src http://security.ubuntu.com/ubuntu focal-security main restricted deb http: //security.ubuntu.com/ubuntu focal-security universe # deb-src http://security.ubuntu.com/ubuntu focal-security universe deb http: //security.ubuntu.com/ubuntu focal-security multiverse # deb-src http://security.ubuntu.com/ubuntu focal-security multiverse # This system was installed using small removable media # (e.g. netinst, live or single CD). The matching "deb cdrom" # entries were disabled at the end of the installation process. # For information about how to configure apt package sources, # see the sources.list(5) manual. |
2.打开/etc/apt/sources.list文件,在前面添加如下条目,并保存。
sudo gedit /etc/apt/sources.list
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #添加阿里源 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 #添加清华源 deb https: //mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse deb https: //mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse deb https: //mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse deb https: //mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse multiverse |
3.更新
更新源
1 | sudo apt- get update |
如出现依赖问题,解决方式如下:
1 | sudo apt- get -f install |
更新软件:
1 2 3 4 5 | sudo apt- get update sudo apt- get upgrade sudo apt- get install build-essential |
没有认证
1 | sudo apt - key adv - - keyserver hkp: / / keyserver.ubuntu.com: 80 - - recv 76F1A20FF987672F (报错的秘钥名字) |
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek “源神”启动!「GitHub 热点速览」
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· 2 本地部署DeepSeek模型构建本地知识库+联网搜索详细步骤