▶ VirtualBox

오픈소스 프로젝트를 너무나 애정하는 입장에서 오랫동안 VM 도구는 VirtualBox를 애용하고 있던 중,

VirtualBox가 2008년도에 `썬 마이크로시스템즈(Sun Microsystems)`에 인수되어 살짝 불안감이 생겼었고

2010년도에는 `오라클(Oracle)`에서 `썬 마이크로시스템즈`를 인수하면서 불안감이 증폭되었었다.

 

VirtualBox는 현재 기본 패키지는 GPLv2 라이선스로 배포를 하고 있지만

역시나 오라클은 `Extension Pack`에 대해서 PUEL 라이선스를 적용해버렸다.

 

개인 사용 및 교육용으로는 무료로 사용 가능하지만, 회사에서는 사용할 수 없는 것이다.

  - https://www.virtualbox.org/wiki/VirtualBox_PUEL

 

VirtualBox 기본 플랫폼만으로도 어느 정도 사용 가능하지만,

`Extension Pack`을 설치해야 화면해상도, 공유폴더, USB3.0 지원 및 원격접속 등 많은 기능이 추가된다.

 

집에서 `Extension Pack(Guest Additions)`을 설치한 상태에서 사용하다가

회사에서 기본 패키지만 가지고 VirtualBox를 사용하면 정말 정말 불편하다.

 

 

▶ VMware Workstation

VMware가 2023년에 Broadcom에 인수되면서 Enterprise 라이선스 정책을 변경하면서

많은 회사에서 VMware를 걷어내고 OpenStack과 같은 솔루션으로 갈아타고자 노력하고 있다.

당연히 금액적으로 엄청난 인상을 한 것과 같은 희한한(나쁜!) 라이선스 정책을 도입했기 때문이다.

 

그런데, 의외로 개인 PC용 제품인 Fusion, Workstation을 무료로 배포를 해버렸다 !!!

  - https://blogs.vmware.com/cloud-foundation/2024/11/11/vmware-fusion-and-workstation-are-now-free-for-all-users/

 

의외로 이를 모르는 사람들이 꽤 많다는 것이 신기하다.

container 세상이 되어버려서 VM 인기가 확 식어버려서인가?!

 

 

집과 회사에서 같은 VM 솔루션을 이용하기 위해 이제는 VirtualBox를 버리고

VMware Workstation으로 갈아타보려한다.

 

 

▶ VMware Workstation Pro

VMware 홈페이지를 방문하면 솔루션 정보를 찾는 것이나 다운로드 받는 것, 심지어 회원 가입하는 것도 쉽지 않다.

Broadcom 특성이려나!? (그렇다. 나는 Broadcom에 반감이 있다. ESXi 라이선스 정책 변경으로 개고생을 ㅠㅠ)

 

처음 방문하는 분은 아래 경로 찾는 것도 쉽지 않을 것이다.

  - https://www.vmware.com/products/desktop-hypervisor/workstation-and-fusion 

 

무료로 다운로드 받을 수 있다고 했지만, 회원 가입이 필요 없다고는 하지 않았다!

그렇다. 다운로드 받으려면 로그인(회원가입)이 필요하다.

  - https://profile.broadcom.com/web/registration 

 

회원가입 및 로그인 후에 Free Downloads 페이지에서 `workstation`을 검색해야 한다.

  - https://support.broadcom.com/group/ecx/free-downloads 

 

Free 배포를 하게 되면서 더이상 개발을 하지 않을까 살짝 의심했지만,

그래도 26H1 버전까지 꾸준히 업데이트는 해주고 있다.

 

원하는 버전 선택 후 다운로드 받으면 된다.

 

설치 과정은 그냥 다운로드 받은 파일을 실행하면 된다. 설명까지 필요한 내용은 없다.

 

응!? 설치관련 포스팅인데 정작 설치에 대한 내용은 별게 없네!? ^^

 

반응형

간만에 VirtualBox 관련 포스팅을 해본다 ^^

 

Host OS: Windows 11

Guest OS: Ubuntu 20.04

VirtualBox: 버전 7.1.4 r165100 (Qt6.5.3)

 

부팅할 때의 화면이다.

사용에는 별다른 이슈는 없는 상태이다.

 

 

GuestOS 켤 때마다 나오는 마음에 들지 않는 메시지를 전부 없애고 싶다!!!

 

RDRAND gives funky smelling output, might consider not using it by booting with "nordrand"

 

AMD CPU 사용에 따른 문제인 것으로 보이는데, 아직 명확한 해결법을 찾지 못해서 지금은 Skip!!!

어짜피 사용에 있어서는 문제가 없는 것이기에...

 

 

그럼 다음 문제를 살펴보자.

 

VirtualBox Error 'drm:vmw_host_printf [vmwgfx]] *ERROR* Failed to send host log message'

 

 

이건 확실히 에러 메시지다!

디스플레이 설정을 바꿔주면 해결이 된단다.

 

 

"VBoxVGA"로 설정을 바꿔주면 된단다.

경고 메시지가 보이기는 하는데, 필요에 따라 사용할 수 있는 옵션이기에 그냥 선택하면 된다.

 

 

확실히 사라졌다!!!

 

반응형

 

1대의 개발PC에서

여러 대의 Server 환경을 구축하고자 할 때 VirtualBox를 이용하곤 한다.

 

VirtualBox

 

Kubernetes 실습 환경을 구축하기 위해서

master 1대 + worker 2대 = 총 3대의 Ubuntu Server 머신이 필요한 경우를 생각해보자.

 

개인적인 취향으로 Ubuntu를 애용하는데,

Ubuntu를 설치하고 나면 locale 설정, timezone 설정 等 나름 여러가지로 셋팅을 할 것들이 많다.

 

그렇게 우선 master 역할을 할 1대의 Ubuntu Server를 셋팅을 했다고 해보자.

- https://www.whatwant.com/entry/Ubuntu-Server-2204-LTS

 

이제 worker 역할을 할 2대의 Ubuntu Server를 만들어야 하는데,

다시 또 OS 설치하고 셋팅하는 과정을 반복해야하는 것은 너무나 비효율적인 것 같다.

 

그래서 VirtualBox의 머신 복제 기능을 이용해보고자 한다.

 

복제

 

좀 더 많은 정보를 보려면 "전문가 모드"를 선택하면 된다.

원하는 머신 이름과 경로(Path)를 입력하고, MAC 정책은 새로운 MAC 주소 설정을 하도록 하자.

 

설정

 

이걸로 준비는 끝났다.

"Finish"를 눌러주면 복사가 이뤄진다. 생각보다 오래걸린다(개인적인 PC 환경 차이일 수도 있다^^).

 

Finish

 

이것으로 끝났을까!? 아니다!!!

일단 시작해서 부팅해보자.

 

부팅

 

여기에서 어떤 것이 문제가 될 수 있는지 찾아보기 바란다! ^^

 

$ hostname

master

 

그렇다! 원본과 같은 hostname을 쓰고 있다.

그러면 바꿔주면 된다 ^^

 

$ sudo hostnamectl set-hostname worker01

$ hostname

worker01

 

여기까지~

 

반응형

 

지금까지 Vagrant 공부 내용

- Vagrant 이미지 업로드 (VirtualBox)

- Vagrant 사용하기 - 기본

 

 

지금 Vagrant를 이렇게 정리하면서 공부하는 이유는

Kubernetes 실습 환경 구축을 Vagrant를 이용해서 편하게 VirtualBox로 띄우고 싶어서이다.

 

최소한 "Master 1대 + Worker 2대 = 3대", 또는 "Master 1대 + Worker 3대 = 4대"

구성을 하고자 하는데 앞에서 알아본 Vagrantfile은 VM 1대 구성밖에 안되는 내용이었다.

 

그래서 이번에는 여러개의  VM을 생성하는 Vagrantfile에 대해서 알아보고자 한다.

 

 

지난 포스팅에서 작성해보았던 Vagrantfile을 살펴보면 다음과 같다.

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

Vagrant.configure("2") do |config|

  config.vm.box = "whatwant/Ubuntu-20.04-Server"
  config.vm.box_version = "0.1.0"

  config.vm.network "public_network", ip: "192.168.100.201"

  config.vm.provider "virtualbox" do |vb|
    vb.gui = false
    vb.cpus = "2"
    vb.memory = "2048"
  end

  config.vm.provision "shell", inline: <<-SHELL
    apt-get update
    apt-get upgrade -y
  SHELL

end

 

그러면 여러개의 VM을 정의하는 Vagrantfile은 어떻게 생겼을까?

 

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

N = 2


Vagrant.configure("2") do |config|


  config.vm.define "w-k8s-master" do |cfg|

    cfg.vm.box = "whatwant/Ubuntu-20.04-Server"
    cfg.vm.box_version = "0.2.0"

    cfg.vm.hostname = "master"
    cfg.vm.network "public_network", ip: "192.168.100.200"

    cfg.vm.provider "virtualbox" do |vb|
      vb.gui = false
      vb.cpus = "2"
      vb.memory = "2048"
    end

    cfg.vm.provision "shell", inline: <<-SHELL
      apt-get update
      apt-get upgrade -y
    SHELL

  end


  (1..N).each do |i|
    config.vm.define "w-k8s-worker#{i}" do |cfg|

      cfg.vm.box = "whatwant/Ubuntu-20.04-Server"
      cfg.vm.box_version = "0.2.0"

      cfg.vm.hostname = "worker#{i}"
      cfg.vm.network "public_network", ip: "192.168.100.20#{i}"

      cfg.vm.provider "virtualbox" do |vb|
        vb.gui = false
        vb.cpus = "1"
        vb.memory = "1024"
      end

      cfg.vm.provision "shell", inline: <<-SHELL
        apt-get update
        apt-get upgrade -y
      SHELL

    end
  end


end

 

더 이상 설명할 것이 없을 것 같다.

위의 2개 Vagrantfile을 비교해보면서 살펴보면 될 것 같다.

 

`N = 2` 값을 통해 아래 순환문을 컨트롤 하고...

`#{i}` 값을 통해서 숫자를 변수처럼 할당해서 hostname이나 ip값을 지정해주었다.

 

 

 

별도의 디렉토리를 생성한 뒤

위와 같은 `Vagrantfile`을 작성하고

`vagrant up` 명령어로 실행하면 간단하게 VM이 3개가 생성된다.

 

 

다만, 지난 번부터 `vagrant up` 실행했을 때 오류 메시지와 함께 실패를 종종 경험하게 되어 아쉬운 점은 있다.

다시 `vagrant up`을 하면 성공하기도 하고, 여러번 실행해야 성공하기도 하고

때로는 `vagrant destroy`로 전부 삭제 뒤, 다시 `vagrant up`을 해야하기도 했다.

 

 

밑의 3개 VM이 vagrant로 생성된 아이들이다.

 

반응형

 

Vagrant를 이용해서 VirtualBox에 설치할 이미지 만들기 및 등록까지 했으니

  - https://www.whatwant.com/entry/Vagrant-Box

 

이제는 실제 사용을 해보자.

 

 

01. create Workspace

  - Vagrant 사용을 위해서는 제일 먼저 작업을 실행할 Directory를 하나 만들어야 한다.

  - Workspace 하나 만든다고 생각하면 될 것 같다.

 

> mkdir vagrant-hello

    디렉터리: C:\Users\whatw\workspace

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----      2021-07-14   오후 2:00                vagrant-hello



> cd .\vagrant-hello\

 

 

02. init

  - Workspace 안에서 init 작업을 하면 된다.

  - `init` 뒤에는 사용할 이미지 주소를 적어주면 된다.

> vagrant init whatwant/Ubuntu-20.04-Server

==> vagrant: A new version of Vagrant is available: 2.2.17 (installed version: 2.2.16)!
==> vagrant: To upgrade visit: https://www.vagrantup.com/downloads.html

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.


> dir

    디렉터리: C:\Users\whatw\workspace\vagrant-hello

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----      2021-07-14   오후 2:04           3104 Vagrantfile

 

03. check Vagrantfile

  - `init`을 하면 `Vagrantfile`을 생성해준다.

  - 첫 줄을 보면 알겠지만, ruby 포맷이다..... ㅠㅜ

 

# -*- 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 = "whatwant/Ubuntu-20.04-Server"

  # 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

 

04. check IP

  - 이 부분은 필요하신 분들만 선택적으로 하면 된다.

  - Why : 이 부분을 진행하는 이유는 다음과 같다.

    . 집에서 공유기를 사용하고 있음

    . VirtualBox에서 Ubuntu를 여러개를 실행할 계획인데,

    . 서로 간의 통신을 구성하기 위해서 각 Ubuntu의 IP를 고정하고 싶음

 

  - 공유기에서 비어있는 IP를 확인해놓자

 

 

  - 각자의 공유기에 따라 관리 페이지 들어가서 현재 할당되어 있는 IP 내역 확인하고,

  - 나중에 MAC 주소에 따른 IP 할당 설정을 해보자.

 

 

05. edit Vagrant

  - 리소스 포함해서 원하는 VM 모습으로 설정해보자

 

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

Vagrant.configure("2") do |config|

  config.vm.box = "whatwant/Ubuntu-20.04-Server"
  config.vm.box_version = "0.1.0"

  config.vm.network "public_network", ip: "192.168.100.201"

  config.vm.provider "virtualbox" do |vb|
    vb.gui = false
    vb.cpus = "2"
    vb.memory = "2048"
  end

  config.vm.provision "shell", inline: <<-SHELL
    apt-get update
    apt-get upgrade -y
  SHELL

end

 

 

06. Vagrant Up

  - 실행해보자 !!

 

> vagrant up

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'whatwant/Ubuntu-20.04-Server'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'whatwant/Ubuntu-20.04-Server' version '0.1.0' is up to date...
==> default: Setting the name of the VM: vagrant-hello_default_1626272864694_38723
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: bridged
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => C:/Users/whatw/workspace/vagrant-hello
==> default: Running provisioner: shell...
    default: Running: inline script
    default: Hit:1 http://kr.archive.ubuntu.com/ubuntu focal InRelease
    default: Get:2 http://kr.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
    default: Get:3 http://kr.archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
    default: Get:4 http://kr.archive.ubuntu.com/ubuntu focal-security InRelease [114 kB]
    default: Get:5 http://kr.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1,086 kB]
    default: Get:6 http://kr.archive.ubuntu.com/ubuntu focal-updates/main Translation-en [239 kB]
    default: Get:7 http://kr.archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [13.8 kB]
    default: Get:8 http://kr.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [841 kB]
    default: Get:9 http://kr.archive.ubuntu.com/ubuntu focal-updates/universe Translation-en [176 kB]
    default: Get:10 http://kr.archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [18.3 kB]
    default: Get:11 http://kr.archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [5,792 B]
    default: Get:12 http://kr.archive.ubuntu.com/ubuntu focal-backports/universe amd64 c-n-f Metadata [288 B]
    default: Get:13 http://kr.archive.ubuntu.com/ubuntu focal-security/main amd64 Packages [745 kB]
    default: Get:14 http://kr.archive.ubuntu.com/ubuntu focal-security/main Translation-en [148 kB]
    default: Get:15 http://kr.archive.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata [8,036 B]
    default: Get:16 http://kr.archive.ubuntu.com/ubuntu focal-security/universe amd64 Packages [629 kB]
    default: Get:17 http://kr.archive.ubuntu.com/ubuntu focal-security/universe Translation-en [96.2 kB]
    default: Get:18 http://kr.archive.ubuntu.com/ubuntu focal-security/universe amd64 c-n-f Metadata [11.6 kB]
    default: Fetched 4,346 kB in 13s (322 kB/s)
    default: Reading package lists...
    default: Reading package lists...
    default: Building dependency tree...
    default:
    default: Reading state information...
    default: Calculating upgrade...
    default: The following packages will be upgraded:
    default:   libuv1 linux-base
    default: 2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    default: 1 standard security update
    default: Need to get 98.5 kB of archives.
    default: After this operation, 0 B of additional disk space will be used.
    default: Get:1 http://kr.archive.ubuntu.com/ubuntu focal-updates/main amd64 libuv1 amd64 1.34.2-1ubuntu1.3 [80.8 kB]
    default: Get:2 http://kr.archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-base all 4.5ubuntu3.6 [17.8 kB]
    default: dpkg-preconfigure: unable to re-open stdin: No such file or directory
    default: Fetched 98.5 kB in 1s (73.4 kB/s)
    default: (Reading database ...
(Reading database ... 45%abase ... 5%
(Reading database ... 55%abase ... 50%
    default: (Reading database ... 60%
    default: (Reading database ... 65%
    default: (Reading database ... 70%
    default: (Reading database ... 75%
    default: (Reading database ... 80%
    default: (Reading database ... 85%
    default: (Reading database ... 90%
    default: (Reading database ... 95%
(Reading database ... 145156 files and directories currently installed.)
    default: Preparing to unpack .../libuv1_1.34.2-1ubuntu1.3_amd64.deb ...
    default: Unpacking libuv1:amd64 (1.34.2-1ubuntu1.3) over (1.34.2-1ubuntu1.1) ...
    default: Preparing to unpack .../linux-base_4.5ubuntu3.6_all.deb ...
    default: Unpacking linux-base (4.5ubuntu3.6) over (4.5ubuntu3.5) ...
    default: Setting up linux-base (4.5ubuntu3.6) ...
    default: Setting up libuv1:amd64 (1.34.2-1ubuntu1.3) ...
    default: Processing triggers for man-db (2.9.1-1) ...
    default: Processing triggers for libc-bin (2.31-0ubuntu9.2) ...

 

  - `Vagrantfile`에서 `vb.gui = false` 설정을 했기에, `VirtualBox`가 별도 실행되지 않는다.

  - 직접 `VirtualBox`를 실행해보면 다음과 같이 새로 머신이 하나 추가된 것을 볼 수 있다.

 

 

  - 머신 이름은 새로 생성한 Workspace(Directory) 이름 + 별칭 + 랜덤 숫자 ...

  - 머신을 더블 클릭하면 실행된 머신이 나타난다

 

 

  - 로그인 ID / Password는 모두 `vagrant`

 

 

07. status

  - 현재 `Vagrant`의 상태를 확인해보자.

  - 사용할 수 있는 명령어도 친절히 알려준다.

 

> vagrant status

Current machine states:

default                   running (virtualbox)

The VM is running. To stop this VM, you can run `vagrant halt` to
shut it down forcefully, or you can run `vagrant suspend` to simply
suspend the virtual machine. In either case, to restart it again,
simply run `vagrant up`.

 

여기까지 끄읕~

반응형

 

최근 Docker 또는 Kubernetes 인기로 인하여 Container가 인기의 주역이 되면서

주로 VM 환경과 같이 사용되는 Vagrant의 인기가 많이 줄어든 것 같다.

 

하지만, 여전히 VM에 대한 수요는 있고

Vagrant의 효용성도 여전히 높다고 여겨지기에 공부를 해보려 한다.

 

 

01. Vagrant

  - Vagrant 메인 사이트는 vagrant.com이 아니라 vagrantup.com 이다 ^^

  - https://www.vagrantup.com/

 

 

02. Install

  - 설치는 별거 없다. 그냥 슝슝~

 

 

03. Vagrant Hub ?

  - DockerHub처럼 Vagrant에서도 Hub가 있다 !!

  - https://app.vagrantup.com/

 

 

04. VirtualBox Guest OS 준비

  - Ubuntu 20.04 Server 이미지를 만들어서 업로드 해봤다.

  - Vagrant Box로 만들기 위해서는 다음의 과정을 거쳐야 한다.

 

  ① 작업 환경

    - Host PC(Windows 10)에서 VirtualBox 설치

    - VirtualBox에서 Guest OS로 Ubuntu 20.04 Server 설치

    → Vagrant Box 업로드 用 이미지로 만들기 위한 과정 진행 !!

 

  ② vagrant 계정 생성
    - 패스워드도 vagrant로 설정

$ sudo adduser vagrant

 

 

  ③ visudo 등록

 

$ sudo visudo

# Add the following line to the end of the file.
vagrant ALL=(ALL) NOPASSWD:ALL

 

  ④ SSH 설정

 

$ sudo su vagrant


$ cd

$ mkdir .ssh

$ wget --no-check-certificate https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub -O .ssh/authorized_keys

--2021-07-04 18:37:56--  https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub
Resolving raw.github.com (raw.github.com)... 185.199.111.133, 185.199.109.133, 185.199.108.133, ...
Connecting to raw.github.com (raw.github.com)|185.199.111.133|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub [following]
--2021-07-04 18:37:57--  https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.108.133, 185.199.111.133, 185.199.110.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 409 [text/plain]
Saving to: ‘.ssh/authorized_keys’

.ssh/authorized_keys             100%[========================================================>]     409  --.-KB/s    in 0s

2021-07-04 18:37:57 (36.9 MB/s) - ‘.ssh/authorized_keys’ saved [409/409]

 

  ⑤ SSH Server 설치

 

$ sudo apt install -y openssh-server

$ sudo nano /etc/ssh/sshd_config

Port 22
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PermitEmptyPasswords no

$ sudo service ssh restart

 

  ⑥ hostname 변경

    - 이 부분은 꼭 필요한 과정은 아니고, 필요에 따라서...

 

$ hostnamectl set-hostname whatwant

 

  ⑦ 불필요한 계정 정리

    - 이 부분 역시 꼭 필요한 과정은 아니고, 필요에 따라서...

 

$ sudo deluser whatwant

 

  ⑧ 동적 디스크 정리

    - VIrtualBox의 디스크 영역을 깨끗하게 정리하기 위해서 수행

 

$ sudo dd if=/dev/zero of=/EMPTY bs=1M

$ sudo rm -f /EMPTY

 

  ⑨ 시스템 종료

 

$ sudo shutdown -h now

 

 

05. convert Image(Vagrant Box)

  - 이제 준비된 VirtualBox Image를 Vagrant Image로 convert 해보자.

  - VirtualBox Guest 파일들이 저장된 위치를 찾아서 이동

> dir
total 14473272
drwxr-xr-x 1 whatw 197609           0  7월  4 18:30  Logs/
drwxr-xr-x 1 whatw 197609           0  7월  4 18:23  Snapshots/
-rw-r--r-- 1 whatw 197609       20613  7월  4 18:30 'Ubuntu 20.04 Server Worker1.vbox'
-rw-r--r-- 1 whatw 197609       20642  7월  4 18:23 'Ubuntu 20.04 Server Worker1.vbox-prev'
-rw-r--r-- 1 whatw 197609 14820573184  5월  5 16:49 'Ubuntu Server 20.vdi'

  - `package` 명령어를 이용해서 convert 하면 된다.

  - 아래 타이핑한 내역을 잘 살펴보기 바란다 (.vbox 사용하지 않기와 같은...^^)

> vagrant package --base "Ubuntu 20.04 Server Worker1" --out "ubuntu2004server.box"
==> Ubuntu 20.04 Server Worker1: Attempting graceful shutdown of VM...
    Ubuntu 20.04 Server Worker1: Guest communication could not be established! This is usually because
    Ubuntu 20.04 Server Worker1: SSH is not running, the authentication information was changed,
    Ubuntu 20.04 Server Worker1: or some other networking issue. Vagrant will force halt, if
    Ubuntu 20.04 Server Worker1: capable.
==> Ubuntu 20.04 Server Worker1: Forcing shutdown of VM...
==> Ubuntu 20.04 Server Worker1: Exporting VM...
==> Ubuntu 20.04 Server Worker1: Compressing package to: C:/Users/whatw/VirtualBox VMs/Ubuntu 20.04 Server Worker1/ubuntu2004server.box

 

 

06. add Box

  - 위에서 만든 Box를 등록하는 과정이다

> vagrant box add "ubuntu2004server" "C:\Users\whatw\ubuntu2004server.box"

==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'ubuntu2004server' (v0) for provider:
    box: Unpacking necessary files from: file:///C:/Users/whatw/ubuntu2004server.box
    box:
==> box: Successfully added box 'ubuntu2004server' (v0) for 'virtualbox'!

 

 

07. SHASUM

  - 뒤에 사용될 것을 미리 확인해놓자

  - 파일 이름 뒤의 `SHA256`을 꼭 써줘야 한다!!!

> certutil -hashfile .\ubuntu2004server.box sha256

SHA1의 .\ubuntu2004server.box 해시:
7e6b73addaaea6c430c54dc16fd968ba740c7272e68807e0cf57f6fa5e28c499
CertUtil: -hashfile 명령이 성공적으로 완료되었습니다.

 

08. Vagrant Cloud 준비

  - `03. Vagrant Hub ?`에서 회원가입을 했다면 아래와 같은 화면을 확인할 수 있다.

 

 

  - `Create a new Vagrant Box` 클릭하고 계속 진행해보자.

 

 

 

  - 버전은... 링크로 있는 `RubyGems versioning`을 한 번 확인해보기 바란다.

  - 제대로 사용하도록 하려면 사실 `1.0.0`으로 해주는 것이...

 

 

  - 앞에서 미리 확인한 SHA Checksum 값을 넣어주면 된다. (위의 이미지에 있는 Checksum 값은 틀렸다 ^^)

 

 

  - 업로드~ 쭉~ 쭉~ 쭉쭉쭉~

 

 

  - 처음에는 위와 같이 `unreleased` 상태로 나온다.

  - `Release` 버튼을 눌러버리면 ...

 

 

  - 이제 뭔가 잘 된 것 같다!

 

 

끄읕~~~ (정리는 왠지 항상 힘들어...)

반응형

기본적인 공유에 대해서는 다음 아티클로 포스팅을 했었다.

   - http://whatwant.tistory.com/381

공용폴더를 설정한 후 우분투를 부팅하게 되면 아래와 같이 공유 폴더가 /media/ 디렉토리 밑에 보이게 된다.


$ ls -al

합계 12

drwxr-xr-x     4  root   root      4096  8월 17 16:12 ./

drwxr-xr-x   23   root   root     4096  8월 17 14:02 ../

drwxrwx---   1   root   vboxsf      0  8월 17 16:14 sf_Share/


소유권한 부분을 보면 알겠지만, root 계정과 vboxsf 그룹에 속한 디렉토리이다.

그렇기에 일반 계정으로는 접근하려면 상당히 귀찮다. 권한에 막혀버리니...

$ sudo usermod -G vboxsf -a <계정>


위와 같이 사용하고 있는 계정을 [ vboxsf ] 그룹에 속하게 해주면 된다.



VirtualBox를 사용하는 많은 분들이 게스트 운영체제로 리눅스를 사용할 때에
공용 폴더를 자동으로 마운트를 하고서도 다시 마운트를 잡아주곤 한다.

경로를 다시 잡아주기 위해서라거나 분명한 사유가 있어서라면 그렇게 해도 되겠지만,
자동으로 마운트 설정을 잡아준 상황에서 궂이 그렇게 할 필요가 있나 싶다.

다만, 권한 문제로 사용하기가 불편하니 위와 같이 권한 설정으로 편하게 사용하자.


반응형

정신없는 업무로 한동안 집에서 컴퓨터를 만지지 못하다가,
간만에 집에서 뭔가 해보려 VirtualBox를 실행했는데... 새로운 버전이 나왔단다.


VirtualBox 4.3.6 (released 2013-12-18)
   This is a maintenance release. The following items were fixed and/or added:

   VMM: fixed a Guru Meditation VINF_EM_TRIPLE_FAULT caused by VMCB caching with nested paging on certain AMD CPUs (bug #12451)
   VMM: fixed a Guru Meditation VERR_VMX_UNEXPECTED_INTERRUPTION_EXIT_TYPE while intercepting debug exceptions (VT-x only; bug #12410)
   VMM: fixed a Guru Meditation VERR_SVM_UNEXPECTED_EXIT while intercepting debug register accesses (AMD-V only; bug #12481)
   VMM: fixed a VERR_SSM_STRUCTURE_MAGIC error when trying to load a saved state made with VBox 4.3.4 when VT-x/AMD-V is disabled. Unfortunately, VBox 4.3.4 produced broken saved states for this configuration so you have to discard these states (bug #12414)
   VMM: added a few more MSRs to the whitelist required by certain guests (bug #12245)
   GUI: fixed deleting of inaccessible VMs (4.3 regression, bug #12205)
   GUI: fixed warnings in VM settings / number of guest processors (bug #12480)
   Main: don't automatically enable 64-bit guests on 64-bit hosts if VT-x/AMD-V is not available (bug #12424)
   Main: always expose the DMI memory information to Windows 2012 guests (bug #12017)
   Main: fixed occasional crashes on guest display resolution change (bug #7063)
   Main: fixed reporting back temporary name when calling IGuestSession::DirectoryCreateTemp() (bug #12498)
   API: fix for a hang when launching a GUI VM through the API, which crashes due to GUI unavailability
   Storage: fix for BLKCACHE_IOERR runtime errors under rare circumstances (bug #11030)
   Network: allow to start more than 5 PCNet instances (bug #12426)
   E1000: if the cable was disconnected before the guest initialized the device, the link status was not properly set to 'down' after the initialization completed despite the fact that there was no connection
   3D support: fixed offset of guest 3D image elements (Mac OS X Retina hosts only; bug #11021)
   Solaris hosts: fixed accessing the host driver from non-global zones (4.3 regression, bug #12271)

뭔가 어려운 내용들이 개선이 된 것 같은데, 피부에 와닿는 부분은 잘 모르겠다 ^^
그냥 계속 되는 개선이 고마울 뿐....

반응형

+ Recent posts