ubuntu apt换源
时间: 2023-06-30 19:11:26 浏览: 58
在Ubuntu系统中,可以通过以下步骤来更换apt源:
1.备份原始源列表文件:
```
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
```
2.编辑源列表文件:
使用文本编辑器(如nano)打开源列表文件:
```
sudo nano /etc/apt/sources.list
```
3.选择一个新的源地址:
可以在网上搜索适合自己的源地址,比如中科大、阿里云等。
将原来的源地址替换为新的源地址。
4.更新apt:
```
sudo apt-get update
```
5.升级软件:
```
sudo apt-get upgrade
```
执行以上操作后,就可以更换apt源了。
相关问题
ubuntu中apt换源
Ubuntu中可以通过修改`/etc/apt/sources.list`文件来换源。在换源之前,建议先备份原有的源文件,以防出现问题。可以使用以下命令进行备份:
```
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
```
然后可以编辑`/etc/apt/sources.list`文件,将原来的源地址替换为国内的源地址,例如使用阿里云的源可以将以下内容添加到文件中:
```
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
```
保存文件后,运行`sudo apt update`命令即可更新源信息。
ubuntu更换清华源 apt
好的,更换 Ubuntu 的软件源为清华源可以按照以下步骤进行:
1. 备份原有的软件源列表文件:
```
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
```
2. 修改软件源列表文件 `/etc/apt/sources.list`,将其中的内容替换为以下内容:
```
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
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
```
3. 更新软件源列表:
```
sudo apt update
```
4. 完成。