虚拟机virtualBox

在笔记本了装了一个虚拟机, 并安装了Linux系统, 方便测试linux 命令.
考虑到不需要图形界面, 学习了用命令行操作虚拟机, 配置如下

  1. linux 下安装openssh-server
  2. 虚拟机设置端口转发, 见参考链接
  3. 配置完后, 操作命令如下
[keke.zhaokk@zkkMac ~]
$ VBoxManage list vms
"mint19" {d0728a98-75f8-43ff-95f1-d188823504c3}[keke.zhaokk@zkkMac ~]
$ VBoxManage startvm "mint19" --type headless
Waiting for VM "mint19" to power on...
VM "mint19" has been successfully started.[keke.zhaokk@zkkMac ~]
$ VBoxManage controlvm "mint19" poweroff --type headless
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%[keke.zhaokk@zkkMac ~]
$ VBoxManage startvm "mint19" --type headless
Waiting for VM "mint19" to power on...
VM "mint19" has been successfully started.[keke.zhaokk@zkkMac ~]
$ ssh -p 9022 zkk@127.0.0.1
zkk@127.0.0.1's password:
Last login: Wed Nov  7 14:44:51 2018 from 10.0.2.2

参考

  • 配置ssh端口转发 https://www.cnblogs.com/lxg0/p/6413965.html
  • 命令行启动虚拟系统 https://www.techrepublic.com/article/how-to-run-virtualbox-virtual-machines-from-the-command-line/

扩展

类似的, 启动jupyter-notebook后在本地浏览器中访问, 注意配置文件

head  /home/zkk/.jupyter/jupyter_notebook_config.py -n 5c.NotebookApp.allow_remote_access = True
c.NotebookApp.open_browser = False
c.NotebookApp.ip = '*'

  1. 启动 jupyter-notebook 后, 获得地址
    http://127.0.0.1:8888/?token=900a226a007628ba70bc760861b0ab6304b3671a38e8a116
  2. 在 visual studio code 可以远程过来运行.
    • 在命令面板中, 输入 Python: Specify Jupyter server URL
    • 把上述的URL地址粘贴进去, 即可.

转载于:https://www.cnblogs.com/bregman/p/9922524.html

Published by

风君子

独自遨游何稽首 揭天掀地慰生平