Yuhang Zheng

ubuntu更新错误

N 人看过

ubuntu更新报错如下:

root@localhost:~# apt-get update
Err:1 http://us.ports.ubuntu.com/ubuntu-ports bionic InRelease
  Temporary failure resolving 'us.ports.ubuntu.com'
Err:2 http://ports.ubuntu.com/ubuntu-ports bionic-security InRelease
  Temporary failure resolving 'ports.ubuntu.com'
Err:3 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease
  Temporary failure resolving 'ppa.launchpad.net'
Err:4 http://us.ports.ubuntu.com/ubuntu-ports bionic-updates InRelease
  Temporary failure resolving 'us.ports.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://us.ports.ubuntu.com/ubuntu-ports/dists/bionic/InRelease  Temporary failure resolving 'us.ports.ubuntu.com'
W: Failed to fetch http://us.ports.ubuntu.com/ubuntu-ports/dists/bionic-updates/InRelease  Temporary failure resolving 'us.ports.ubuntu.com'
W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/bionic-security/InRelease  Temporary failure resolving 'ports.ubuntu.com'
W: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/dists/bionic/InRelease  Temporary failure resolving 'ppa.launchpad.net'
W: Some index files failed to download. They have been ignored, or old ones used instead.

原因是dns没有配置,解决办法 加入dns服务器地址:

vi /etc/resolv.conf

添加

nameserver 202.96.134.133
nameserver 8.8.8.8

如果提示只读,用sudo运行,即:

sudo vi /etc/resolv.conf

运行完重启系统解决