昨天在服务器中安装了ubuntu 10.04,装好基本系统后,在安装openssh中,使用sudo apt-get install openssh-server命令,发现安装不了,出现以下问题:
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package openssh-server is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package openssh-server has no installation candidate
解决办法:
首先得试一下是否能PING通外网,然后用sudo apt-get update 确认一下,的确是因为网络不通。所以接下来得要重新设置网卡。
由于在机房都是设置静态IP,所以需要做如下操作:
1)用ifconfig,查看网卡情况,确定网卡名称。这里假如是eth0.
2)为网卡配置静态IP地址
编辑文档/etc/network/interfaces: sudo vi /etc/network/interfaces 并用下面的行来替换有关eth0的行: # The primary network interface auto eth0 iface eth0 inet static address 192.168.3.90 gateway 192.168.3.1 netmask 255.255.255.0 network 192.168.3.0 (可以不用) broadcast 192.168.3.255 (可以不用) 将上面的ip地址等信息换成您自己就能够了. 然后输入"wq " 回车,以保存并退出Vi。3)最后用下面的命令使网络配置生效: sudo /etc/init.d/networking restart于是,我把网卡的IP地址,和DNS设置好并重启。
再使用sudo apt-get update ,OK 问题解决!
然后,使用sudo apt-get install openssh-server 就可以安装了。