ubuntu系统默认源更改为阿里源

3 篇文章 0 订阅
2 篇文章 0 订阅

ubuntu默认使用的国外的源,在更新的时候会很慢,可以使用国内的阿里的源,速度很快。

依次执行如下命令,

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak #备份
sudo vim /etc/apt/sources.list #修改
sudo apt-get update #更新列表

阿里的源,如下,

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

接着执行,如下,

apt-get update

可以看到如下更新过程的详细内容,

Get:71 http://mirrors.aliyun.com trusty-backports/multiverse Translation-en [1,215 B]
Get:72 http://mirrors.aliyun.com trusty-backports/restricted Translation-en [28 B]
Get:73 http://mirrors.aliyun.com trusty-backports/universe Translation-en [36.8 kB]
Get:74 http://mirrors.aliyun.com trusty Release [58.5 kB]                      
Get:75 http://mirrors.aliyun.com trusty/main Sources [1,064 kB]                
Get:76 http://mirrors.aliyun.com trusty/restricted Sources [5,433 B]           
Get:77 http://mirrors.aliyun.com trusty/universe Sources [6,399 kB]            
Get:78 http://mirrors.aliyun.com trusty/multiverse Sources [174 kB]            
Get:79 http://mirrors.aliyun.com trusty/main amd64 Packages [1,350 kB]         
Get:80 http://mirrors.aliyun.com trusty/restricted amd64 Packages [13.0 kB]    
Get:81 http://mirrors.aliyun.com trusty/universe amd64 Packages [5,859 kB]     
Get:82 http://mirrors.aliyun.com trusty/multiverse amd64 Packages [132 kB]     
Get:83 http://mirrors.aliyun.com trusty/main i386 Packages [1,348 kB]          
Get:84 http://mirrors.aliyun.com trusty/restricted i386 Packages [13.4 kB]     
Get:85 http://mirrors.aliyun.com trusty/universe i386 Packages [5,866 kB]      
Get:86 http://mirrors.aliyun.com trusty/multiverse i386 Packages [134 kB]      
Get:87 http://mirrors.aliyun.com trusty/main Translation-en [762 kB]           
Get:88 http://mirrors.aliyun.com trusty/multiverse Translation-en [102 kB]     
Get:89 http://mirrors.aliyun.com trusty/restricted Translation-en [3,457 B]    
Get:90 http://mirrors.aliyun.com trusty/universe Translation-en [4,089 kB]     
Ign http://mirrors.aliyun.com trusty/main Translation-en_US                    
Ign http://mirrors.aliyun.com trusty/multiverse Translation-en_US              
Ign http://mirrors.aliyun.com trusty/restricted Translation-en_US              
Ign http://mirrors.aliyun.com trusty/universe Translation-en_US   

说明已经使用阿里源在进行更新了。

要将Ubuntu 20.04的软件替换为阿里,你可以按照以下步骤进行操作: 1. 首先备份原始的软件列表文件,以防万一需要恢复: ``` sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup ``` 2. 使用文本编辑器(如nano或vim)打开软件列表文件: ``` sudo nano /etc/apt/sources.list ``` 3. 将所有内容替换为阿里的软件配置。你可以在阿里云官方网站上找到适用于Ubuntu 20.04的配置,例如: ``` deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb 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 main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse ``` 4. 保存改并关闭文件。 5. 新软件包列表: ``` sudo apt update ``` 现在,你的Ubuntu 20.04系统将使用阿里作为默认的软件。请注意,这只是将软件替换为阿里的方法之一,也可以使用其他镜像进行替换。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值