更换Ubuntu源为国内源的操作记录
我们都知道,Ubuntu的官方源对于国内用户来说是比较慢的,可以将它的源换成国内的源(比如阿里源),这样用起来就很快了。下面记录下更换操作:
首先了解下/etc/apt/sources.list文件
文件/etc/apt/sources.list是一个普通可编辑的文本文件,保存了ubuntu软件更新的源服务器的地址。
和sources.list功能一样的是/etc/apt/sources.list.d/*.list(*代表一个文件名,只能由字母、数字、下划线、英文句号组成),
该文件夹下的文件是第三方软件的源,可以分别存放不同的第三源地址,只需“扩展名”为list即可。
sources.list.d目录下的*.list文件为在单独文件中写入源的地址提供了一种方式,通常用来安装第三方的软件。 如下是ubuntu官方sources.list文件内容:
deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse 以上内容的具体含义如下:
1)每一行的开头是deb或者deb-src,分别表示直接通过.deb文件进行安装和通过源文件的方式进行安装。
2)deb或者deb-src字段之后,是一段URL,之后是五个用空格隔开的字符串,分别对应相应的目录结构。
在浏览器中输入http://archive.ubuntu.com/ubuntu/,并进入dists目录,可以发现有5个目录和前述sources.list文件中的第三列字段相对应。
任选其中一个目录进入,可以看到和sources.list后四列相对应的目录结构 以上官方的ubuntu源在国内使用,通常都会很慢,以至于在使用过程中报错。
----------------下面是我在线上使用过的一个ubuntu的源---------------------
root@ubuntutest03-KVM:~# cat /etc/apt/sources.list|grep -v "^#"|grep -v "^$"
deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
deb http://cn.archive.ubuntu.com/ubuntu/ xenial universe
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe
deb http://cn.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse --------------下面是替换成阿里源的内容-------------
root@ubuntutest03-KVM:~# cat /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb 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 multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-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 partner
deb http://extras.ubuntu.com/ubuntu/ xenial main root@ubuntutest03-KVM:~# apt-get update 更新源
root@ubuntutest03-KVM:~# apt-get upgrade 更新软件 -------------更换成其他开放的ubuntu源,做法和上面同理----------------
再比如下面更换成网易源(打开文件中的url。进入dists目录下就能看到xenial等对应的目录结构了)
root@ubuntutest03-KVM:~# cat /etc/apt/sources.list
deb http://mirrors.163.com/ubuntu/ xenial main restricted
deb http://mirrors.163.com/ubuntu/ xenial-updates main restricted
deb http://mirrors.163.com/ubuntu/ xenial universe
deb http://mirrors.163.com/ubuntu/ xenial-updates universe
deb http://mirrors.163.com/ubuntu/ xenial multiverse
deb http://mirrors.163.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse root@ubuntutest03-KVM:~# apt-get update 更新源
root@ubuntutest03-KVM:~# apt-get upgrade 更新软件
更换Ubuntu源为国内源的操作记录的更多相关文章
- 转载 - Ubuntu源改国内源 与 批量更改ubuntu机器apt源
change_apt_source.sh # !/bin/bash # 备份原来的源文件 cp /etc/apt/sources.list /etc/apt/sources.list.bak # 获取 ...
- Docker入门之 - 更换源为国内源,实现快速下载image
原文:Docker入门之 - 更换源为国内源,实现快速下载image 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/u012055638/artic ...
- Linux学习 - 02 使用 - Centos8 - 『更换rpm/epel包源为国内源』
1. Centos8 - 『更换rpm/epel包源为国内源』 centos 8 默认是会读取centos.org的mirrorlist的,所以一般来说是不需要配置镜像的. 如果你的网络访问mirro ...
- pip 源 替换国内源
网上收集来的pip源地址: 阿里云 http://mirrors.aliyun.com/pypi/simple/中国科技大学 https://pypi.mirrors.ustc.edu.cn/simp ...
- Ubuntu armhf 版本国内源
Ubuntu armhf 版本国内源: deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial main multiverse restricted u ...
- Ubuntu 18.04修改默认源为国内源
安装Ubuntu 18.04后,使用国外源太慢了,修改为国内源会快很多. 修改阿里源为Ubuntu 18.04默认的源 备份/etc/apt/sources.list 备份 cp /etc/apt/s ...
- Ubuntu 18.04 修改默认源为国内源
1.备份/etc/apt/sources.list #备份 cp /etc/apt/sources.list /etc/apt/sources.list.bak 2.在/etc/apt/sources ...
- Mysql更换MyISAM存储引擎为Innodb的操作记录
一般情况下,mysql会默认提供多种存储引擎,可以通过下面的查看: 1)查看mysql是否安装了innodb插件.通过下面的命令结果可知,已经安装了innodb插件. mysql> show p ...
- debian 9 更换源 使用国内源 配置方法
配置前请先参考: https://wiki.debian.org/SourcesList https://www.debian.org/mirror/list https://mirrors.tuna ...
随机推荐
- 一文读懂遗传算法工作原理(附Python实现)
选自AnalyticsVidhya 参与:晏奇.黄小天 近日,Analyticsvidhya 上发表了一篇题为<Introduction to Genetic Algorithm & t ...
- Windows系统安装nginx及配置
1.下载nginx http://nginx.org/en/download.html 下载稳定版本,以nginx/Windows-1.12.2为例,直接下载 nginx-1.12.2 ...
- jQuery插件slider实现图片轮播
1:引入相应的js文件 jquery.SuperSilder.js 2:HTML: 结构 注:此地加载图片的代码也可以从后台库中读取图片的集合列表,然后通过循环的方式显示出来 3:CSS 样式定义左 ...
- 简单规划dp sumsets
Farmer John commanded his cows to search for different sets of numbers that sum to a given number. T ...
- 2018-2019-2 网络对抗技术 20165318 Exp6 信息搜集与漏洞扫描
2018-2019-2 网络对抗技术 20165318 Exp6 信息搜集与漏洞扫描 原理与实践说明 实践原理 实践内容概述 基础问题回答 实践过程记录 各种搜索技巧的应用 DNS IP注册信息的查询 ...
- 安装LIBXML2
具体安装步骤: 1.解压:$tar zxvf libxml2-2.6.20.tar.gz 2.进入解压后的安装目录:$cd libxml2-2.6.20 3.安装三部曲:1)$./configure ...
- python +百度语音识别+图灵对话
https://github.com/Dongvdong/python_Smartvoice 上电后,只要周围声音超过 2000,开始录音5S 录音上传百度识别,并返回结果文字输出 继续等待,周围声音 ...
- 简单使用metamascara
package.json 配置文件信息 { "name": "test-mascara", "version": "1.0.0&q ...
- python3 day02 大纲
一. 格式化输出 %s 字符串的占位 %d 数字的占位 digit %f 浮点数 字符串 % (数据) 模板字符串(3.5) # username = "admin"# passw ...
- 文件上传之Servlet
导包 commons-fileupload-1.3.1.jar commons-io-2.2.jar import java.io.File; import java.io.FileOutputStr ...