ubuntu24.04LTS添加apt源

ubuntu24.04添加apt源的方法和文件位置相对于以前的版本有变化,从原来的/etc/apt/sources.list文件更换到/etc/apt/sources.list.d/ubuntu.sources文件中。

我们先来看看ubuntu24.04 apt源中默认的配置。

cat /etc/apt/sources.list.d/ubuntu.sources | grep -iE -v '^($|#)'
Types: deb
URIs: http://cn.archive.ubuntu.com/ubuntu/
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Types: deb
URIs: http://security.ubuntu.com/ubuntu/
Suites: noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

我们可以看到有两组相似的deb,一般情况我们只需要修改上面那一组。

下面就是常用的国内apt源

1.清华源

Types: deb
URIs: http://mirrors.tuna.tsinghua.edu.cn/ubuntu/
Suites: noble noble-updates noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

2.阿里源

Types: deb
URIs: http://mirrors.aliyun.com/ubuntu/
Suites: noble noble-updates noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

3.网易源

Types: deb
URIs: http://mirrors.163.com/ubuntu/
Suites: noble noble-updates noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

4.中科大源

Types: deb
URIs: http://mirrors.ustc.edu.cn/ubuntu/
Suites: noble noble-updates noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

选上述一种源替换到/etc/apt/sources.list.d/ubuntu.sources文件中上面一块即可,然后更新环境即可

apt update

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://sulao.cn/post/1081

评论列表

0%