MacOS – Install Vagrant

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ brew install vagrant
copy & install : https://releases.hashicorp.com/vagrant/2.2.18/vagrant_2.2.18_x86_64.dmg
$ sudo "/Library/Application Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh" restart
— Create VM Ubuntu 20.04
$ cd /VirtualBox/
$ mkdir ubuntu
$ cd /VirtualBox/ubuntu

$ vagrant init ubuntu/focal64
$ vagrant up
— Create VM Kali Linux
$ cd /VirtualBox/
$ mkdir kali
$ cd /VirtualBox/kali

$ vagrant init kalilinux/rolling
$ vagrant up
Vagrant CLI :
————-
1. Create Vagrantfile
$ vagrant init
2. Start VM
$ vagrant up
3. Stop VM
$ vagrant halt
4. Restart VM
$ vagrant reload
5. Delete VM
$ vagrant destroy
6. Backup VM
$ vagrant snapshot push
$ vagrant snapshot list
7. Restore VM
$ vagrant snapshot restore snapshot-id
$ vagrant snapshot list
8. Remote VM
$ vagrant ssh
Vagrant sending file from Host OS to Guest VM using scp
——————————
$ vagrant plugin install vagrant-vbguest
$ vagrant plugin install vagrant-scp
$ vagrant reload
$ vagrant provision
$ vagrant scp local_file_path_in_HostOS :remote_file_path_in_GuestOS
ex:
$ vagrant scp abc.txt :destFile.txt
———–
Problem :
suplibOsInit what: 3 VERR_VM_DRIVER_NOT_INSTALLED (-1908) - The support driver is not installed. On linux, open returned ENOENT.
Solution :
1. run
$ sudo kextload -b org.virtualbox.kext.VBoxDrv
2. Go into System Preferences->Security & Privacy
3. If the left-bottom icon is locked, unlock it with a password.
4. Clicks “Allow” for the developer Oracle America, Inc.
5. Run following commands in Terminal immediately you switch on Mac.
$ sudo kextload -b org.virtualbox.kext.VBoxNetFlt
$ sudo kextload -b org.virtualbox.kext.VBoxNetAdp
$ sudo kextload -b org.virtualbox.kext.VBoxUSB
6. Reboot
7. try again vagrant up
———–
Problem :
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine
Solution :
1. Changed “gui” instead “headless” in Vagrantfile.
$ vi Vagrantfile
config.vm.provider "virtualbox" do |v|
  v.gui = true
end
2. Run following commands in Terminal immediately you switch on Mac.
$ sudo kextload -b org.virtualbox.kext.VBoxDrv;
$ sudo kextload -b org.virtualbox.kext.VBoxNetFlt;
$ sudo kextload -b org.virtualbox.kext.VBoxNetAdp;
$ sudo kextload -b org.virtualbox.kext.VBoxUSB;
3. After that run vagrant up and it boots well.
https://app.vagrantup.com/boxes/search?page=4&provider=&q=ubuntu&sort=downloads&utf8=✓


Posted

in

Tags: