티스토리 뷰

728x90
반응형

Kali Linux를 설치하기 위해서 저는 vagrant를 사용했습니다. 이게 제일 설치하기 쉽고 편하기 때문인데요.

그래서 vagrant 사용법을 배우기 위해서 아래 링크에 방문했습니다.

https://app.vagrantup.com/kalilinux/boxes/rolling

 

위 링크에서는 아래와 같이하면 Kali Linux를 매우 쉽게 설치할 수 있다고 설명하고 있습니다.

vagrant init kalilinux/rolling
vagrant up

일단 vagrant init kalilinux/rolling 명령을 수행하게 되면 Vagrantfile 이라는 걸 만들어줍니다.

C:\Users\Domdomi\kalilinux> vagrant init kalilinux/rolling
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

Vagrantfile 내용물에는 아래와 같은 내용을 자동으로 생성해줍니다.

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
  # The most common configuration options are documented and commented below.
  # For a complete reference, please see the online documentation at
  # https://docs.vagrantup.com.

  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://vagrantcloud.com/search.
  config.vm.box = "kalilinuxrolling"

  # Disable automatic box update checking. If you disable this, then
  # boxes will only be checked for updates when the user runs
  # `vagrant box outdated`. This is not recommended.
  # config.vm.box_check_update = false

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine.
  # NOTE: This will enable public access to the opened port
  # config.vm.network "forwarded_port", guest: 80, host: 8080

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine and only allow access
  # via 127.0.0.1 to disable public access
  # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  # config.vm.network "private_network", ip: "192.168.33.10"

  # Create a public network, which generally matched to bridged network.
  # Bridged networks make the machine appear as another physical device on
  # your network.
  # config.vm.network "public_network"

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  # config.vm.synced_folder "../data", "/vagrant_data"

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  # Example for VirtualBox:
  #
  # config.vm.provider "virtualbox" do |vb|
  #   # Display the VirtualBox GUI when booting the machine
  #   vb.gui = true
  #
  #   # Customize the amount of memory on the VM:
  #   vb.memory = "1024"
  # end
  #
  # View the documentation for the provider you are using for more
  # information on available options.

  # Enable provisioning with a shell script. Additional provisioners such as
  # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the
  # documentation for more information about their specific syntax and use.
  # config.vm.provision "shell", inline: <<-SHELL
  #   apt-get update
  #   apt-get install -y apache2
  # SHELL
end

이 상태에서 Vagrantfile 이 존재하는 곳에서 다시 vagrant up 이라는 명령어를 입력하게 되면 아래와 같은 오류가 나는데요.

C:\Users\Domdomi\kalilinux>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'kalilinux/rolling'...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["import", "\\\\?\\C:\\Users\\Domdomi\\.vagrant.d\\boxes\\kalilinux-VAGRANTSLASH-rolling\\2021.1.0\\virtualbox\\box.ovf", "--vsys", "0", "--vmname", "packer-virtualbox-iso-1614012676_1656435147778_67776", "--vsys", "0", "--unit", "10", "--disk", "C:/Users/ABCDEF/VirtualBox VMs/packer-virtualbox-iso-1614012676_1656435147778_67776/packer-virtualbox-iso-1614012676-disk001.vmdk"]

Stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interpreting \\?\C:\Users\Domdomi\.vagrant.d\boxes\kalilinux-VAGRANTSLASH-rolling\2021.1.0\virtualbox\box.ovf...
OK.
0%...
Progress state: E_INVALIDARG
VBoxManage.exe: error: Appliance import failed
VBoxManage.exe: error: Code E_INVALIDARG (0x80070057) - One or more arguments are invalid (extended info not available)
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleImportAppliance(struct HandlerArg *)" at line 1118 of file VBoxManageAppliance.cpp

 

일단 해당 오류는 VirtualBox 설정에 문제가 있어서 발생한 오류입니다. 위 오류 내용을 유심히 살펴보면 알겠지만, "--disk", 다음에 나오는 문자열이 C:/Users/ABCDEF/VirtualBox VMs/.... 으로 시작하는데 여기서 ABCDEF 라는 폴더가 존재하지 않기 때문에 vagrant 에서는 존재하지 않는 경로의 파일을 읽어오려고 하였기 때문에 오류가 나는 것입니다.

 

이 문제를 해결해주기 위해서는 VirtualBox 에서 파일(File) -> 환결설정(Preferences) -> 기본 머신 폴더(Default Machine Folder) 에 있는 값을 존재하는 유의미한 경로로 변경해주면 됩니다.

 

그렇게 정상적인 경로로 변경해주고 나서 다시 vagrant up 명령을 수행해주면 Kali Linux 가 VirtualBox 에 정상적으로 설치가 되고 실행되는 것을 볼 수 있습니다.

 

- 끝 -

728x90
반응형
댓글