

Move into your synced directory, which is “ /vagrant_files” in our example.Open the terminal where the vagrant is running.Configure the database with names and permissions, as discussed above. Rails new your_app_name database = postgresql In your local machine, open a new tab in the same directory as your vagrant file. Creating the applicationĬreating an application from scratch is done in your local machine and not in a vagrant. The database names in this yml file should be the database names of your rails application.įinally, the vagrant environment configuration is complete, and now create your application from scratch. Another important factor to consider is the database names. The alignment of this yml file is very important because it can be read wrongly otherwise. Make sure to have a properly aligned database.yml file and set the database names in this file. In our example, we need to do some installations as below: Now that the virtual machine and vagrant file are up and running, define and install everything you need for developing your application. Once the vagrant file is created, start and ssh into it to be in a completely active yet isolated OS. Thus, the final version of our vagrant file is as follows:

config.vm.provision - defining the virtual environment setup. Thus, the project files can be modified on your computer, and then they will be automatically synced to the virtual machine. config.vm.synced.folder - defining how the guest accesses files in the host. In our case, the host is our computer, and the guest is a virtual machine. Rails applications usually default to port 3000. config.vm.network - defining IP address and ports of application. With this command, you can also manipulate the number of CPUs used. config.vm.provider - defining the base (Virtual Machine). config.vm.box - defining vagrant Operating System. If no modifications are done, the default setup will be used. Five specs in this file can be modified to suit your requirements. Vagrant init ubuntu/trusty64 -initiate vagrant operating systemĪ VagrantFile, which explains the configuration of the vagrant environment, is created with that last command. Now, we need to initiate the use of the vagrant directory as ‘vagrant init’ and the operating system name.Ĭd vagrant_demo -enter into the directory You will also need a base operating system. Creating the vagrant boxĭownload VirtualBox and create a directory. Here, we will build a vagrant on top of a virtualization engine, as VirtualBox. Let’s discuss the process in detail with this blog. If setting up a virtual development environment is your goal, here is a guide on how to utilize the vagrant box and virtual machine for this purpose.
