Ubuntu18.04 修改apt-get国内镜像源的方法

一、原文件备份

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

二、编辑源列表文件

sudo vim /etc/apt/sources.list

三、将原来的内容删除,添加以下内容:

清华源:

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

四、更新

sudo apt-get update
//更新软件
sudo apt-get upgrade

其他国内源:

1、 阿里源

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

2、中科大源

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、 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

参考:Ubuntu 18.04 国内的 apt 源Ubuntu 修改 apt-get 源为国内镜像源的方法

原文件内容备份记录:

#deb cdrom:[Ubuntu 18.04.4 LTS _Bionic Beaver_ - Release amd64 (20200203.1)]/ bionic 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/ bionic main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-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/ bionic universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic universe
deb http://cn.archive.ubuntu.com/ubuntu/ bionic-updates universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-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/ bionic multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-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/ bionic-backports main restricted universe multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-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 bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner

  • 4
    点赞
  • 29
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
### 回答1: ubuntu18.04 apt-get update是用于更新Ubuntu 18.04操作系统的命令。它会从Ubuntu软件中获取最新的软件包列表,并将其下载到本地计算机上。这个命令可以确保您的系统保持最新,并且可以修复一些已知的安全漏洞和错误。 ### 回答2: Ubuntu18.04是一个最新版本的操作系统,它使用的是该发行版的包管理器Apt-get,它是一个用于Ubuntu系统上安装、更新和卸载软件包的工具。通过使用Apt-get,用户可以通过命令行轻松地维护软件包,并且可以通过更新软件包来确保其系统的安全性。 关于Apt-get update命令,它是用于更新系统软件包列表的命令,它会从Ubuntu的软件包列表中获取最新的软件包信息。我们可以通过打开终端并输入以下命令来运行Apt-get update命令: sudo apt-get update sudo表示我们需要以管理员权限运行该命令。该命令会请求远程服务器查看是否有可用的软件包更新,并基于本地的软件包列表加载所有可用更新、安全补丁和修复程序。通常情况下,我们可以在终端中看到该命令的输出结果。如果有任何可用的更新,则Apt-get update将列出这些更新以及它们的依赖关系和。 需要注意的是,Apt-get update命令只会更新软件包列表,但不会实际安装软件包。要安装软件包,需要使用Apt-get install命令。如果您使用的是图形界面版本的Ubuntu,您还可以使用软件中心来查找和安装软件包。 总而言之,通过定期运行Apt-get update命令,可以帮助您保持您的Ubuntu系统最新,享受更好的性能和更高的安全性。 ### 回答3: Ubuntu18.04是当前最新版本的Ubuntu操作系统,是一款以稳定性与安全性著称的开操作系统。在Ubuntu操作系统中,软件安装和更新通过apt-get命令进行,而apt-get update命令则是更新Ubuntu的软件仓库列表,使其与官方同步更新。 更新软件仓库列表对于Ubuntu操作系统非常重要。因为软件仓库中存储了大量的软件包和依赖库文件,在安装或者升级软件时都需要从仓库中获取安装或升级的软件包和依赖库文件,这需要连接官方服务器,通过apt-get update命令使仓库列表与官方同步更新,保证能够顺利获取到软件包和依赖库文件。 通过ubuntu18.04中的apt-get update命令,我们可以更新Ubuntu操作系统中的软件仓库列表,使其包含最新的软件包和依赖库文件。在终端中执行apt-get update命令需要使用root用户或者有sudo权限的用户身份。 apt-get update命令的步骤如下: 1.打开终端,输入sudo apt-get update命令,按下Enter键。 2.Ubuntu会自动执行apt-get update命令,并连接Ubuntu官方服务器,同步更新软件仓库列表。 3.在更新过程中,您可以看到终端输出的更新进度,当更新完成时,apt-get命令会自动退出。 需要注意的是,apt-get update命令只更新软件仓库列表,不会对已经安装的软件进行升级,要升级软件需要使用apt-get upgrade命令。更新软件仓库列表是保证Ubuntu操作系统能够正常安装和升级软件的重要步骤,在定期更新的同时,我们也可以选择添加其他的依赖库,以便我们获取更多的软件包。 总之,在Ubuntu18.04中使用apt-get update命令是非常重要的,它可以保证软件仓库列表与官方同步更新,让我们可以及时获取到最新的软件包和依赖库文件,保证Ubuntu操作系统的稳定性和安全性。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值