安裝Vagrant製作測試環境

安裝

Ubuntu22.04安裝Vagrant

1
2
3
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install vagrant

安裝VirtualBox
/etc/apt/sources.list最下面加上這一行

1
deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian jammy contrib

然後下載和註冊public key

1
wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --dearmor --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg

顯示fingerprint,應該要為B9F8 D658 297A F3EF C18D 5CDF A2F6 83C5 2980 AECF

1
gpg --show-keys --with-fingerprint /usr/share/keyrings/oracle-virtualbox-2016.gpg

最後安裝

1
2
sudo apt-get update
sudo apt-get install virtualbox-6.1

建立一個Ubuntu20.04 box

1
2
3
vagrant init ubuntu/focal64
vagrant up
vagrant ssh

x11 forwarding

https://jcook0017.medium.com/how-to-enable-x11-forwarding-in-windows-10-on-a-vagrant-virtual-box-running-ubuntu-d5a7b34363f

共享資料夾

https://developer.hashicorp.com/vagrant/tutorials/getting-started/getting-started-synced-folders

參考:
安裝VirtualBox
https://www.virtualbox.org/wiki/Linux_Downloads

顯示gpg fingerprint
https://superuser.com/a/1747762