Vagrant: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(39 intermediate revisions by the same user not shown) | |||
Line 7: | Line 7: | ||
==Install== | ==Install== | ||
< | '''MacOS''' | ||
<source lang="bash"> | |||
brew cask install virtualbox | brew cask install virtualbox | ||
brew cask install vagrant | brew cask install vagrant | ||
brew cask install vagrant-manager | brew cask install vagrant-manager | ||
</ | </source> | ||
'''Ubuntu''' | |||
---- | |||
<source lang="bash"> | |||
# wget -qO - vagrant.gpg https://apt.releases.hashicorp.com/gpg\ | |||
# | sudo gpg --dearmor -o /usr/share/keyrings/vagrant-archive-keyring.gpg | |||
# | |||
# sudo echo "deb [arch=$(dpkg --print-architecture)\ | |||
# signed-by=/usr/share/keyrings/vagrant-archive-keyring.gpg]\ | |||
# https://apt.releases.hashicorp.com $(lsb_release -cs) main" > /etc/apt/sources.list.d/vagrant.list | |||
curl -fsSL https://apt.releases.hashicorp.com/gpg\ | |||
| sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg | |||
cat << EOF | sudo tee /etc/apt/sources.list.d/hashicorp.list >/dev/null | |||
deb [arch=$(dpkg --print-architecture)\ | |||
signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg]\ | |||
https://apt.releases.hashicorp.com $(lsb_release -cs) main | |||
EOF | |||
sudo apt update && sudo apt list --upgradeable | |||
sudo apt upgrade && sudo apt install vagrant | |||
vagrant -v | |||
</source> | |||
<source lang="bash"> | |||
sudo apt install -y qemu-kvm virt-manager libvirt-daemon-system virtinst libvirt-clients bridge-utils | |||
sudo systemctl enable --now libvirtd | |||
sudo systemctl start libvirtd | |||
sudo usermod -aG libvirt $USER | |||
sudo usermod -aG kvm $USER | |||
newgrp libvirt | |||
newgrp kvm | |||
</source> | |||
==Syntax== | ==Syntax== | ||
Line 20: | Line 57: | ||
==Example== | ==Example== | ||
< | <source lang="bash"> | ||
vagrant box add hashicorp/precise64 https:// | vagrant box add hashicorp/precise64 https://vagrantcloud.com/hashicorp/boxes/precise64/versions/1.1.0/providers/virtualbox.box | ||
vagrant init hashicorp/precise64 | vagrant init hashicorp/precise64 | ||
vagrant up | vagrant up | ||
vagrant ssh | vagrant ssh | ||
vagrant halt | vagrant halt | ||
</ | vagrant destroy | ||
</source> | |||
==Knowledge== | |||
vagrant box list | |||
vagrant box outdated | |||
sudo apt install -y cpu-checker | |||
kvm-ok | |||
'''virtualbox before start''' | |||
sudo systemctl disable --now libvirt-guests.service | |||
sudo systemctl disable --now virtlogd.service | |||
sudo systemctl disable --now libvirtd.service | |||
sudo systemctl disable --now virtlogd-admin.socket | |||
sudo systemctl disable --now virtlogd.socket | |||
sudo systemctl disable --now libvirtd-admin.socket | |||
sudo systemctl disable --now libvirtd-ro.socket | |||
sudo systemctl disable --now libvirtd.socket | |||
sudo systemctl enable --now virtualbox.service | |||
==References== | ==References== | ||
{| | |||
| valign="top" | | |||
* [https://support.microsoft.com/en-us/help/926139/windows-powershell-1-0-english-language-installation-packages-for-wind Windows PowerShell 1.0 for Windows Server 2003 & Windows XP] | |||
* [https://support.microsoft.com/en-us/help/968929/windows-management-framework-windows-powershell-2-0-winrm-2-0-and-bits Windows PowerShell 2.0, WinRM 2.0, and BITS 4.0] | |||
* [https://superuser.com/questions/529149/how-to-compact-virtualboxs-vdi-file-size How to compact VirtualBox's VDI file size?] | |||
* [https://superuser.com/questions/391509/files-to-remove-from-windows-xp-to-save-space How to optimized Windows XP size?] | |||
* [http://emoxter.com/post/creating-a-windows-xp-vagrant-box/ Creating a Windows XP Vagrant box] | |||
* [https://app.vagrantup.com/boxes/search?utf8=%E2%9C%93&sort=&provider=virtualbox&q=windows+xp Discover Vagrant Boxes] | * [https://app.vagrantup.com/boxes/search?utf8=%E2%9C%93&sort=&provider=virtualbox&q=windows+xp Discover Vagrant Boxes] | ||
* [https://www.vagrantup.com/intro/vs/terraform.html Vagrant vs. Terraform] | * [https://www.vagrantup.com/intro/vs/terraform.html Vagrant vs. Terraform] | ||
* [https://www.vagrantup.com/docs/boxes/base.html Creating a Base Box] | |||
* [http://www.vagrantbox.es/ A list of base Boxes] | * [http://www.vagrantbox.es/ A list of base Boxes] | ||
* [https://app.vagrantup.com/rogeriopradoj/boxes/xp-ie8 Example Vagrantfile] | * [https://app.vagrantup.com/rogeriopradoj/boxes/xp-ie8 Example Vagrantfile] | ||
| valign="top" | | |||
* [https://www.linuxtechi.com/how-to-install-kvm-on-ubuntu-22-04/ Install KVM on Ubuntu 22.04] | |||
* [https://www.vagrantup.com/intro/vs/terraform Vagrant vs. Terraform] | |||
* [https://www.vagrantup.com/intro/vs/cli-tools Vagrant vs. CLI Tools] | |||
* [https://www.vagrantup.com/intro/vs/docker.html Vagrant vs. Docker] | * [https://www.vagrantup.com/intro/vs/docker.html Vagrant vs. Docker] | ||
* [https://www.vagrantup.com/downloads Download Vagrant] | |||
* [https://github.com/WinRb/vagrant-windows Vagrant Windows] | |||
* [https://www.vagrantup.com/intro/getting-started/index.html Getting Started] | * [https://www.vagrantup.com/intro/getting-started/index.html Getting Started] | ||
* [https://gist.github.com/kuznero/576e848c39080745ac1915c6b3e4820b Compact VDI] | |||
* [https://www.qemu.org/docs/master/about/index.html About Qemu] | |||
* [[Terraform]] | |||
| valign="top" | | |||
* [https://superuser.com/questions/614941 Vagrant fails to create box with <code>libvirt</code>] | |||
* [https://www.vagrantup.com/docs/providers/installation Vagrant Providers Installation] | |||
* [https://www.vagrantup.com/docs/providers Vagrant Providers] | |||
* [https://askubuntu.com/questions/138140/ Install Qemu] | |||
* [https://www.vagrantup.com/docs/cli/box Vagrant Box] | |||
* [[VirtualBox]] | |||
* [[Multipass]] | |||
* [[Proxmox]] | |||
* [[Qemu]] | |||
* [[Juju]] | |||
|- | |||
| valign="top" colspan="3" | | |||
---- | |||
|- | |||
| valign="top" | | |||
| valign="top" | | |||
| valign="top" | | |||
|} |
Latest revision as of 23:26, 28 November 2023
Info
brew cask info virtualbox
brew cask info vagrant
brew cask info vagrant-manager
Install
MacOS
brew cask install virtualbox
brew cask install vagrant
brew cask install vagrant-manager
Ubuntu
# wget -qO - vagrant.gpg https://apt.releases.hashicorp.com/gpg\
# | sudo gpg --dearmor -o /usr/share/keyrings/vagrant-archive-keyring.gpg
#
# sudo echo "deb [arch=$(dpkg --print-architecture)\
# signed-by=/usr/share/keyrings/vagrant-archive-keyring.gpg]\
# https://apt.releases.hashicorp.com $(lsb_release -cs) main" > /etc/apt/sources.list.d/vagrant.list
curl -fsSL https://apt.releases.hashicorp.com/gpg\
| sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
cat << EOF | sudo tee /etc/apt/sources.list.d/hashicorp.list >/dev/null
deb [arch=$(dpkg --print-architecture)\
signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg]\
https://apt.releases.hashicorp.com $(lsb_release -cs) main
EOF
sudo apt update && sudo apt list --upgradeable
sudo apt upgrade && sudo apt install vagrant
vagrant -v
sudo apt install -y qemu-kvm virt-manager libvirt-daemon-system virtinst libvirt-clients bridge-utils
sudo systemctl enable --now libvirtd
sudo systemctl start libvirtd
sudo usermod -aG libvirt $USER
sudo usermod -aG kvm $USER
newgrp libvirt
newgrp kvm
Syntax
vagrant box add {title} {url}
vagrant init {title}
Example
vagrant box add hashicorp/precise64 https://vagrantcloud.com/hashicorp/boxes/precise64/versions/1.1.0/providers/virtualbox.box
vagrant init hashicorp/precise64
vagrant up
vagrant ssh
vagrant halt
vagrant destroy
Knowledge
vagrant box list vagrant box outdated
sudo apt install -y cpu-checker kvm-ok
virtualbox before start sudo systemctl disable --now libvirt-guests.service sudo systemctl disable --now virtlogd.service sudo systemctl disable --now libvirtd.service sudo systemctl disable --now virtlogd-admin.socket sudo systemctl disable --now virtlogd.socket sudo systemctl disable --now libvirtd-admin.socket sudo systemctl disable --now libvirtd-ro.socket sudo systemctl disable --now libvirtd.socket sudo systemctl enable --now virtualbox.service