资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

如何更换Ubuntu软件源

本文小编为大家详细介绍“如何更换Ubuntu软件源”,内容详细,步骤清晰,细节处理妥当,希望这篇“如何更换Ubuntu软件源”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。

成都创新互联专注为客户提供全方位的互联网综合服务,包含不限于成都网站设计、做网站、新罗网络推广、重庆小程序开发、新罗网络营销、新罗企业策划、新罗品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;成都创新互联为所有大学生创业者提供新罗建站搭建服务,24小时服务热线:13518219792,官方网址:www.cdcxhl.com

什么是Ubuntu的软件源?

我们在使用Debian或者Ubuntu的apt-get工具来安装需要的软件时,其实就是从服务器获取需要安装的软件并把它安装在本地计算机的过程。所谓的软件源,就是我们获取软件的来源,它是定义在/etc/apt/sources.list文件里的。

默认的sources.list文件内容如下:

## deb cdrom:[Ubuntu-Server 16.04.2 LTS _Xenial Xerus_ - Release amd64 (20170215.8)]/ xenial main restricted#deb cdrom:[Ubuntu-Server 16.04.2 LTS _Xenial Xerus_ - Release amd64 (20170215.8)]/ xenial main restricted# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to# newer versions of the distribution.deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted## Major bug fix updates produced after the final release of the## distribution.deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu## team. Also, please note that software in universe WILL NOT receive any## review or updates from the Ubuntu security team.deb http://us.archive.ubuntu.com/ubuntu/ xenial universe# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial universedeb http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu## team, and may not be under a free licence. Please satisfy yourself as to## your rights to use the software. Also, please note that software in## multiverse WILL NOT receive any review or updates from the Ubuntu## security team.deb http://us.archive.ubuntu.com/ubuntu/ xenial multiverse# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial multiversedeb http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse## N.B. software from this repository may not have been tested as## extensively as that contained in the main release, although it includes## newer versions of some applications which may provide useful features.## Also, please note that software in backports WILL NOT receive any review## or updates from the Ubuntu security team.deb http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse## Uncomment the following two lines to add software from Canonical's## 'partner' repository.## This software is not part of Ubuntu, but is offered by Canonical and the## respective vendors as a service to Ubuntu users.# deb http://archive.canonical.com/ubuntu xenial partner# deb-src http://archive.canonical.com/ubuntu xenial partnerdeb http://security.ubuntu.com/ubuntu xenial-security main restricted# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricteddeb http://security.ubuntu.com/ubuntu xenial-security universe# deb-src http://security.ubuntu.com/ubuntu xenial-security universedeb http://security.ubuntu.com/ubuntu xenial-security multiverse# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse

可以看到,官方的默认源是来自美国的us.archive.ubuntu.com和security.ubuntu.com。那么我们怎么样换成速度更快的国内源呢?很简单,把/etc/apt/sources.list文件复制备份一下,然后把原来的内容修改成国内源的网址即可。以下步骤说明以阿里云的源为例:

1. 复制备份原来的配置文件

sudo cp /etc/apt/sources.list sources.list.bak

2.使用你喜欢的文本编辑器如vi/vim/nano,打开sources.list文件,把原来的内容替换成以下内容:

deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse##测试版源deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse# 源码deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse##测试版源deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse# Canonical 合作伙伴和附加deb http://archive.canonical.com/ubuntu/ xenial partnerdeb http://extras.ubuntu.com/ubuntu/ xenial main

3.运行sudo apt-get update命令,更新软件列表,以后就可以使用阿里云提供的快速源了。同样的方法,也可以替换为网易源、搜狐源、中科大源、清华大学源等。

读到这里,这篇“如何更换Ubuntu软件源”文章已经介绍完毕,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注创新互联行业资讯频道。


当前题目:如何更换Ubuntu软件源
分享链接:http://cdkjz.cn/article/jiisss.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220