https://blog.csdn.net/long19910605/article/details/47017889/
问题:
更新源时提示不能联网(does the network require authentication?),但是明明可以ping通外网啊,原来是不能访问这个默认源,所以更换一下源
chen@ubuntu:~$ sudo apt-get update
Get: http://ppa.launchpad.net/nginx/stable/ubuntu xenial InRelease [2,281 B]
Err: http://ppa.launchpad.net/nginx/stable/ubuntu xenial InRelease
Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Fetched , B in 0s (, B/s)
Reading package lists... Done
E: Failed to fetch http://ppa.launchpad.net/nginx/stable/ubuntu/dists/xenial/InRelease Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: Some index files failed to download. They have been ignored, or old ones used instead.
chen@ubuntu:~$ sudo apt-get install nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package nginx
编辑:sudo vi /etc/apt/sources.list
在下方添加163的源
deb http://mirrors.163.com/ubuntu/ precise main restricted
deb-src http://mirrors.163.com/ubuntu/ precise main restricted
deb http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb http://mirrors.163.com/ubuntu/ precise universe
deb-src http://mirrors.163.com/ubuntu/ precise universe
deb http://mirrors.163.com/ubuntu/ precise-updates universe
deb-src http://mirrors.163.com/ubuntu/ precise-updates universe
deb http://mirrors.163.com/ubuntu/ precise multiverse
deb-src http://mirrors.163.com/ubuntu/ precise multiverse
deb http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ precise-security main restricted
deb-src http://mirrors.163.com/ubuntu/ precise-security main restricted
deb http://mirrors.163.com/ubuntu/ precise-security universe
deb-src http://mirrors.163.com/ubuntu/ precise-security universe
deb http://mirrors.163.com/ubuntu/ precise-security multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-security multiverse
deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main
再次执行:sudo apt-get update
sudo apt-get upgrade
sudo apt install nginx
chen@ubuntu:~$ sudo apt-get update
Ign: http://mirrors.163.com/ubuntu precise InRelease
Get: http://mirrors.163.com/ubuntu precise Release [49.6 kB]
Get: http://mirrors.163.com/ubuntu precise Release.gpg [198 B]
Get: http://mirrors.163.com/ubuntu precise/main amd64 Packages [1,273 kB]
Get: http://mirrors.163.com/ubuntu precise/main i386 Packages [1,274 kB]
Get: http://mirrors.163.com/ubuntu precise/restricted amd64 Packages [8,452 B]
Get: http://mirrors.163.com/ubuntu precise/restricted i386 Packages [8,431 B]
Get: http://mirrors.163.com/ubuntu precise/universe amd64 Packages [4,786 kB]
Get: http://mirrors.163.com/ubuntu precise/universe i386 Packages [4,796 kB]
Get: http://mirrors.163.com/ubuntu precise/multiverse amd64 Packages [119 kB]
Get: http://mirrors.163.com/ubuntu precise/multiverse i386 Packages [121 kB]
Fetched 12.4 MB in 6s (, kB/s)
AppStream cache update completed, but some metadata was ignored due to errors.
Reading package lists... Done
W: http://mirrors.163.com/ubuntu/dists/precise/Release.gpg: Signature by key 630239CC130E1A7FD81A27B140976EAF437D05B5 uses weak digest algorithm (SHA1)
chen@ubuntu:~$ sudo apt install nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libgd2-noxpm nginx-common nginx-full
Suggested packages:
libgd-tools
The following NEW packages will be installed:
libgd2-noxpm nginx nginx-common nginx-full
upgraded, newly installed, to remove and not upgraded.
Need to get kB of archives.
After this operation, , kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get: http://mirrors.163.com/ubuntu precise/main amd64 libgd2-noxpm amd64 2.0.36~rc1~dfsg-6ubuntu2 [200 kB]
Get: http://mirrors.163.com/ubuntu precise/universe amd64 nginx-common all 1.1.19-1 [17.8 kB]
Get: http://mirrors.163.com/ubuntu precise/universe amd64 nginx-full amd64 1.1.19-1 [379 kB]
Get: http://mirrors.163.com/ubuntu precise/universe amd64 nginx all 1.1.19-1 [6,612 B]
Fetched kB in 0s ( kB/s)
Selecting previously unselected package libgd2-noxpm:amd64.
(Reading database ... files and directories currently installed.)
Preparing to unpack .../libgd2-noxpm_2.0.36~rc1~dfsg-6ubuntu2_amd64.deb ...
Unpacking libgd2-noxpm:amd64 (2.0.~rc1~dfsg-6ubuntu2) ...
Selecting previously unselected package nginx-common.
Preparing to unpack .../nginx-common_1.1.19-1_all.deb ...
Unpacking nginx-common (1.1.-) ...
Selecting previously unselected package nginx-full.
Preparing to unpack .../nginx-full_1.1.19-1_amd64.deb ...
Unpacking nginx-full (1.1.-) ...
Selecting previously unselected package nginx.
Preparing to unpack .../nginx_1.1.19-1_all.deb ...
Unpacking nginx (1.1.-) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Processing triggers for systemd (-4ubuntu21.) ...
Processing triggers for ureadahead (0.100.-) ...
Processing triggers for man-db (2.7.-) ...
Setting up libgd2-noxpm:amd64 (2.0.~rc1~dfsg-6ubuntu2) ...
Setting up nginx-common (1.1.-) ...
Setting up nginx-full (1.1.-) ...
Setting up nginx (1.1.-) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Processing triggers for systemd (-4ubuntu21.) ...
Processing triggers for ureadahead (0.100.-) ...