[How To] - Create A Local Dev Environment Using Vagrant

A few users have asked for clarification on how to set up a local dev environment using VirtualBox and Vagrant.
Hopefully this tutorial goes some way to help.

2 Likes

Hi, I’ve been trying to set up a local development for ERPNext 9.0 using Vagrant and I’ve saw your post and clicked on the link but there’s not guideline to set up the local development, is there any way else to set the local development environment?

FYI, I’m setting the local development on Virtualbox 5.1.30 and running the host OS with ubuntu 16.04 LTS.

I would try digithink simple version located here:

If that doesn’t work I will upload a Vagrant box to Discover Vagrant Boxes - Vagrant Cloud
Let me know if the linked version works.

I got an error when adding the vagrant box

The error state was “The box ubuntu/zenial32 could not be fond or could not be accessed in the remote catalog”

I can’t read the text on your screen grab and haven’t used DigiThinkIT setup myself…
But have you downloaded the vagrant box into your local project folder with the command
vagrant box add bento/ubuntu-16.04
Once box has downloaded
vagrant up

Also shouldn’t ubuntu/zenial32 be ubuntu/xenial32 ?
I use CentOS7
Sorry but you screen grab is to small for me to read.

I make a typo instead of X I type Z, I’ve tried to download using the command it said it could not be found

It works fine for me.

Create a folder for your project called ~/erpnext
cd ~/erpnext
Make sure vagrant is installed with
vagrant version
Install vbguest with
vagrant plugin install vagrant-vbguest vagrant-notify-forwarder
Once completed add box
vagrant box add bento/ubuntu-16.04
Once completed
choose Virtualbox from the options presented.
vagrant up

I can confirm that vagrant box installer works perfectly
Damm… @DigiThinkIT nicely done.

So full instructions are:
Install vagrant and virtual box
Create a folder for your project called ~/erpnext
cd ~/erpnext
Make sure vagrant is installed with
vagrant version
Install vbguest with
vagrant plugin install vagrant-vbguest vagrant-notify-forwarder
Once completed add the box
vagrant box add bento/ubuntu-16.04
The box will now start to download. Once completed choose Virtualbox from the options presented. When finished
vagrant up
When finished
vagrant ssh
cd frappe-bench
From within this folder you issue all the Bench commands.
bench --help
Will give you an idea of whats available
Create a new site called site1.local
bench new-site site1.local
Download ERPNext
bench get-app erpnext https://github.com/frappe/erpnext
Install ERPNext into your site
bench --site site1.local install-app erpnext
Start frappe/erpnext
bench start
Open a new tab in terminal and
vagrant ssh
cd frappe-bench
Open you web browser and go to
localhost:8000

Sign with User:
Administrator
and the password you chose during setup.

Okay thank you I’ll tried it out, can you provide what version of vagrant and virtualbox?

yep it works all good :slight_smile:
The latest vagrant and virtual box

Okay thank you so much I’ll try it out now

To update erpnext
bench update --reset
From:
https://frappe.io/docs/user/en/bench/resources/bench-commands-cheatsheet.html

error

I followed the instruction you posted when i issue the command “vagrant up” it gave me this error and the vagrantbox i added in the folder created is not in the file

in ~/erpnext enter
vagrant halt
delete vagrant file in ~/erpnext
Download entire digitthinkit github repo into ~/erpnext
in ~/erpnext enter
vagrant up
When complete
vagrant ssh

When i click on the download the file is a zip file right?

If you don’t have a github app then yes. Download as .zip file Unpack and place all the files in ~/erpnext

Ok i follow your instruction remove the vagrant and get the digithink repo file and put all the file in the project folder. But now another error show up

It looks like a virtual box error of some sort???
You did install virtual box app didn’t you?
Open up virtual box app and check to see if there is your ubuntu-16.04 VM is visible

Check that you have ubuntu-16.04 box installed from ~/erpnext
vagrant box list

Check to see you installed vbguest
vagrant plugin install vagrant-vbguest vagrant-notify-forwarder

Then
vagrant up
vagrant ssh