使用鏡像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