12.04ubuntu换国内源
时间: 2024-09-02 20:04:30 浏览: 94
在Ubuntu 12.04版本中更换为国内的软件源主要是为了提高软件包的下载速度和稳定性。国内有很多镜像源,比如阿里云、华为云、中科大等,这里以更换为阿里云为例进行介绍。
首先,打开终端,备份系统原始的软件源列表:
```bash
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
```
然后,编辑软件源列表文件:
```bash
sudo gedit /etc/apt/sources.list
```
将文件中的内容清空,然后添加以下阿里云的源地址(以Ubuntu 12.04 32位系统为例):
```
deb http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse
```
注意:请根据你的系统版本(32位或62位)、Ubuntu的版本(如12.04称为precise)以及你需要的源(main、restricted、universe、multiverse)进行选择。
编辑完成后保存并关闭文件,然后更新软件包列表:
```bash
sudo apt-get update
```
升级所有软件包:
```bash
sudo apt-get upgrade
```
阅读全文