更换Ubuntu操作系统的软件源

这里只给出步骤,详细的讲解请点我访问Ubuntu 官方源服务器在欧洲,国内访问很慢。所以这里有必要将软件源更换为国内的源,国内源很多,在这里我们选择阿里云与清华大学的 Ubuntu 源。

#  阿里云软件源   Ubuntu 18.04 https://developer.aliyun.com/mirror/ubuntu
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

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

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates 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-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

两者选择其一即可。

# 清华大学源   ubuntu 18.04 软件源https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
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

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

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

然后执行下面的命令打开 sources.list 文件,清空里面的内容,把上面阿里云与清华大学的 Ubuntu 源复制进去,保存后退出。

sudo gedit /etc/apt/sources.list

接着在终端上执行以下命令更新软件列表,检测出可以更新的软件:

sudo apt-get update

最后在终端上执行以下命令进行软件更新:

sudo apt-get upgrade

亦可以参考:https://yq.aliyun.com/articles/704603

推荐阅读

  1. Ubuntu开启/关闭防火墙及相关端口
  2. 如何在UBUNTU 18.04上安装GO
  3. 如何开启Ubuntu SSH root 用户登录
  4. 回收站(垃圾桶)、计算机图标怎么找回?
  5. 开启Ubuntu操作系统SSH连接22端口(默认关闭)
  6. Ubuntu sudo 出现unable to resolve host 解决方法
  7. Windows操作系统开启多终端远程桌面连接
  8. Linux(Ubuntu)中Could not get lock /var/lib/dpkg/lock解决方案

发表评论

电子邮件地址不会被公开。 必填项已用*标注