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.-) ...

Ubuntu的Unable to locate package无法更新源问题解决方案的更多相关文章

  1. Ubuntu:Unable to locate package ***

    在Ubuntu 上使用apt-get 安装包时遇到  Unable to locate package 的信息 解决方案: 更细apt-get然后重新安装 #sudo apt-get update   ...

  2. Ubuntu : 解决更新时出现 Unable to locate package update

    当用apt-get更新软件包时常出现错误提示Unable to locate package update, 尤其是在ubuntu server上,解决方法是:     先更新apt-get      ...

  3. linux -- Ubuntu报错“unable to locate package...”

    有时候在Ubuntu命令行中执行安装某个文件的时候,如:sudo apt-get install xinit ,报 “unable to locate package...” 错误,解决办法如下 1. ...

  4. Ubuntu install 错误 E:Unable to locate package

    今天在 Ubuntu 上执行 sudo apt install sl 命令,结果报错:E:Unable to locate package sl 上网查询了一下,先更新一下 apt-get,执行:su ...

  5. 【转】ubuntu 11.04使用apt-get安装软件时一直提示E:unable to locate package

    问题: VMware虚拟机安装了ubuntu 11.04,在使用apt-get安装软件时一直提示E:Unable to locate package. 百度了原因,说是要更新源,使用命令:sudo a ...

  6. Ubuntu Server安装telnet服务时"Unable to locate package telnetd"解决方法

    装好Ubuntu Server 12.04后,用apt-get安装telnetd报"E: Unable to locate package telnetd",解决方法如下: 虚拟机 ...

  7. ubuntu 安装nginx, 出现 Unable to locate package

    今天在初始化一台新的ubuntu 服务器时,敲上了 sudo apt-get install nginx 来安装nginx, 却发现提示:  Reading package lists... Done ...

  8. Docker:Err http://archive.ubuntu.com trusty InRelease & E: Unable to locate package [name] 问题

    参考: Docker containers can't resolve DNS on Ubuntu 14.04 Desktop Host Unable to locate package错误解决办法 ...

  9. ubuntu 14.04 编译内核出现unable to locate package ncurses-devel 问题的解决

    http://cache.baiducontent.com/c?m=9f65cb4a8c8507ed4fece7631046893b4c4380146d96864968d4e414c422461614 ...

随机推荐

  1. Eclipse中的maven项目打war包

    在对应的pom文件中,找到packing这个属性,改为war:如果没有,就自己加一个,这个是有默认值的,默认为jar. 例如: <modelVersion>4.0.0</modelV ...

  2. 子查询语句的thinkphp实现

    语句 SELECT a.id as item_id,a.name as item_name,a.intro as item_intro,b.id,b.money FROM sh_incentive_i ...

  3. 【转载】解决SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的 STATEMENT'OpenRowset/OpenDatasource' 的访问的方法

    1.开启Ad Hoc Distributed Queries组件,在sql查询编辑器中执行如下语句: exec sp_configure 'show advanced options',1 recon ...

  4. 登陆验证系统实例-三种(cookie,session,auth)

    登陆验证 因为http协议是无状态协议,但是我们有时候需要这个状态,这个状态就是标识 前端提交from表单,后端获取对应输入值,与数据库对比,由此对象设置一个标识,该对象 在别的视图的时候,有此标识, ...

  5. JavaScript笔记——BOM的操作和浏览器的检测

    BOM的操作 BOM 也叫浏览器对象模型,它提供了很多对象,用于访问浏览器的功能.BOM 缺少规范,每个浏览器提供商又按照自己想法去扩展它,就可能存在浏览器不兼容的情况,那么浏览器共有对象就成了事实的 ...

  6. Python web框架 flask

    Flask是一个基于Python开发并且依赖jinja2模板和Werkzeug WSGI服务的一个微型框架,对于Werkzeug本质是Socket服务端,其用于接收http请求并对请求进行预处理,然后 ...

  7. java成神之——正则表达式基本使用

    正则表达式 常用匹配规则 基本使用 标记符的使用 部分正则标记 正则表达式在字符串方法中的使用 结语 正则表达式 常用匹配规则 [abc] abc其中一个 [^abc] abc之外的一个 [a-z] ...

  8. php写一个判断是否有cookie的脚本

    前言: 刚刚学习完cookie函数,写个练习. 0x01: //其实第二个应该改为elseif,但是我懒.啊哈 <?php $vlas="BnJhiFoPS4"; if(is ...

  9. Python Twisted系列教程12:改进诗歌下载服务器

    作者:dave@http://krondo.com/a-poetry-transformation-server/  译者:杨晓伟(采用意译) 你可以从这里从头阅读这个系列. 新的服务器实现 这里我们 ...

  10. 「小程序JAVA实战」 小程序手写属于自己的第一个demo(六)

    转自:https://idig8.com/2018/08/09/xiaochengxu-chuji-06/ 自己尝试的写一个小demo,用到自定义样式,自定义底部导航,页面之间的跳转等小功能.官方文档 ...