Ubuntu如何恢复默认镜像源

Ubuntu如何恢复默认镜像源

一、前言

如果你按照了其他博客换源的操作,应该都有一个备份的默认源:

其他博客中备份的指令:

cp /etc/apt/sources.list /etc/apt/sources.list.backup

二、步骤

1、查看备份文件

我们需要走到源的文件夹下,查看备份是否存在:

cd /etc/apt

ls

这里显示:sources.list.backup,说明我当时保存了。

2、恢复方法

方法1:

(1)复制文件

方法描述:如果有备份,直接拷贝恢复source.list。

还记得第一步吗,直接反向操作就行:

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

(2)查看文件

再查看一下:

gedit sources.list

没问题就是备份完了。

方法2:

①直接打开备份文件:

gedit sources.list.backup

②手动复制

然后,我们接下来就是要把里面的内容复制到sources.list里面

先Ctrl+C拷贝上面的内容,然后以sudo形式打开source.list

sudo gedit sources.list

打开文件复制进去保存即可,如果不加sudo就是只读模式,记得要加。

方法3:

参考:

anaconda换源和恢复默认源

Ubuntu系统镜像备份及恢复

三、Ubuntu 22.04 LTS

这里提供一份ubuntu22.04的:

#deb cdrom:[Ubuntu 22.04.1 LTS _Jammy Jellyfish_ - Release amd64 (20220809.1)]/ jammy main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to

# newer versions of the distribution.

deb http://cn.archive.ubuntu.com/ubuntu/ jammy main restricted

# deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy main restricted

## Major bug fix updates produced after the final release of the

## distribution.

deb http://cn.archive.ubuntu.com/ubuntu/ jammy-updates main restricted

# deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu

## team. Also, please note that software in universe WILL NOT receive any

## review or updates from the Ubuntu security team.

deb http://cn.archive.ubuntu.com/ubuntu/ jammy universe

# deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy universe

deb http://cn.archive.ubuntu.com/ubuntu/ jammy-updates universe

# deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu

## team, and may not be under a free licence. Please satisfy yourself as to

## your rights to use the software. Also, please note that software in

## multiverse WILL NOT receive any review or updates from the Ubuntu

## security team.

deb http://cn.archive.ubuntu.com/ubuntu/ jammy multiverse

# deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy multiverse

deb http://cn.archive.ubuntu.com/ubuntu/ jammy-updates multiverse

# deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy-updates multiverse

## N.B. software from this repository may not have been tested as

## extensively as that contained in the main release, although it includes

## newer versions of some applications which may provide useful features.

## Also, please note that software in backports WILL NOT receive any review

## or updates from the Ubuntu security team.

deb http://cn.archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse

# deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu jammy-security main restricted

# deb-src http://security.ubuntu.com/ubuntu jammy-security main restricted

deb http://security.ubuntu.com/ubuntu jammy-security universe

# deb-src http://security.ubuntu.com/ubuntu jammy-security universe

deb http://security.ubuntu.com/ubuntu jammy-security multiverse

# deb-src http://security.ubuntu.com/ubuntu jammy-security multiverse

# This system was installed using small removable media

# (e.g. netinst, live or single CD). The matching "deb cdrom"

# entries were disabled at the end of the installation process.

# For information about how to configure apt package sources,

# see the sources.list(5) manual.

四、Ubutnu20.04.5 LTS

再提供一个20.04.5的

# deb cdrom:[Ubuntu 20.04.5 LTS _Focal Fossa_ - Release amd64 (20220831)]/ focal main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to

# newer versions of the distribution.

deb http://cn.archive.ubuntu.com/ubuntu/ focal main restricted

# deb-src http://cn.archive.ubuntu.com/ubuntu/ focal main restricted

## Major bug fix updates produced after the final release of the

## distribution.

deb http://cn.archive.ubuntu.com/ubuntu/ focal-updates restricted main

# deb-src http://cn.archive.ubuntu.com/ubuntu/ focal-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu

## team. Also, please note that software in universe WILL NOT receive any

## review or updates from the Ubuntu security team.

deb http://cn.archive.ubuntu.com/ubuntu/ focal universe

# deb-src http://cn.archive.ubuntu.com/ubuntu/ focal universe

deb http://cn.archive.ubuntu.com/ubuntu/ focal-updates universe

# deb-src http://cn.archive.ubuntu.com/ubuntu/ focal-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu

## team, and may not be under a free licence. Please satisfy yourself as to

## your rights to use the software. Also, please note that software in

## multiverse WILL NOT receive any review or updates from the Ubuntu

## security team.

deb http://cn.archive.ubuntu.com/ubuntu/ focal multiverse

# deb-src http://cn.archive.ubuntu.com/ubuntu/ focal multiverse

deb http://cn.archive.ubuntu.com/ubuntu/ focal-updates multiverse

# deb-src http://cn.archive.ubuntu.com/ubuntu/ focal-updates multiverse

## N.B. software from this repository may not have been tested as

## extensively as that contained in the main release, although it includes

## newer versions of some applications which may provide useful features.

## Also, please note that software in backports WILL NOT receive any review

## or updates from the Ubuntu security team.

# deb-src http://cn.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's

## 'partner' repository.

## This software is not part of Ubuntu, but is offered by Canonical and the

## respective vendors as a service to Ubuntu users.

# deb http://archive.canonical.com/ubuntu focal partner

# deb-src http://archive.canonical.com/ubuntu focal partner

deb http://security.ubuntu.com/ubuntu focal-security restricted main

# deb-src http://security.ubuntu.com/ubuntu focal-security main restricted

deb http://security.ubuntu.com/ubuntu focal-security universe

# deb-src http://security.ubuntu.com/ubuntu focal-security universe

deb http://security.ubuntu.com/ubuntu focal-security multiverse

# deb-src http://security.ubuntu.com/ubuntu focal-security multiverse

# This system was installed using small removable media

# (e.g. netinst, live or single CD). The matching "deb cdrom"

# entries were disabled at the end of the installation process.

# For information about how to configure apt package sources,

# see the sources.list(5) manual.