In the VM or out of the VM?

We’ve set this course’s exercises up to work in the virtual machine (VM) that you set up using the vagrant program. If you get logged out of the VM, you may end up typing shell commands in to your regular operating system instead of to the Linux system that we’ve set up for the course. Some commands won’t work, and some files probably won’t be where the course expects them to be.

Getting logged out

If you type the command exit into the shell, or if you type Control-D, you will see a message like this:

logout  
Connection to 127.0.0.1 closed.

This just means that you got logged out. After logging out, you won’t be in the VM any more.

To get back into the VM, use the command vagrant ssh.

If vagrant ssh doesn’t work
If you get a message like this:

VM must be running to open SSH connection. Run `vagrant up`
to start the virtual machine.

This means that the VM program is not running, for instance because you rebooted your computer. This is just fine and it doesn’t mean you’ve lost any work. Just run vagrant up to bring the VM back up, then vagrant ssh to log in.

This will not take as long as the first time you ran it, because it won’t need to download the Linux OS.

If vagrant up doesn’t work

If you get a message like this:

A Vagrant environment or target machine is required to run this
command. Run `vagrant init` to create a new Vagrant environment. Or,
get an ID of a target machine from `vagrant global-status` to run
this command on. A final option is to change to a directory with a
Vagrantfile and to try again.

That means that vagrant can’t find the configuration file you downloaded. Go back to the instructions, check to be sure that you did step 5, and then do step 6 again.

Multiple terminals

If you open up more than one terminal window, only the one(s) that you ran vagrant ssh in will be connected to your Linux OS for this course. The others will be connected to your regular OS.

(It’s actually really normal for Linux users to have to carefully keep track of which terminal windows are connected to which machines. Don’t panic. Just look for whether “vagrant” appears on the command line.)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值