修改ubuntu 18.04的sources.list源为阿里或清华镜像的方法

 更新时间:2020年08月24日 15:19:47   作者:侯祥胡  
这篇文章主要介绍了修改ubuntu 18.04的sources.list源为阿里或清华镜像的方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

1. 备份源列表

Ubuntu缺省的配置的源并不是国内的服务器,下载更新软件都比较慢,本文介绍如何设置源列表,选择比较快的源以节省下载时间。

# 首先备份源列表
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup

2. 打开sources.list文件修改

选择合适的源,替换原文件的内容,保存编辑好的文件, 以阿里云更新服务器为例(从实际测试上结果分析,个人认为阿里云比网易和搜狐的服务器要快):

sudo vim /etc/apt/sources.list

3. 阿里云镜像源-清华镜像源

注意根据具体使用的Ubuntu的版本不同,将文本中trusty替换为下面对应版本的字符串:

版本 版本号 代号
Lucid(10.04) 10.04 lucid
Precise(12.04): precise 12.04 precise
Trusty(14.04): trusty 14.04 trusty
Utopic(14.10): utopic 14.10 utopic
Ubuntu 16.04 TLS: xenial 16.04 xenial
Ubuntu 18.04 TLS: bionic 18.04 bionic

Ubuntu 18.04 TLS版本阿里云镜像源:

# https://opsx.alibaba.com/mirror
deb https://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse 
deb https://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse 
deb https://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse 
deb https://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse 
deb https://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse 

# 仿照清华镜像源,注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse 
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse 
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse 
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse 
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse

Ubuntu 18.04 TLS版本清华镜像源:

# https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

4. 刷新列表,一定要执行刷新

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential

5. 参考

修改ubuntu的sources.list源

修改ubuntu的sources.list源

如何修改Ubuntu的源列表(source list)

到此这篇关于修改ubuntu 18.04的sources.list源为阿里或清华镜像的方法的文章就介绍到这了,更多相关ubuntu18.04 sources.list内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

相关文章

  • IO多路复用之epoll全面总结(必看篇)

    IO多路复用之epoll全面总结(必看篇)

    下面小编就为大家带来一篇IO多路复用之epoll全面总结(必看篇)。小编觉得挺不错的。现在就分享给大家。也给大家做个参考。一起跟随小编过来看看吧
    2016-12-12
  • linux exa命令(比ls更好的展示文件体验)

    linux exa命令(比ls更好的展示文件体验)

    这篇文章主要介绍了linux exa命令(比ls更好的展示文件体验),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2019-11-11
  • linux 基础命令大全

    linux 基础命令大全

    学过Linux的人都会知道,Linux中的命令的确是非常多,但是玩过Linux的人也从来不会因为Linux的命令如此之多而烦恼,本文介绍了linux 基础命令,有兴趣的可以了解一下。
    2016-10-10
  • CentOS7编译安装新版LNMP环境

    CentOS7编译安装新版LNMP环境

    本文给大家分享的是在最新版的centos系统中编译安装lnmp环境的详细步骤,非常的实用,推荐需要的小伙伴们参考下
    2016-10-10
  • Ubuntu18.04服务器密码忘记或被篡改如何重置密码

    Ubuntu18.04服务器密码忘记或被篡改如何重置密码

    这篇文章主要介绍了Ubuntu18.04服务器密码忘记或被篡改如何重置密码,本文分步骤给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下
    2019-09-09
  • Linux环境下python2.7.6升级python3.5.2

    Linux环境下python2.7.6升级python3.5.2

    本篇文章主要介绍了centos7下python2.7.5升级到3.5.2,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
    2017-04-04
  • 基于python的Linux系统指定进程性能监控思路详解

    基于python的Linux系统指定进程性能监控思路详解

    这篇文章主要介绍了基于python的Linux系统指定进程性能监控的思路详解,本文给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下
    2019-09-09
  • xampp安装后apache 80端口被占用的解决方法

    xampp安装后apache 80端口被占用的解决方法

    这篇文章主要介绍了xampp安装后apache 80端口被占用的解决方法,大家参考使用吧
    2013-12-12
  • windows下安装PEAR php5.3.1下解决出错的方法

    windows下安装PEAR php5.3.1下解决出错的方法

    在配置好了Apache2.2.14和PHP5.3.1后,最近想安装PEAR(PHP Extension and Application Repository),但是在执行批处理文件go-pear.bat的时候出现了错误
    2010-02-02
  • Linux平台安装redis及redis扩展的方法

    Linux平台安装redis及redis扩展的方法

    这篇文章主要介绍了Linux平台安装redis及redis扩展的方法,较为详细的分析了Linux平台redis安装步骤、操作命令与相关注意事项,需要的朋友可以参考下
    2018-08-08

最新评论