虚拟机安装好ubuntu后,使用xhell连接不上:

检查网络连接,互相是可以ping通的:


检查ssh:
ps -e | grep ssh
/etc/init.d/ssh resart

发现没有安装ssh,使用apt-get install openssh-server安装ssh:

安装好后,执行/etc/init.d/ssh resart启动ssh,之后就可以连接
如果遇上以下报错:
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

则删除以下文件:
rm /var/lib/dpkg/lock
rm /var/lib/apt/lists/lock
rm /var/cache/apt/archives/lock