Skip to main content

Managing a Vagrant Environment

Hands-On Lab

 

Photo of Elle Krout

Elle Krout

Content Team Lead in Content

Length

00:30:00

Difficulty

Beginner

Vagrant lets us provision development environments quickly and easily through code and the command line. One benefit of this is that it allows us to turn off our guest hosts so we can better manage our system resources. In this hands-on lab, we spend some time making changes to our Vagrant environment, before shutting it down for the day.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Managing a Vagrant Environment

Introduction

In this hands-on lab, we spend some time making changes to our Vagrant environment, before shutting it down for the day.

Solution

Begin by logging in to the lab server using the credentials provided on the hands-on lab page:

ssh cloud_user@PUBLIC_IP_ADDRESS

Update the Guest

  1. Move into the directory with:

    cd lxc-env/
  2. Start the container:

    vagrant up
  3. Log in to the container:

    vagrant ssh
  4. Update the guest:

    sudo apt-get update
    sudo apt-get upgrade -y
  5. Log out of the container:

    exit

    Reboot the Guest

  6. Reboot the guest:

    vagrant reload
  7. Access the guest again, then install the needed packages:

    vagrant ssh
    sudo apt-get install nodejs npm -y
  8. Log out of the container:

    exit

    Stop the Guest

  9. When finished, stop the guest:

    vagrant halt

Conclusion

Congratulations - you've completed this hands-on lab!