编程学习网 > PHP技术 > php中级 > Vagrant入门——启动并建立SSH连接(up and ssh)
2014
11-07

Vagrant入门——启动并建立SSH连接(up and ssh)

It is time to boot your first guest machine. Run the following:

$ vagrant up

In less than a minute, this command will finish and you'll have a virtual machine running Ubuntu. You won't actually see anything though, since Vagrant runs the virtual machine without a UI. To prove that it is running, you can SSH into the machine:

$ vagrant ssh

This command will drop you into a full-fledged SSH session. Go ahead and interact with the machine and do whatever you want. Although it may be tempting, be careful about rm -rf /, since Vagrant shares a directory at /vagrant with the directory on the host containing your Vagrantfile, and this can delete all those files. Shared folders will be covered in the next section.

Take a moment to think what just happened: With just one line of configuration and one command in your terminal, we brought up a fully functional, SSH accessible virtual machine. Cool.

When you're done fiddling around with the machine, run vagrant destroy back on your host machine, and Vagrant will remove all traces of the virtual machine.

扫码二维码 获取免费视频学习资料

Python编程学习

查 看2022高级编程视频教程免费获取