使用镜像Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-91-generic x86_64)shell
使用虚拟机VMware WorkStation Pro 12ubuntu
系统环境windows 10vim
初次安装完成后 当即执行sudo apt update 并正确输入root密码windows
回显信息以下编辑器
Ign:1 cdrom://Ubuntu-Server 16.04.3 LTS _Xenial Xerus_ - Release amd64 (20170801) xenial InRelease Err:2 cdrom://Ubuntu-Server 16.04.3 LTS _Xenial Xerus_ - Release amd64 (20170801) xenial Release Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs Hit:3 http://security.ubuntu.com/ubuntu xenial-security InRelease Hit:4 http://us.archive.ubuntu.com/ubuntu xenial InRelease Hit:5 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease Hit:6 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease Reading package lists... Done E: The repository 'cdrom://Ubuntu-Server 16.04.3 LTS _Xenial Xerus_ - Release amd64 (20170801) xenial Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details.
由上述回显信息能够得知,apt update以后,命令首先访问cdrom,这个cdrom就是安装镜像时的光盘。在apt update命令执行时,命令将首先访问/etc/apt/sources.list文件,依次访问文件中列出的源,以更新信息,这时候,既然命令执行后显示访问的时cdrom,说明文件中第一个源项是本地的cdrom,可是其访问的cdrom实际并不存在(或者是名称不符,或者是安装完成后vm自动弹出该cdrom)致使命令没法得到源信息,所以报错this
用sudo权限和任意文本编辑器打开/etc/apt/sources.list文件
这里我用vim打开 命令以下rest
sudo vim /etc/apt/sources.list
而后使用#注释掉以 deb cdrom 打头的全部行(行首已有#的不须要再注释)
个人文件中注释的是以下行code
# deb cdrom:[Ubuntu-Server 16.04.3 LTS _Xenial Xerus_ - Release amd64 (20170801)]/ xenial main restricted
须要注意,实际状况中后半部分可能不一样,但必定是deb cdrom打头 ,把这打头的全部行都注释准没错,但不建议直接删除,避免没法预知的错误出现后没法恢复get