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. So exit the VM using the command exit ,open the vagrant file in any text editor and then un-comment the following line by removing the # symbol and save it.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. To access the web server from the host (laptop or physical machine), we need to map VM’s port to host’s port in the vagrantfile. The apache2 web server is listening on port 80 on the VM. This is a not a command but a feature to map VM’s port to host’s port. For this tutorial, let’s install apache2 web server sudo -i // change to root user apt-get -y update & apt-get install -y apache2 4. After login, you can install any software like web server or database etc. This command will let you login into the VM with the default credentials via secure shell (ssh). It will pull the box specified in the vagrantfile from Vagrant cloud and starts the machine. Now run the command vagrant up to initialize the VM. but for this tutorial we will not do that. You can also change the network settings, increase RAM etc.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |