Ubuntu 12.04 server 安装后可能需要更新 apt 源

用 iso 文件装了个 ubuntu 12.04 server 后, 发现使用 "sudo apt-get install xxx" 程序时, 总是提示"Media change: please insert the disc labeled... cdrom ..." 错误信息. 此时, 虽然可以用 "sudo mount /...ubuntu-12.04.2-server-i386.iso /media/cdrom -t iso9660 -o loop" 加载 iso 文件解决, 但是在使用 "sudo apt-cache search ***" 时, 很多程序都找不到.

发现 "/etc/apt/sources.list" 内容为:

deb cdrom:[Ubuntu-Server 12.04.2 LTS _Precise Pangolin_ - Release i386 (20130214)]/ precise main restricted
将它替换为
deb http://mirrors.163.com/ubuntu/ oneiric main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ oneiric-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ oneiric-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ oneiric-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ oneiric-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ oneiric main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ oneiric-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ oneiric-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ oneiric-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ oneiric-backports main restricted universe multiverse
后, "sudo apt-get install xxx"  和 "sudo apt-cache search ***" 均变为正常.

参考: http://cooleep.com/post/automatic-landing-from-scratch-to-install-ubuntu-server-and-configure-ssh.htm

你可能感兴趣的:(Linux)