通常我已经在本地(在我自己的机器上)开发并推送到需要通过映射驱动器,ftp,github等的任何地方。我已经做了一些与vagrant / virtualbox的工作(但同样,本地)与共享/镜像文件夹。
我现在处于这样的情况:每个人都可以访问他们自己的开发箱(网络上的虚拟机)。我相信,我看到一些人通过SSH直接在Vim工作,但我还没有。所以我留下了一个问题:对于(更多的前端人)来说,最好的方法是什么?
我听说过从我的工作站安装SSH安装程序......如果这是可行的。我很好奇每个人对这种环境的看法是什么(也许)是最好的做法。提示,链接和阅读也非常受欢迎和赞赏......任何指向良好方向的人都会很精彩。
谢谢。
答案 0 :(得分:4)
The best answer will come from what virtual resources do you want to capitalize on for the virtual networked VMs. If you just want the storage space, then share the VM's drives, and mount them locally, treat them as local, end of story. If you want to run all the processing on the remote machine, and connect from a thin client, you have a couple of options, but they all take the same form. Connect to the machine, edit the files on the remote machine. Depending on your OS, you will have different options available.
If the remote machine doesn't have an graphical client installed you are stuck with either, mounting the remote share locally (you can use whatever editor you want) or ssh to the remote machine and using a commandline editor (vim, nano, emacs).
If there is a graphical client installed you have more options:
Remote in the server using any visual viewer (mstsc for windows, vnc is an option), and then use any remotely installed editor of your choice.
Remote in using ssh -X, and then run the remotely installed editor. Assuming you have an X-Server locally (if you are running linux you already do), the GUI part of the application will be run on the client side of the ssh tunnel, and the process will be run on the server. This is probably the best option.
So:
ssh -X
to that serversubl
, geany
, or other to start the application.答案 1 :(得分:1)
SSH安装确实允许您使用VM上的所有文件,就像它们存储在本地计算机中一样,让您可以编辑和更新文件,而无需在每次执行更改时手动复制它们。但是你会遇到一个减速带,因为每次更换文件都必须同步/复制到你的远程机器上,这需要几秒钟。通过DigitalOcean检查this帖子,他们解释了如何使SSH挂载工作。
您拥有的更好的选择(恕我直言)是在保存后或通过手动操作时使用IDE in your local machine that allows you to push changes到服务器。这将允许您通过使用本地资源(本地Web服务器)更快地开发,因为不必通过网络将文件复制到远程VM;并且还允许您在需要时通过在准备好在该环境上进行测试时上载文件来测试该远程VM。
PS:将远程计算机上的可视应用程序或环境导出到本地计算机或环境可能很慢(取决于您的网络和运行计算机的VM主机负载)。如果您仍然喜欢这种方法,那么您还可以安装一些东西来访问该VM,使其更加标准和轻量级,如RDP for GNU / Linux(xrdp)。