ubuntu 修改资源镜像

要修改的文件 /etc/apt/sources.list

原资源镜像文件

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

一个个改太麻烦,用脚本方便点

163

Codename=$( (lsb_release -a)|awk '{print $2}'|tail -n 1 )
echo "\
deb http://mirrors.163.com/ubuntu/ $Codename main multiverse restricted universe
deb http://mirrors.163.com/ubuntu/ $Codename-backports main multiverse restricted universe
deb http://mirrors.163.com/ubuntu/ $Codename-proposed main multiverse restricted universe
deb http://mirrors.163.com/ubuntu/ $Codename-security main multiverse restricted universe
deb http://mirrors.163.com/ubuntu/ $Codename-updates main multiverse restricted universe
deb-src http://mirrors.163.com/ubuntu/ $Codename main multiverse restricted universe
deb-src http://mirrors.163.com/ubuntu/ $Codename-backports main multiverse restricted universe
deb-src http://mirrors.163.com/ubuntu/ $Codename-proposed main multiverse restricted universe
deb-src http://mirrors.163.com/ubuntu/ $Codename-security main multiverse restricted universe
deb-src http://mirrors.163.com/ubuntu/ $Codename-updates main multiverse restricted universe ">sources.list

ali yun

Codename=$( (lsb_release -a)|awk '{print $2}'|tail -n 1 )
echo "\
deb http://mirrors.aliyun.com/ubuntu/ $Codename main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ $Codename-backports main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ $Codename-proposed main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ $Codename-security main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ $Codename-updates main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ $Codename main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-backports main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-proposed main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-security main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-updates main multiverse restricted universe ">sources.list

类似把 mirrors.aliyun.com 改成mirrors.163.com mirrors.utsc.cn 就可以

=============

(我是深圳,所以弄的比较近的,更多的源,大家可以到官网查下)

Ubuntu 默认的源地址 http://archive.ubuntu.com/http://mirrors.ustc.edu.cn 即可。

http://people.canonical.com/~cjwatson/mirror/list.html

https://launchpad.net/ubuntu/+cdmirrors

http://mirrors.163.com/.help/ubuntu.html

https://lug.ustc.edu.cn/wiki/mirrors/help/ubuntu

sudo vim /etc/apt/source.list

 

#alibaba

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

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

 
#中山大学
deb http://mirror.sysu.edu.cn/ubuntu/ trusty main restricted universe multiverse
deb http://mirror.sysu.edu.cn/ubuntu/ trusty-backports restricted universe multiverse
deb http://mirror.sysu.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirror.sysu.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirror.sysu.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirror.sysu.edu.cn/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirror.sysu.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirror.sysu.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirror.sysu.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirror.sysu.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse

 
 

#中国科学技术大学
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial main main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
 
# 预发布软件源,不建议启用
# deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse





记得之后

# 更新软件源
sudo apt-get update
# 更新软件
sudo apt-get upgrade 

也可以指定更新 sudo apt-get upgrade golang



树莓派 参考 http://www.cnblogs.com/scotth/p/4397267.html


posted @ 2017-03-10 22:35  scott_h  阅读(2311)  评论(0编辑  收藏  举报