Skip to content

jersonmartinez/Vagrant

Repository files navigation

Vagrant practices

Basic scenarios on managing virtual machines with Vagrant.


Vagrantfile file generated by default

Initialize the virtual machine with the box: debian/jessie64 to VirtualBox.

Initial instruction

vagrant init -m debian/jessie64

Vagrantfile generated

Vagrant.configure("2") do |config|
    config.vm.box = "debian/jessie64"
end

Basic configurations

Hostname

config.vm.hostname = "jerson-martinez"

For more details, go here: Initial-Debian/

Choosing provider

config.vm.provider "virtualbox" do | vb |
    #Configurations
end

Assign name, memory and cpus

vb.name = "HereWriteTheName"
vb.memory = "512"
vb.cpus = "2"

For more details, go here: ConfigProvidersOnVirtualBox/

Passing the command instructions to the virtual machine

config.vm.provision :shell, inline: "sudo apt-get update && sudo apt-get -y install apache2"

Apply linked clone

vb.linked_clone = true

For more details, go here: LinkedClone/

Forwarded Port (80:8080)

config.vm.network "forwarded_port", guest: 80, host: 8080

For more details, go here: ForwardedPort/

Configure disks

firt_disk   = 'tmp/disk.vdi'
controller  = "SATA Controller"
device      = 0
type        = "hdd"

unless File.exist?(firt_disk)
    vb.customize ['createhd', 
            '--filename',   firt_disk, 
            '--size',       300 * 1024]
end

vb.customize ['storageattach', :id, 
            '--storagectl',      "#{controller}", 
            '--port',            1, 
            '--device',          "#{device}", 
            '--type',            "#{type}", 
            '--medium',          firt_disk]

For more details, go here: ConfigDisk/

Start the image

vagrant up

Install Plugins

RSync Back Bidirectional rsync

vagrant plugin install vagrant-rsync-back

Mode use:

vagrant rsync-back

About

Basic scenarios on managing virtual machines with Vagrant

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy