본문 바로가기
서버/리눅스 서버

버추얼 박스 6.1 on 데비안 10 Buster

by ㅋㅋ잠자 2020. 1. 3.
반응형

안녕하세요? 오랜만에 새로 설치를 해보았습니다.


버추얼박스 설치 및 ExtPack 설치 그리고 웹 UI 설치까지 가보겠습니다. 





1. 버추얼 박스 설치


공식 홈페이지에 이동하시어 리눅스용을 다운받습니다. 


(repo 주소등록을 해도 되나 그렇게 하면 차후에 의존이 맞지 않게 될 수 있음으로, 버전을 찍어서 다운로드합니다.)


https://www.virtualbox.org/wiki/Linux_Downloads



참고로 버추얼 박스 설치시 운용중인 커널의 헤더가 필요합니다. 헤더가 없으면 dkms 커널 모듈 빌드에 실패하게 됨으로 커널 헤더 유무를 꼭 체크하시길 바랍니다.


deb 설치 파일을 받습니다.


root@openmediavault:~# wget https://download.virtualbox.org/virtualbox/6.1.0/virtualbox-6.1_6.1.0-135406~Debian~buster_amd64.deb

--2020-01-03 12:47:51--  https://download.virtualbox.org/virtualbox/6.1.0/virtualbox-6.1_6.1.0-135406~Debian~buster_amd64.deb

Resolving download.virtualbox.org (download.virtualbox.org)... 23.46.22.141

Connecting to download.virtualbox.org (download.virtualbox.org)|23.46.22.141|:443... connected.

HTTP request sent, awaiting response... 200 OK

Length: 93538568 (89M) [text/plain]

Saving to: ‘virtualbox-6.1_6.1.0-135406~Debian~buster_amd64.deb’


virtualbox-6.1_6.1.0-135406~Debian~buster_amd64.deb         100%[========================================================================================================================================>]  89.21M  8.23MB/s    in 11s


2020-01-03 12:48:03 (7.77 MB/s) - ‘virtualbox-6.1_6.1.0-135406~Debian~buster_amd64.deb’ saved [93538568/93538568]


설치 도중에 의존성이 맞지 않는 부분은 -f install 로 해결합니다.


root@openmediavault:~# dpkg -i virtualbox-6.1_6.1.0-135406~Debian~buster_amd64.deb

Selecting previously unselected package virtualbox-6.1.

(Reading database ... 89139 files and directories currently installed.)

Preparing to unpack virtualbox-6.1_6.1.0-135406~Debian~buster_amd64.deb ...

Unpacking virtualbox-6.1 (6.1.0-135406~Debian~buster) ...

dpkg: dependency problems prevent configuration of virtualbox-6.1:

 virtualbox-6.1 depends on libqt5core5a (>= 5.11.0~rc1); however:

  Package libqt5core5a is not installed.

 virtualbox-6.1 depends on libqt5gui5 (>= 5.4.0); however:

  Package libqt5gui5 is not installed.

 virtualbox-6.1 depends on libqt5opengl5 (>= 5.0.2); however:

  Package libqt5opengl5 is not installed.

 virtualbox-6.1 depends on libqt5printsupport5 (>= 5.0.2); however:

  Package libqt5printsupport5 is not installed.

 virtualbox-6.1 depends on libqt5widgets5 (>= 5.11.0~rc1); however:

  Package libqt5widgets5 is not installed.

 virtualbox-6.1 depends on libqt5x11extras5 (>= 5.6.0); however:

  Package libqt5x11extras5 is not installed.

 virtualbox-6.1 depends on libsdl1.2debian (>= 1.2.11); however:

  Package libsdl1.2debian is not installed.

 virtualbox-6.1 depends on libvpx5 (>= 1.6.0); however:

  Package libvpx5 is not installed.


dpkg: error processing package virtualbox-6.1 (--install):

 dependency problems - leaving unconfigured

Processing triggers for systemd (241-7~deb10u1) ...

Processing triggers for desktop-file-utils (0.23-4) ...

Processing triggers for mime-support (3.62) ...

Processing triggers for hicolor-icon-theme (0.17-2) ...

Processing triggers for shared-mime-info (1.10-1) ...

Errors were encountered while processing:

 virtualbox-6.1


root@openmediavault:~# apt install -f

Reading package lists... Done

Building dependency tree

Reading state information... Done

Correcting dependencies... Done

The following additional packages will be installed:

  libcaca0 libdouble-conversion1 libegl-mesa0 libegl1 libevdev2 libinput-bin libinput10 libmtdev1 libpcre2-16-0 libqt5core5a libqt5dbus5 libqt5gui5 libqt5network5 libqt5opengl5 libqt5printsupport5 libqt5widgets5 libqt5x11extras5

  libsdl1.2debian libvpx5 libwacom-common libwacom2 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxkbcommon-x11-0

Suggested packages:

  qt5-image-formats-plugins qtwayland5

Recommended packages:

  qttranslations5-l10n libqt5svg5 qt5-gtk-platformtheme libwacom-bin

The following NEW packages will be installed:

  libcaca0 libdouble-conversion1 libegl-mesa0 libegl1 libevdev2 libinput-bin libinput10 libmtdev1 libpcre2-16-0 libqt5core5a libqt5dbus5 libqt5gui5 libqt5network5 libqt5opengl5 libqt5printsupport5 libqt5widgets5 libqt5x11extras5

  libsdl1.2debian libvpx5 libwacom-common libwacom2 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxkbcommon-x11-0

0 upgraded, 30 newly installed, 0 to remove and 80 not upgraded.

2 not fully installed or removed.

Need to get 10.9 MB of archives.

After this operation, 36.5 MB of additional disk space will be used.

Do you want to continue? [Y/n]


중간에 아래의 메시지가 보입니다. 헤더가 찾을 수 없어서 모듈 빌드에 실패했다는 내용인데.. 친절하게 뭘 추가적으로 설치하고 프로그램을 실행하라고 적혀 있습니다.


This system is currently not set up to build kernel modules.

Please install the Linux kernel "header" files matching the current kernel

for adding new hardware support to the system.

The distribution packages containing the headers are probably:

    linux-headers-amd64 linux-headers-4.19.0-6-amd64


There were problems setting up VirtualBox.  To re-start the set-up process, run

  /sbin/vboxconfig

as root.  If your system is using EFI Secure Boot you may need to sign the

kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load

them. Please see your Linux system's documentation for more information.

Processing triggers for libc-bin (2.28-10) ...


시키는 대로 다시 해줍니다.


root@openmediavault:~# apt install linux-headers-amd64 linux-headers-4.19.0-6-amd64

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following additional packages will be installed:

  linux-compiler-gcc-8-x86 linux-headers-4.19.0-6-common linux-kbuild-4.19

The following NEW packages will be installed:

  linux-compiler-gcc-8-x86 linux-headers-4.19.0-6-amd64 linux-headers-4.19.0-6-common linux-headers-amd64 linux-kbuild-4.19

0 upgraded, 5 newly installed, 0 to remove and 80 not upgraded.

Need to get 9909 kB of archives.

After this operation, 57.4 MB of additional disk space will be used.

Do you want to continue? [Y/n]


root@openmediavault:~# /sbin/vboxconfig

vboxdrv.sh: Stopping VirtualBox services.

vboxdrv.sh: Starting VirtualBox services.

vboxdrv.sh: Building VirtualBox kernel modules.


그럼 커널 모듈까지 올렸으니, 버추얼 박스 설치는 끝났습니다.





2. Extension Pack 설치하기


USB 패스쓰루나 화면공유, 웹서버 기능을 쓰시려면 꼭 extpack 이 설치되어 있어야 합니다. 


홈페이지에서 설치하신 virtualbox 버전에 맞는 extpack 을 다운받아서 설치해 줍니다.



oot@openmediavault:~# wget https://download.virtualbox.org/virtualbox/6.1.0/Oracle_VM_VirtualBox_Extension_Pack-6.1.0.vbox-extpack

--2020-01-03 12:53:42--  https://download.virtualbox.org/virtualbox/6.1.0/Oracle_VM_VirtualBox_Extension_Pack-6.1.0.vbox-extpack

Resolving download.virtualbox.org (download.virtualbox.org)... 23.77.59.73

Connecting to download.virtualbox.org (download.virtualbox.org)|23.77.59.73|:443... connected.

HTTP request sent, awaiting response... 200 OK

Length: 10923164 (10M) [text/plain]

Saving to: ‘Oracle_VM_VirtualBox_Extension_Pack-6.1.0.vbox-extpack’


Oracle_VM_VirtualBox_Extension_Pack-6.1.0.vbox-extpack      100%[========================================================================================================================================>]  10.42M  1.75MB/s    in 6.7s


2020-01-03 12:53:50 (1.55 MB/s) - ‘Oracle_VM_VirtualBox_Extension_Pack-6.1.0.vbox-extpack’ saved [10923164/10923164]


root@openmediavault:~# vboxmanage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.1.0.vbox-extpack

VirtualBox Extension Pack Personal Use and Evaluation License (PUEL)


License version 10, 20 July 2017


PLEASE READ THE FOLLOWING ORACLE VM VIRTUALBOX EXTENSION PACK PERSONAL

USE AND EVALUATION LICENSE CAREFULLY BEFORE DOWNLOADING OR USING THE

ORACLE SOFTWARE. THESE TERMS AND CONDITIONS CONSTITUTE A LEGAL AGREEMENT

BETWEEN YOU AND ORACLE.


ORACLE AMERICA, INC. ("ORACLE") IS WILLING TO LICENSE THE PRODUCT DEFINED

IN SECTION 1 BELOW ONLY ON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS

CONTAINED IN THIS VIRTUALBOX EXTENSION PACK PERSONAL USE AND EVALUATION

LICENSE AGREEMENT ("AGREEMENT").


Do you agree to these license terms and conditions (y/n)? y


License accepted. For batch installation add

--accept-license=56be48f923303c8cababb0bb4c478284b688ed23f16d775d729b89a2e8e5f9eb

to the VBoxManage command line.


0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

Successfully installed "Oracle VM VirtualBox Extension Pack".





3. 웹 UI 설치하기 - 1) 웹 서비스 활성화


웹 UI 소스코드가 소스포지에 있다가 깃허브로 이동하였고 다른 사람이 메인테이너로 활동중에 있습니다.


https://github.com/phpvirtualbox/phpvirtualbox


일단 vboxwebservice 를 활성화합니다.


root@openmediavault:~# systemctl enable vboxweb-service

root@openmediavault:~# systemctl start vboxweb-service

root@openmediavault:~# systemctl status vboxweb-service

● vboxweb-service.service

   Loaded: loaded (/usr/lib/virtualbox/vboxweb-service.sh; enabled; vendor preset: enabled)

   Active: active (exited) since Fri 2020-01-03 12:52:18 KST; 2 days ago

    Tasks: 0 (limit: 4915)

   Memory: 0B

   CGroup: /system.slice/vboxweb-service.service


Jan 03 12:52:18 openmediavault systemd[1]: Starting vboxweb-service.service...

Jan 03 12:52:18 openmediavault systemd[1]: Started vboxweb-service.service.


다음으로 webservice 를 위한 계정을 생성합니다.


그리고 그룹에 추가합니다.


root@openmediavault:~# useradd -d /home/vbox -m vbox

root@openmediavault:~# passwd vbox

New password: 

Retype new password: 

passwd: password updated successfully


root@openmediavault:~# adduser vbox vboxusers

Adding user `vbox' to group `vboxusers' ...

Adding user vbox to group vboxusers

Done.


그리고 /etc/default/virtualbox 파일을 생성하여 아래와 같이 기입합니다.


root@openmediavault:~# vim /etc/default/virtualbox

root@openmediavault:~# cat /etc/default/virtualbox 

VBOXWEB_USER=vbox

VBOXWEB_HOST=127.0.0.1


다시 한번 웹서비스를 재시작합니다.


그럼 running 이라고 표시가 될 것입니다.


root@openmediavault:~# systemctl restart vboxweb-service


root@openmediavault:~# systemctl status vboxweb-service

● vboxweb-service.service

   Loaded: loaded (/usr/lib/virtualbox/vboxweb-service.sh; enabled; vendor preset: enabled)

   Active: active (running) since Sun 2020-01-05 16:47:18 KST; 3s ago

  Process: 23496 ExecStart=/usr/lib/virtualbox/vboxweb-service.sh start (code=exited, status=0/SUCCESS)

    Tasks: 20 (limit: 4915)

   Memory: 34.2M

   CGroup: /system.slice/vboxweb-service.service

           ├─23508 /usr/lib/virtualbox/vboxwebsrv --background -H 127.0.0.1

           ├─23510 /usr/lib/virtualbox/VBoxXPCOMIPCD

           └─23516 /usr/lib/virtualbox/VBoxSVC --auto-shutdown


Jan 05 16:47:18 openmediavault systemd[1]: Starting vboxweb-service.service...

Jan 05 16:47:18 openmediavault vboxweb-service.sh[23496]: vboxweb-service.sh: Starting VirtualBox web service.

Jan 05 16:47:18 openmediavault systemd[1]: Started vboxweb-service.service.





4. 웹 UI 설치하기 - 2) 웹 서버 설치하기


다음으로 apache2 웹서버와 php 그리고 php 의존 모듈을 설치합니다.


root@openmediavault:~# apt-get install apache2 libapache2-mod-php php php-soap php-xml

Reading package lists... Done

Building dependency tree       

Reading state information... Done

php-xml is already the newest version (2:7.3+69).

php-xml set to manually installed.

The following additional packages will be installed:

  apache2-bin apache2-data apache2-utils libapache2-mod-php7.3 libapr1 libaprutil1 libaprutil1-dbd-sqlite3

  libaprutil1-ldap libbrotli1 liblua5.2-0 php7.3 php7.3-bcmath php7.3-cgi php7.3-cli php7.3-common php7.3-fpm

  php7.3-json php7.3-mbstring php7.3-opcache php7.3-readline php7.3-soap php7.3-xml

Suggested packages:

  apache2-doc apache2-suexec-pristine | apache2-suexec-custom php-pear

The following NEW packages will be installed:

  apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php libapache2-mod-php7.3 libapr1 libaprutil1

  libaprutil1-dbd-sqlite3 libaprutil1-ldap libbrotli1 liblua5.2-0 php php-soap php7.3 php7.3-soap

The following packages will be upgraded:

  php7.3-bcmath php7.3-cgi php7.3-cli php7.3-common php7.3-fpm php7.3-json php7.3-mbstring php7.3-opcache

  php7.3-readline php7.3-xml

10 upgraded, 16 newly installed, 0 to remove and 70 not upgraded.

Need to get 4100 kB/10.1 MB of archives.

After this operation, 14.0 MB of additional disk space will be used.

Do you want to continue? [Y/n]


그 다음 웹 루트로 이동하여 php 파일을 받습니다.


root@openmediavault:/var/www/html# wget https://github.com/phpvirtualbox/phpvirtualbox/archive/master.zip

--2020-01-05 16:51:28--  https://github.com/phpvirtualbox/phpvirtualbox/archive/master.zip

Resolving github.com (github.com)... 15.164.81.167

Connecting to github.com (github.com)|15.164.81.167|:443... connected.

HTTP request sent, awaiting response... 302 Found

Location: https://codeload.github.com/phpvirtualbox/phpvirtualbox/zip/master [following]

--2020-01-05 16:51:29--  https://codeload.github.com/phpvirtualbox/phpvirtualbox/zip/master

Resolving codeload.github.com (codeload.github.com)... 13.124.75.135

Connecting to codeload.github.com (codeload.github.com)|13.124.75.135|:443... connected.

HTTP request sent, awaiting response... 200 OK

Length: unspecified [application/zip]

Saving to: ‘master.zip’


master.zip                       [   <=>                                         ]   4.05M  8.40MB/s    in 0.5s    


2020-01-05 16:51:29 (8.40 MB/s) - ‘master.zip’ saved [4247924]


root@openmediavault:/var/www/html# unzip master.zip 

Archive:  master.zip

ea36625d7eb02a5256de214b44b819cc97c3b339

   creating: phpvirtualbox-master/

  inflating: phpvirtualbox-master/.dockerignore  

  inflating: phpvirtualbox-master/.gitignore  

  inflating: phpvirtualbox-master/CHANGELOG.txt  


root@openmediavault:/var/www/html# ls
index.html  index.nginx-debian.html  master.zip  phpvirtualbox-master

root@openmediavault:/var/www/html# mv phpvirtualbox-master/ phpvirtualbox/

root@openmediavault:/var/www/html# rm master.zip 


다음으로 config 를 수정합니다.


root@openmediavault:/var/www/html# cd phpvirtualbox/


root@openmediavault:/var/www/html/phpvirtualbox# ls

CHANGELOG.txt  README.md    endpoints   languages    recovery.php-disabled

Dockerfile     config.php-example  images      panes    tightvnc

GPLv3.txt      css    index.html  phpvirtualbox.conf  vboxinit

LICENSE.txt    docker-compose.yml  js        rdpweb


root@openmediavault:/var/www/html/phpvirtualbox# cp config.php-example config.php

root@openmediavault:/var/www/html/phpvirtualbox# vim config.php


  1 <?php

  2 /**

  3  * phpVirtualBox example configuration. 

  4  * @version $Id: config.php-example 585 2015-04-04 11:39:31Z imoore76 $

  5  *

  6  * rename to config.php and edit as needed.

  7  *

  8  */

  9 class phpVBoxConfig {

 10 

 11 /* Username / Password for system user that runs VirtualBox */

 12 var $username = 'vbox';

 13 var $password = 'passwd';

 14 

 15 /* SOAP URL of vboxwebsrv (not phpVirtualBox's URL) */

 16 var $location = 'http://127.0.0.1:18083/';

 17 

 18 /* Default language. See languages folder for more language options.

 19  * Can also be changed in File -> Preferences -> Language in

 20  * phpVirtualBox.

 21  */

 22 var $language = 'en';

 23 

 24 /* Set the standard VRDE Port Number / Range, e.g. 1010-1020 or 1027 


다음으로 http://ip_addr/phpvirtualbox 로 정상적으로 열리는 지 확인합니다.


초기 아이디 비번은 admin / admin 입니다.




webui 비밀번호는 아래와 같이 File -> Change Password 를 통해서 수정합니다.








5. 웹 UI 설치하기 - 3) 웹 서버 프록시 설정하기


https://blog.djjproject.com/123 이전에 작성한 프록시 패스를 기반으로 설정을 해보겠습니다.


root@openmediavault:/var/www/html/phpvirtualbox# cd /etc/apache2/sites-available/


root@openmediavault:/etc/apache2/sites-available# a2enmod proxy proxy_ajp proxy_http rewrite deflate headers proxy_balancer proxy_connect proxy_html ssl

Enabling module proxy.

Considering dependency proxy for proxy_ajp:

Module proxy already enabled

Enabling module proxy_ajp.

Considering dependency proxy for proxy_http:

Module proxy already enabled

Enabling module proxy_http.

Enabling module rewrite.

Considering dependency filter for deflate:

Module filter already enabled

Module deflate already enabled

Enabling module headers.

Considering dependency proxy for proxy_balancer:

Module proxy already enabled

Considering dependency alias for proxy_balancer:

Module alias already enabled

Considering dependency slotmem_shm for proxy_balancer:

Enabling module slotmem_shm.

Enabling module proxy_balancer.

Considering dependency proxy for proxy_connect:

Module proxy already enabled

Enabling module proxy_connect.

Considering dependency proxy for proxy_html:

Module proxy already enabled

Considering dependency xml2enc for proxy_html:

Enabling module xml2enc.

Enabling module proxy_html.

To activate the new configuration, you need to run:

  systemctl restart apache2



root@openmediavault:/etc/apache2/sites-available# service apache2 reload


셀프 싸인으로 인증서를 하나 생성합니다.


oot@openmediavault:/etc/apache2/sites-available# mkdir /etc/apache2/ssl

root@openmediavault:/etc/apache2/sites-available# openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt

Generating a RSA private key

.........................................................+++++

............................................................+++++

writing new private key to '/etc/apache2/ssl/apache.key'

-----

You are about to be asked to enter information that will be incorporated

into your certificate request.

What you are about to enter is what is called a Distinguished Name or a DN.

There are quite a few fields but you can leave some blank

For some fields there will be a default value,

If you enter '.', the field will be left blank.

-----

Country Name (2 letter code) [AU]:

string is too long, it needs to be no more than 2 bytes long

Country Name (2 letter code) [AU]:

State or Province Name (full name) [Some-State]:

Locality Name (eg, city) []:

Organization Name (eg, company) [Internet Widgits Pty Ltd]:

Organizational Unit Name (eg, section) []:

Common Name (e.g. server FQDN or YOUR name) []:

Email Address []:


웹 conf 를 하나 작성합니다.


root@openmediavault:/etc/apache2/sites-available# vim virtualbox.conf

root@openmediavault:/etc/apache2/sites-available# cat virtualbox.conf 

<Virtualhost *:80>

ServerName vbox.djjproject.com

RewriteEngine On

RewriteCond %{HTTPS} off

RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

</VirtualHost>




<VirtualHost *:443>

ServerName vbox.djjproject.com

ServerAlias ""

SSLEngine On

SSLCertificateFile /etc/apache2/ssl/apache.crt

SSLCertificateKeyFile /etc/apache2/ssl/apache.key

SSLProtocol +TLSv1.2

ProxyPreserveHost On

SSLProxyEngine On

RequestHeader set Front-End-Https "On"

DocumentRoot /var/www/html/phpvirtualbox

DirectoryIndex index.html index.php /_h5ai/server/php/index.php

</Virtualhost>


conf 를 활성화 합니다.


root@openmediavault:/etc/apache2/sites-available# a2ensite virtualbox

Enabling site virtualbox.

To activate the new configuration, you need to run:

  systemctl reload apache2

root@openmediavault:/etc/apache2/sites-available# service apache2 reload


잘 열리는 지 확인합니다.



반응형

댓글