新在虚拟机上装的Ubantu,查看IP,提示如下:
Command 'ifconfig' not found, but can be installed with:
apt install net-tools
按照上面要求执行
apt install net-tools
提示如下:
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?
意思大概是 apt 被其他进程给占用了,上锁了(lock)
root@ubuntu:/var/lib/dpkg# ls
alternatives cmethopt info statoverride triggers
arch diversions lock status updates
available diversions-old parts status-old
root@ubuntu:/var/lib/dpkg# rm lock
root@ubuntu:/var/lib/dpkg# apt install net-tools
把锁给删除掉 rm lock,在执行apt install net-tools, 安装成功
查看ifconfig成功
看到IP后,连接Xshell失败,因为Ubuntu不会自动安装open-sshserver,所以这里要手动安装一下
root@ubuntu:~# apt-get install openssh-server
安装成功以后,通过Xshell就可以连接到Ubuntu了。