服务器上安装了最新的Ubuntu Server 18.04,代号为bionic。使用apt-get命令安装软件时,有时候速度比较慢,有时候会失败。因此考虑用国内的镜像源更换下apt-get的默认源。

ubuntu 查看版本号:
lsb_release -a

输出:
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
其中Codename表示代号。

1.备份系统自带源
mv /etc/apt/sources.list /etc/apt/sources.list.bak

2.修改/etc/apt/sources.list文件,加入想替换的国内源,我使用的是阿里云的源
vi /etc/apt/sources.list

由于服务器的版本是18.04,因此源地址的代号部分都是bionic,如果是其他版本,可以替换为对应的版本,具体版本代号可以网上查找。

##阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

##163源
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse

##清华源
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

##中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

3.更新生效
apt-get update
apt-get upgrade

done!

ubuntu18.04 apt-get换国内源 阿里源 163源 清华源 中科大源的更多相关文章

  1. 清华源和中科大源都停止对Anaconda的支持之后,换腾讯云镜像的方法

    直接下载下面的文件解压后放在用户文件夹下即可,windows为"C:\用户\你的用户名\",Linux为"/home/你的用户名/"即用户主目录下. 点我下载 ...

  2. Ubuntu 18.04换国内源 中科大源 阿里源 163源 清华源

    感觉还是18.4好用,所以最近装回了18,感觉现在18的兼容性也还可以了,深度学习的环境配置都没有问题,就是安装软件的时候有点慢,所以想要更新一下源. 第一步: 编辑/etc/apt/sources. ...

  3. ubuntu18换国内源

    编辑/etc/apt/sources.list文件, 在文件最前面添加以下条目(操作前请做好相应备份): ##中科大源 deb https://mirrors.ustc.edu.cn/ubuntu/ ...

  4. pip换国内源

    pip换国内源 1.国内常用源   阿里云 http://mirrors.aliyun.com/pypi/simple/   中国科技大学 https://pypi.mirrors.ustc.edu. ...

  5. Ubuntu 18.04 LTS修改 国内源(以中科大源为例)

    国内有很多Ubuntu的镜像源,包括阿里的.网易的,还有很多教育网的源,比如:清华源.中科大源. 我们这里以中科大的源为例讲解如何修改Ubuntu 18.04里面默认的源. 可以进入这个链接进行下载: ...

  6. .condarc(conda 配置文件)、换国内源

    原文地址 https://blog.csdn.net/lanchunhui/article/details/71379555 Configuration — Conda documentation . ...

  7. ubuntu 16.04 LTS 修改 国内源(以中科大源为例)

    国内有很多ubuntu的源,包括:网易源(这个之前用过,速度很快的),阿里源,还有很多教育网的源,如:清华源,中科大源. 这里要下载的是中科大ubuntu16.04的源列表,可以在这里获得:https ...

  8. Windows设置国内源阿里云镜像加速与离线安装pip包的方法

    Windows设置国内源阿里云镜像加速1.先在 windows “文件资源管理器” 地址栏 输入 %APPDATA% 按回车,打开程序自定义设置文件夹然后,创建名为 pip 的文件夹,用于存放 pip ...

  9. ubuntu20.04 LTS 更换国内163源、阿里源、清华源、中科大源

    Ubuntu 20.04 是 Ubuntu 的第 8 个 LTS 版本,其重大更新和改进将在 2030 年前终止,计划于2020年 4 月 23 日发布. 国内有很多Ubuntu的镜像源,有阿里的.网 ...

随机推荐

  1. java笔记 -- GregorianCalendar和DateFormateSymbols 类方法

    java.util.GregorianCalendar new GregorianCalendar() 构造一个日历对象, 用于表示默认地区,默认时区的当前时间. new GregorianCalen ...

  2. 第 8 章 容器网络 - 064 - Weave 网络结构分析

    Weave 网络结构分析 在 host1 中运行容器 bbox1: eval $(weave env) docker run --name bbox1 -itd busybox 首先执行 eval $ ...

  3. 3分钟快速presentation

    来自英语课的一个练习: https://www.youtube.com/watch?v=ePY3uY1L0X0 next up I'd like to welcome Joshua to ten he ...

  4. 自我学习成长系列之<<FirstHead设计模式>>

    第一章 设计模式入门 1.好词好句: 好的设计是可以应付改变. 2.驱动改变的因素:(a)客户需求不清晰,后期会一直变 (b)遇到坑爹的产品,自己不会全扔给程序员 (c)在开发过程中,产生一个新概念, ...

  5. js里获取页面高度和文档高度

    $(window).height() 和 $(document).height()的区别 $(window).height()代表了当前可见区域的大小,$(document).height()则代表了 ...

  6. JAVA的原子性和可见性,线程同步的理解

    1.原子性 (1)原子是构成物质的基本单位(当然电子等暂且不论),所以原子的意思代表着——“不可分”: (2)原子性是拒绝多线程操作的,不论是多核还是单核,具有原子性的量,同一时刻只能有一个线程来对它 ...

  7. linux下read命令详解

    要与Linux交互,脚本获取键盘输入的结果是必不可少的,read可以读取键盘输入的字符. read [-rs] [-a ARRAY] [-d delim] [-n nchars] [-N nchars ...

  8. 调试nodejs项目接口,使用Posman,用req.body拿不到数据

    近日在postman 上面测试nodejs写的post接口,发现后台接受不到数据. 很多人其实不知道怎么postman 上面GET和POST怎么使用的 Postman接口操作 1.GET请求操作: 2 ...

  9. 【阅读笔记】《C程序员 从校园到职场》第六章 配置文件,makefile 文件 (Part 2)

     Contents: 1.配置文件(通常以 ini 结尾) 2.makefile文件 (Linux) PS: 这篇文章的内容,不太理解. 一.配置文件 本文以一个实际的小软件为例,介绍了C语言中配置文 ...

  10. 解决RAID重启后自动更名为md127

    创建完raid后查看/etc/有没有生成mdadm.conf文件 如果没有执行命令:mdadm --detail --scan >> /etc/mdadm.conf 编辑配置文件/etc/ ...