设置ubantu的软件源地址

查看所用的源

[plain] view plain copy
 
  1. $ sudo vim /etc/apt/sources.list  

由于安装的Ubuntu Server 16.04.1 LTS是英文版的,软件源就默认都是 us.archive.ubuntu.com(英国) 的,所以很慢。

[plain] view plain copy
 
  1. # deb cdrom:[Ubuntu-Server 16.04.1 LTS _Xenial Xerus_ - Release amd64 (20160719)]/ xenial main restricted  
  2.   
  3. #deb cdrom:[Ubuntu-Server 16.04.1 LTS _Xenial Xerus_ - Release amd64 (20160719)]/ xenial main restricted  
  4.   
  5. # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to  
  6. # newer versions of the distribution.  
  7. deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted  
  8. # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted  
  9.   
  10. ## Major bug fix updates produced after the final release of the  
  11. ## distribution.  
  12. deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted  
  13. # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted  
  14.   
  15. ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu  
  16. ## team. Also, please note that software in universe WILL NOT receive any  
  17. ## review or updates from the Ubuntu security team.  
  18. deb http://us.archive.ubuntu.com/ubuntu/ xenial universe  
  19. # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial universe  
  20. deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe  
  21. # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe  
  22.   
  23. ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu  
  24. ## team, and may not be under a free licence. Please satisfy yourself as to  
  25. ## your rights to use the software. Also, please note that software in  
  26. ## multiverse WILL NOT receive any review or updates from the Ubuntu  
  27. ## security team.  
  28. deb http://us.archive.ubuntu.com/ubuntu/ xenial multiverse  
  29. # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial multiverse  
  30. deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse  
  31. # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse  
  32.   
  33. ## N.B. software from this repository may not have been tested as  
  34. ## extensively as that contained in the main release, although it includes  
  35. ## newer versions of some applications which may provide useful features.  
  36. ## Also, please note that software in backports WILL NOT receive any review  
  37. ## or updates from the Ubuntu security team.  
  38. deb http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse  
  39. # deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse  
  40.   
  41. ## Uncomment the following two lines to add software from Canonical's  
  42. ## 'partner' repository.  
  43. ## This software is not part of Ubuntu, but is offered by Canonical and the  
  44. ## respective vendors as a service to Ubuntu users.  
  45. # deb http://archive.canonical.com/ubuntu xenial partner  
  46. # deb-src http://archive.canonical.com/ubuntu xenial partner  
  47.   
  48. deb http://security.ubuntu.com/ubuntu xenial-security main restricted  
  49. # deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted  
  50. deb http://security.ubuntu.com/ubuntu xenial-security universe  
  51. # deb-src http://security.ubuntu.com/ubuntu xenial-security universe  
  52. deb http://security.ubuntu.com/ubuntu xenial-security multiverse  
  53. # deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse  

为了提高下载速度,将源改为国内的 cn.archive.ubuntu.com ,现在 cn.archive.ubuntu.com 指向阿里云的开源镜像站 mirrors.aliyun.com,下载速度很快。

1. 重命名原来的源作为备份:

[plain] view plain copy
 
  1. $ sudo mv /etc/apt/sources.list sources.list_backup  


2. 新建一个sources.list文件

[plain] view plain copy
 
  1. $ sudo vim /etc/apt/sources.list  

输入如下内容并保存退出:

[plain] view plain copy
 
  1. deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted  
  2. deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted  
  3. deb http://cn.archive.ubuntu.com/ubuntu/ xenial universe  
  4. deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe  
  5. deb http://cn.archive.ubuntu.com/ubuntu/ xenial multiverse  
  6. deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates multiverse  
  7. deb http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse  
  8. deb http://security.ubuntu.com/ubuntu xenial-security main restricted  
  9. deb http://security.ubuntu.com/ubuntu xenial-security universe  
  10. deb http://security.ubuntu.com/ubuntu xenial-security multiverse  



3. 更新apt软件源:

[plain] view plain copy
 
  1. $ sudo apt-get update  

结束,以后更新下载软件就快多了。

摘自http://blog.csdn.net/a787202867/article/details/53084602

原文地址:https://www.cnblogs.com/leifei/p/8124978.html