You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 18.04执行sudo apt-get update报错无法解析tr.archive.ubuntu.com

Ubuntu 18.04 执行apt update源解析失败解决方案

报错根因

  • 报错中Could not resolve 'tr.archive.ubuntu.com'说明系统默认配置的土耳其区域Ubuntu软件源无法被DNS正常解析,属于区域源服务器故障或当前网络无法连通该区域源导致的问题。

解决方案

方案1:切换为国内镜像源(推荐,访问速度更稳定)

  1. 先备份原有源配置文件,避免后续需要恢复:
    sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
  2. 编辑源配置文件,可使用nano或vim编辑器:
    sudo nano /etc/apt/sources.list
  3. 删除文件内原有全部内容,替换为国内可用的18.04版本源,以下为阿里云源示例:
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-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
  1. 保存退出编辑器后,重新执行update命令验证修复效果:
    sudo apt-get update

方案2:快速切换为官方全局源(无需替换全部内容,适合快速验证)

  1. 编辑源配置文件:sudo nano /etc/apt/sources.list
  2. 将文件中所有http://tr.archive.ubuntu.com/字段替换为http://archive.ubuntu.com/,其余内容保持不变
  3. 保存退出后重新执行sudo apt-get update即可

异常排查

如果更换源后仍然提示解析失败,可排查系统DNS配置:

  1. 编辑DNS配置文件:sudo nano /etc/systemd/resolved.conf
  2. 找到DNS配置行,取消注释后修改为公共DNS,示例:
    DNS=223.5.5.5 114.114.114.114 8.8.8.8
  3. 重启DNS服务使配置生效:sudo systemctl restart systemd-resolved
  4. 再次执行sudo apt-get update验证即可

内容的提问来源于stack exchange,提问作者bgebes

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.23 15:45:01