Ubuntu18.04在线镜像仓库配置

在线镜像仓库

1、查操作系统版本

root@ubuntu:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.5 LTS
Release:	18.04
Codename:	bionic

2、原文件备份

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

3、查镜像源信息

登录阿里yum仓库

阿里巴巴开源镜像站-OPSX镜像站-阿里云开发者社区

选择ubuntu操作系统

选择对应的版本,本文档使用18.04

4、编辑源列表文件

sudo vi /etc/apt/sources.list

5、将原来的内容删除,添加如下内容(阿里源镜像源)

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

即把这段替代刚打开那个文件,然后保存关闭。

6.更新

sudo apt-get update