ubuntu apt-get update失敗解決.

4200 ワード

apt-get updateを実行すると、次のエラーが発生します.
E: Some index files failed to download, they have been ignored, or old ones used instead.
ディレクトリの下/var/lib/apt/lists/partial/すべてのファイルをクリアし、apt-get updateを再実行できます.持参源は大陸ではよくない.
次のエラーが発生しました.
/etc/apt$ sudo apt-get update
Err http://security.ubuntu.com precise-security InRelease
  
Err http://security.ubuntu.com precise-security Release.gpg
  Temporary failure resolving 'security.ubuntu.com'
Err http://cn.archive.ubuntu.com precise InRelease
  
Err http://cn.archive.ubuntu.com precise-updates InRelease
  
Err http://cn.archive.ubuntu.com precise-backports InRelease
  
Err http://cn.archive.ubuntu.com precise Release.gpg
  Temporary failure resolving 'cn.archive.ubuntu.com'
Err http://cn.archive.ubuntu.com precise-updates Release.gpg
  Temporary failure resolving 'cn.archive.ubuntu.com'
Err http://cn.archive.ubuntu.com precise-backports Release.gpg
  Temporary failure resolving 'cn.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise/InRelease  

W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-updates/InRelease  

W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-backports/InRelease  

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/InRelease  

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/Release.gpg  Temporary failure resolving 'security.ubuntu.com'

W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise/Release.gpg  Temporary failure resolving 'cn.archive.ubuntu.com'

W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-updates/Release.gpg  Temporary failure resolving 'cn.archive.ubuntu.com'

W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-backports/Release.gpg  Temporary failure resolving 'cn.archive.ubuntu.com'

W: Some index files failed to download. They have been ignored, or old ones used instead.
xinju@xinjuOffice:/etc/apt$ cd ../network

アリソース:
deb http://mirrors.aliyun.com/ubuntu/ raring main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ raring-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ raring-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ raring-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ raring-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ raring main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ raring-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ raring-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ raring-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ raring-backports main restricted universe multiverse

ipを変更するには:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interfacea
auto eth0
iface eth0 inet static
address 192.168.2.170
netmask 255.255.255.0
broadcast 192.168.2.255
gateway 192.168.2.1
dns-nameservers 192.168.2.1

dnsを変更するには:
1、再起動有効:
sudo vi /etc/resolvconf/resolv.conf.d/base(このファイルのデフォルトは空です)
挿入:nameserver 8.8.8.8 nameserver 8.8.4.4
DNSが複数あれば1行1個
変更して保存し、実行
sudo resolvconf -u
もう一度/etc/resolv.conf、一番下に2行増えました.
cat /etc/resolv.conf# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) #     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTENnameserver 8.8.8.8 nameserver 8.8.4.4
私たちの設定が追加され、ドメイン名がpingされていることがわかります.再起動する必要はありません.
2、再起動の有効期限:
プロファイルアドレス/etc/resolv.conf
エディタで開く
以下に変更します.search localdomain nameserver 202.96.128.86に変更したいDNS nameserver 202.96.128.66代替DNS
再起動ネットワーク:sudo/etc/init.d/networking restart.すぐ