最近我買了一本名為:DevOps for the Desparate 的書,但無法透過第 1 章練習在 Oracle Virtual Box 中建立虛擬機器。
在第 1 章的初始設定階段,我正在建立:
- Hyper-V Ubuntu 虛擬機
- 在 Ubuntu VM 中,我使用 Vagrant 在 Oracle VirtualBox 中建立另一個 VM
我已經多次進行了練習,但自從我使用創建虛擬機器的命令後就沒有太多運氣了
vagrant up
創建失敗。
我嘗試過以下作業系統
- Ubuntu 18.04 LTS
- Ubuntu 20.04 LTS
- Ubuntu 22.04 LTS
這不在說明中,但是當創建 Hyper-V 映像時,我在 Hyper-V 設定中將硬碟大小調整為 100GB,因為我在運行時總是出現空間不足的情況:
$vagrant up
在 Hyper-V 中調整硬碟大小後,我發現我還需要調整 Linux 分割區的大小,我使用的方法是:
growpart
我成功完成的所有其他步驟,IE:
第十四頁
Set-VMProcessor -VMName 'Ubuntu 20.04 LTS' -ExposeVirtualizationExtensions $true
第二十頁
$git clone https://github.com/bradleyd/devops_for_the_desperate/
第 4 頁 安裝 Vagrant
第 7 頁 安裝 Ansible
當我讀到第 9 頁時,失敗了:
$ vagrant up
我一直收到不同的錯誤,但現在我收到這個錯誤:
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/focal64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/focal64' version '20230719.0.0' is up to date...
==> default: Setting the name of the VM: dftd
==> default: Clearing any previously set network interfaces...
**There was an error while executing `VBoxManage`, a CLI used by Vagrant for controlling VirtualBox. The command and stderr is shown below.
Command: ["hostonlyif", "ipconfig", "vboxnet2", "--ip", "172.28.128.1", "--netmask", "255.255.255.0"]
Stderr: VBoxManage: error: Code E_ACCESSDENIED (0x80070005) - Access denied (extended info not available)
VBoxManage: error: Context: "EnableStaticIPConfig(Bstr(pszIp).raw(), Bstr(pszNetmask).raw())" at line 242 of file VBoxManageHostonly.cpp**
提前致謝。