You could also do the same with apache2, and create a web server in your virtual environment. Provisioning gives you a powerful tool for pre-configuring your virtual environment. If you use vagrant up and vagrant ssh commands, you should now be able to run nmon for a display of the virtual machine’s resources. That bootstrap file will update the package manager, then install the nmon package. When Vagrant reads the Vagrantfile, it is redirected to read the bootstrap.sh file we just created. It should look as follows: nfigure("2") do |config|Ĭonfig.vm.provision :shell, path: "bootstrap.sh" Next, edit the Vagrantfile and add the provisioning line. ![]() In that file, enter the following: #!/usr/bin/env bash To add a basic resource monitor, nmon, in the guest OS use the command: sudo vi bootstrap.sh If you spent enough in the guest OS, you may have noticed that it does not come loaded with many applications.įortunately, Vagrant supports automatic provisioning through a bootstrap.sh file saved in the same directory as the Vagrantfile. Note: The download page for each box includes a configuration script that you can copy into your Vagrantfile. Once the Vagrantfile is open, change the config.vm.box string from “base” to “ubuntu/trusty64”. Open the Vagrantfile with the command: sudo vi vagrantfileģ. ![]() Next, you need to configure the Vagrantfile for the virtual box it will serve. This downloads the box and stores it locally.Ģ. Instead of using the init command above, you can simply download and add a box with the command: vagrant box add ubuntu/trusty64 ![]() Using a clone speeds up the launching and provisioning process.ġ. The basic unit in a Vagrant setup is called a “box” or a “Vagrantbox.” This is a complete, self-contained image of an operating system environment.Ī Vagrant Box is a clone of a base operating system image. The Vagrantfile is placed in the same directory and can be edited or copied. When you run the init command, Vagrant installs the box to the current directory. If you like, you can browse to and download a Vagrantbox of your choosing. Download the Ubuntu Trusty Tahr distribution from a common library and create a basic Vagrantfile with: vagrant init ubuntu/trusty64 ![]() Start by creating a directory to store your Vagrant file: sudo mkdir vagrant-test cd vagrant-testĢ. Note: If you do not have a virtualization solution, our guides for installing Docker on CentOS or Ubuntu can help.
0 Comments
Leave a Reply. |