Skip to content

Vagrant Virtual Machine Environment

Akshay Kumar edited this page Jul 5, 2023 · 2 revisions

Get started with Uvdesk now by using Vagrant to easily create a virtual environment.

To setup a virtual machine, create & navigate to a new project directory, and run the following command:

$ vagrant init uvdesk/uvdesk --box-version 1.1

This command will create a Vagrantfile that we can then use to setup and configure our virtual machine. Before proceeding further with creating our virtual machine, we will go ahead and define the local IP in our network that will be used to access the environment within the Vagrantfile.

config.vm.network "public_network", ip: "xxx.xxx.xx.xx"

Creating Virtual Machine

We can now go ahead and create our virtual machine to load our project. To create a virtual machine, simply use the following command:

$ vagrant up

While the virtual machine is being setup, you might be prompted to provide a few default configurations details. Simply follow along with the instructions as prompted, and your virtual machine will be setup accordingly. Upon successfull configuration of the virtual machine, you will get the following output:

==> default: Machine booted and ready!

Note: When prompted to select from the available network interfaces, select the one that's part of your local network and which is being used to connect with the internet.

vagrant-overview

Once your virtual machine is up and running, you can simply use the SSH command to gain access to your machine's bash terminal (just like you would access a normal remote server).

$ ssh vagrant@xxx.xxx.xx.xx

Default Configurations

While creating and setting up the virtual machine, the machine is setup using default configurations that's defined in the Vagrantfile. For example, the default username (vagrant) & password (vagrant) that's used for configuring the machine. To change these machine access credentials, simply edit the Vagrantfile and modify the following lines as per your preference:

config.ssh.username = "uvdesk"
config.ssh.password = "uvdesk"

Note: If you wish to use different credentials, it's important that you first create the virtual machine using the default credentials, and only then modify your Vagrantfile with the new credentials otherwise you'll run into issue while the machine is being setup initially.

After modifying your Vagrantfile, simply use the following commands to reload your machine for the new changes to take effect:

$ vagrant reload

Cleaning Up

Once you've setup and explored the project by creating a virtual machine using vagrant, you can simply destory the environment using the following command:

$ vagrant destroy