sudo apt-get update 不起作用。错误:1 http://archive.ubuntu.com/ubuntu bionic InRelease

sudo apt-get update 不起作用。错误:1 http://archive.ubuntu.com/ubuntu bionic InRelease

我曾尝试在 Ubuntu 上安装“httpd”软件包,但总是失败。我阅读了很多关于如何在我的电脑上安装“Apache”的教程。我发现在执行这些教程操作后,我的电脑无法执行sudo apt-get update

我尝试了互联网上的许多解决方案

"This is the history of command line argument"

  799  sudo ufw default deny incoming
  800  sudo ufw default allow outgoing
  801  sudo ufw allow ssh
  802  sudo ufw allow 2222
  803  sudo ufw allow http
  804  sudo ufw allow 80
  805  sudo ufw allow https
  806  sudo ufw allow 443
  807  sudo ufw deny from 203.0.123.5
  808  sudo ufw enable
  809  sudo ufw status verbose
  810  sudo ufw status
  811  sudo ufw allow 'OpenSSH'
  812  sudo ufw status
  813  sudo systemctl start apache2.service
  814  ls
  815  yum install httpd
  816  sudo yum install httpd
  817  sudo systemctl start apache2.service
  818  cat /etc/redhat-release
  819  sudo apt-get update
  820  echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null
  821  sudo apt-get update
  822  sudo nano /etc/apt/sources.list
  823  #deb http://archive.ubuntu.com/ubuntu/
  824  sudo apt-get update && sudo apt-get upgrade
  825  apt-get clean
  826  sudo apt-get clean
  827  sudo apt-get update
  828  ls
  829  cd ..
  830  ls
  831  cd etc
  832  ls
  833  cat resolv.conf
  834  sudo ufw default allow incoming
  835  sudo apt-get update
  836  sudo ufw status
  837  history
  838  sudo systemctl stop apache2.service
  839  echo "nameserver 8.8.8.8" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null
  840  cd ~
  841  echo "nameserver 8.8.8.8" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null
  842  echo "nameserver 208.67.222.222" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null
  843  clean
  844  clear
  845  sudo apt-get update
  846  /etc/network/interfaces.d/50-cloud-init.cfg
  847  /etc/network/interfaces
  848  sudo /etc/network/interfaces
  849  sudo apt-get /etc/network/interfaces
  850  sudo rm /var/lib/apt/lists/* -vf
  851  sudo apt-get update
  852  history
Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease                  
  Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease        
  Temporary failure resolving 'security.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Reading package lists... Done        
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

答案1

同样的问题;我的解决方案:

DNS Server has changed...

sudo nano /etc/netplan/50-xxxx-yyyyy.yaml

-->   addresses: [1.1.1.1,8.8.8.8,xx.xxx.xx.xxx]

sudo netplan --debug apply

相关内容