- Vagrant
- To download and store a box (OS) to your system
- To initialize Vagrant projects (jasonc/centos is repo name on vagrant)
- To import the box into VirtualBox and start it
- To connect to vagrant vm via ssh
- To stop vm
- to suspend vagrant vm
- To resume Vagrant vm
- Check status of vm
- To delete a VM
- Vagrant file example
vagrant box add jasonc/centos7vagrant init jasonc/centos7vagrant up # Will start all vagrant vms
vagrant up --provider virtualbox
vagrant up [VM_NAME] # VM_NAME is the one defined in the Vagrantfilevagrant ssh # Works if there is a single vm
vagrant ssh [VM_NAME] # Default user: vagrant password: vagrant (same for root account)
exit # To exit sshvagrant halt # Halt all vms
vagrant halt [VM_NAME] # Halt specified vmvagrant suspend [VM_NAME]vagrant resume [VM_NAME]vagrant statusvagrant destroy [VM_NAME]Vagrant.configure(2) do |config|
config.vm.box = "jason/centos7" # Which OS to install
config.vm.hostname = "linuxsvr1" # Hostname of the VM
config.vm.network "private_network", ip: "10.2.3.4" # Assign static ip to VM
config.vm.provider "virtualbox" do |vb| # Which virtualization software to use
vb.gui = true # Whether to use headless mode (no GUI only command line) or not
vm.memory = "1024" # How much memory to allocate to vm
end
config.vm.provision "shell"/, path: "setup.sh" # Provisioning allows you to automatically install software (Uploads setup.sh to vm and executes it)
end