您现在的位置是:首页 >学无止境 >Ubuntu 更换阿里云镜像步骤网站首页学无止境

Ubuntu 更换阿里云镜像步骤

broadview_java 2024-06-17 11:27:59
简介Ubuntu 更换阿里云镜像步骤

一. 前言

        安装Ubuntu系统成功后,最好优先配置好源文件,方便安装工具和配置环境,本文介绍一下更换方法,在不同版本上的sources.list 配置。

二. 配置方法

1. 备份sources.list

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

2. 编辑sources.list

sudo gedit  /etc/apt/sources.list

3.  不同版本配置

   ubuntu 16.04 配置如下

deb https://mirrors.aliyun.com/ubuntu/ xenial main
deb-src https://mirrors.aliyun.com/ubuntu/ xenial main

deb https://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src https://mirrors.aliyun.com/ubuntu/ xenial-updates main

deb https://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src https://mirrors.aliyun.com/ubuntu/ xenial universe
deb https://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src https://mirrors.aliyun.com/ubuntu/ xenial-updates universe

deb https://mirrors.aliyun.com/ubuntu/ xenial-security main
deb-src https://mirrors.aliyun.com/ubuntu/ xenial-security main
deb https://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src https://mirrors.aliyun.com/ubuntu/ xenial-security universe

 

    ubuntu 18.04(bionic) 配置如下

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

 

    ubuntu 20.04(focal) 配置如下

deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

# deb https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

4. 更新源

使用如下命令 更新获取 阿里软件源 提供的软件列表

sudo apt-get update

 

5. 更新软件 (可选操作)

 sudo apt-get upgrade

三. 小结

        如果是个人开发环境电脑的话,系统安装成功后,优先操作此步骤,第5步骤最好也执行一下,就是把软件更新到与当前Ubuntu系统相匹配的状态,同时也会给你安装上一些必要的库文件等。

风语者!平时喜欢研究各种技术,目前在从事后端开发工作,热爱生活、热爱工作。