修改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内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

相关文章

  • Linux使用cut进行文本提取的操作方法

    Linux使用cut进行文本提取的操作方法

    Linux 中的 cut 命令是一个命令行实用程序,用于从文件或标准输入中提取文本行的部分,本文给大家介绍了Linux使用cut进行文本提取的操作方法,文中有详细的代码示例供大家参考,需要的朋友可以参考下
    2025-02-02
  • linux轻量级 Web 服务器

    linux轻量级 Web 服务器

    linux轻量级 Web 服务器...
    2007-11-11
  • 如何将CentOS7升级至CentOS8(详细步骤)

    如何将CentOS7升级至CentOS8(详细步骤)

    这篇文章主要介绍了如何将CentOS7升级至CentOS8(详细步骤),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2019-11-11
  • Apache Doris基础简介

    Apache Doris基础简介

    Apache Doris 是一个现代化的 MPP(Massively Parallel Processing,即大规模并行处理)分析型数据库产品,这篇文章主要介绍了Apache-Doris基础概念,需要的朋友可以参考下
    2024-03-03
  • 详解CentOS 6.5搭建Redis3.2.8单机分布式集群

    详解CentOS 6.5搭建Redis3.2.8单机分布式集群

    这篇文章主要介绍了详解CentOS 6.5搭建Redis3.2.8单机分布式集群,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2017-05-05
  • CentOS 7安装Mysql并设置开机自启动的方法

    CentOS 7安装Mysql并设置开机自启动的方法

    本篇文章主要介绍了CentOS 7安装Mysql并设置开机自启动的方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
    2017-02-02
  • Apache简介及安全配置方案

    Apache简介及安全配置方案

    Apache HTTP Server(简称Apache)是Apache软件基金会的一个开放源码的网页服务器,可以在大多数计算机操作系统中运行,由于其多平台和安全性被广泛使用,是最流行的Web服务器端软件之一。它快速、可靠并且可通过简单的API扩展,将Perl/Python等解释器编译到服务器中。
    2014-08-08
  • linux服务器磁盘爆满的处理方案

    linux服务器磁盘爆满的处理方案

    文章描述了Linux服务器磁盘爆满导致Redis服务无法访问的问题,通过一系列命令查找并删除大文件,解决了磁盘空间不足的问题,同时,文章介绍了如何配置Nacos以防止日志文件过大导致磁盘空间爆满,需要的朋友可以参考下
    2025-02-02
  • 详解CentOS7 FTP服务搭建(虚拟用户访问FTP服务)

    详解CentOS7 FTP服务搭建(虚拟用户访问FTP服务)

    Liunx外部文件的传输,避免不了使用FTP服务,所以现在就整理下,CentOS7环境下,FTP服务的搭建。有兴趣的可以了解一下。
    2017-01-01
  • 2018即将推出的Apache Spark 2.4都有哪些新功能

    2018即将推出的Apache Spark 2.4都有哪些新功能

    即将发布的 Apache Spark 2.4 版本是 2.x 系列的第五个版本。 本文对Apache Spark 2.4 的主要功能和增强功能进行了概述,需要的朋友可以参考下
    2018-09-09

最新评论