ubuntu

Ubuntu18.04 source.list怎么更新国内源

小亿
180
2023-10-21 10:16:43
栏目: 编程语言

要更新Ubuntu 18.04的软件源为国内源,可以按照以下步骤进行操作:

  1. 打开终端,通过以下命令备份当前的软件源列表文件:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
  1. 编辑软件源列表文件,使用以下命令打开编辑器:
sudo nano /etc/apt/sources.list
  1. 在打开的文件中,删除所有内容,然后粘贴以下内容,这是一个推荐的国内源列表:
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
# deb-src http://archive.ubuntu.com/ubuntu/ bionic main restricted

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted
# deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted
# deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted

deb http://mirrors.aliyun.com/ubuntu/ bionic universe
# deb-src http://mirrors.aliyun.com/ubuntu/ bionic universe
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates universe
# deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates universe

deb http://mirrors.aliyun.com/ubuntu/ bionic multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ bionic multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

# 预发布软件源,不建议启用
# deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted
# deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted
deb http://mirrors.aliyun.com/ubuntu/ bionic-security universe
# deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security universe
deb http://mirrors.aliyun.com/ubuntu/ bionic-security multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security multiverse
  1. 保存更改并关闭编辑器。对于Nano编辑器,请按Ctrl + X,然后按Y,最后按Enter保存文件。

  2. 运行以下命令更新软件源:

sudo apt update

现在,您的Ubuntu 18.04系统的软件源已更新为国内源。您可以使用apt命令安装和更新软件包,速度应该会更快。

0
看了该问题的人还看了