Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
software:virtualbox [2018/04/04 13:22]
st
software:virtualbox [2018/10/29 13:19] (aktuell)
st
Zeile 2: Zeile 2:
  
 Seit [[linux:​Kernel]] 4.16 sind die Gast-Treiber Vboxguest integriert (Copy & Paste zwischen Host und Gas, Durchreichen von OpenGL-Befehlen damit ist die 3D-Beschleunigung des Hosts nutzbar), [[https://​www.heise.de/​ct/​artikel/​Die-Neuerungen-von-Linux-4-16-3964466.html?​seite=all#​vbox|die gemeinsamen Ordner fehlen noch]]. Seit [[linux:​Kernel]] 4.16 sind die Gast-Treiber Vboxguest integriert (Copy & Paste zwischen Host und Gas, Durchreichen von OpenGL-Befehlen damit ist die 3D-Beschleunigung des Hosts nutzbar), [[https://​www.heise.de/​ct/​artikel/​Die-Neuerungen-von-Linux-4-16-3964466.html?​seite=all#​vbox|die gemeinsamen Ordner fehlen noch]].
 +
 +
 +===== Befehle =====
 +
 +==== resize ====
 +
 +:!: vorher ein Backup machen!
 +
 +MY_HD.vdi auf 6000 MiB einstellen:
 +<code bash>​VBoxManage modifyhd MY_HD.vdi --resize 6000</​code>​
 +
 +Möglicherweise kommt der folgende Fehler:
 +<​file>​Progress state: VBOX_E_NOT_SUPPORTED
 +VBoxManage: error: Resize hard disk operation for this format is not implemented yet!</​file>​
 +
 +Lösung: das vorhandene Image muss zu einem dynamischen Image konvertiert werden:
 +
 +<code bash>​VBoxManage clonehd MY_HD.vdi MY_HD_clone.vdi</​code>​
 +
 +anschließend der resize (s.o.).
  
  
 ===== Konfiguration ===== ===== Konfiguration =====
  
 +==== virtualbox headless ====
 +
 +<code bash>apt install virtualbox-5.2</​code>​
 +
 +/​sbin/​vboxconfig
 +
 +<code bash>
 +wget https://​download.virtualbox.org/​virtualbox/​5.2.16/​Oracle_VM_VirtualBox_Extension_Pack-5.2.16.vbox-extpack
 +vboxmanage extpack install Oracle_VM_VirtualBox_Extension_Pack-5.2.16.vbox-extpack
 +</​code>​
 +
 +-> vboxmanage list extpacks
 +
 +
 +/​sbin/​vboxconfig
 +
 +
 +-> /​etc/​default/​virtualbox -> hat keinen Effekt!
 +
 +''/​etc/​vbox/​vbox.cfg''​
 +<​file>​
 +# Set this to 1 if you would like the virtualbox modules to be loaded by
 +# the init script.
 +LOAD_VBOXDRV_MODULE=1
 +
 +# SHUTDOWN_USERS="​foo bar"
 +#   check for running VMs of user '​foo'​ and user '​bar'​
 +#   '​all'​ checks for all active users
 +# SHUTDOWN=poweroff
 +# SHUTDOWN=acpibutton
 +# SHUTDOWN=savestate
 +#   ​select one of these shutdown methods for running VMs
 +#   ​acpibutton and savestate causes the init script to wait
 +#   30 seconds for the VMs to shutdown
 +SHUTDOWN_USERS="​vbox"​
 +SHUTDOWN=savestate ​
 +
 +VBOXWEB_USER=vbox
 +</​file>​
 +
 +<code bash>​systemctl start vboxweb-service.service</​code>​
 +
 +-> vboxwebsr 25104   ​root ​  ​10u ​ IPv6 752731 ​     0t0  TCP [::1]:18083 (LISTEN)
 +
 +
 +
 +**ohne root-Rechte**:​
 +
 +''/​lib/​systemd/​system/​vboxweb.service''​
 +<​file>​
 +[Unit]
 +Description=VirtualBox Web Service
 +After=virtualbox.service
 +
 +[Service]
 +Type=forking
 +ExecStart=/​usr/​bin/​vboxwebsrv --pidfile /​home/​vbox/​vboxweb.pid ​ --background
 +PIDFile=/​home/​vbox/​vboxweb.pid
 +User=vbox
 +Group=vboxusers
 +
 +[Install]
 +WantedBy=multi-user.target
 +</​file>​
 +
 +Debian Jessie: ​
 +<​file>​
 +[Unit]
 +SourcePath=/​usr/​lib/​virtualbox/​vboxweb-service.sh
 +Description=
 +Before=runlevel2.target runlevel3.target runlevel4.target runlevel5.target shutdown.target
 +After=vboxdrv.service
 +Conflicts=shutdown.target
 +
 +[Service]
 +Type=forking
 +Restart=no
 +TimeoutSec=5min
 +IgnoreSIGPIPE=no
 +KillMode=process
 +GuessMainPID=no
 +RemainAfterExit=yes
 +ExecStart=/​usr/​lib/​virtualbox/​vboxweb-service.sh start
 +ExecStop=/​usr/​lib/​virtualbox/​vboxweb-service.sh stop
 +User=vbox
 +Group=vboxusers
 +
 +[Install]
 +WantedBy=multi-user.target
 +</​file>​
 +
 +<code bash>​systemctl daemon-reload</​code>​
 +
 +<​file>​
 +diff -u /​usr/​lib/​virtualbox/​vboxweb-service.sh /​usr/​lib/​virtualbox/​vboxweb-service.sh.dist
 +--- /​usr/​lib/​virtualbox/​vboxweb-service.sh 2018-08-05 18:​54:​29.385292902 +0200
 ++++ /​usr/​lib/​virtualbox/​vboxweb-service.sh.dist 2018-08-05 18:​48:​05.753616307 +0200
 +@@ -146,10 +146,7 @@
 +         fi
 +         # prevent inheriting this setting to VBoxSVC
 +         unset VBOX_RELEASE_LOG_DEST
 +- start-stop-daemon --start --user $VBOXWEB_USER --exec $binary $PARAMS > /dev/null 2>&1
 +-        # does not work:
 +- # start_daemon $VBOXWEB_USER $binary $PARAMS > /dev/null 2>&1
 +-
 ++        start_daemon $VBOXWEB_USER $binary $PARAMS > /dev/null 2>&1
 +         # ugly: wait until the final process has forked
 +         sleep .1
 +         ​PID=`pidof $binary 2>/​dev/​null`
 +</​file>​
 +
 +<code bash>​start-stop-daemon --start --user vbox --exec /​usr/​lib/​virtualbox/​vboxwebsrv --background</​code>​
 +
 +<​file>​
 +Aug 05 18:41:26 server1 vboxweb-service.sh[5257]:​ + unset VBOX_RELEASE_LOG_DEST
 +Aug 05 18:41:26 server1 vboxweb-service.sh[5257]:​ + start_daemon vbox /​usr/​lib/​virtualbox/​vboxwebsrv --background
 +Aug 05 18:41:26 server1 vboxweb-service.sh[5257]:​ + sleep .1
 +Aug 05 18:41:26 server1 vboxweb-service.sh[5257]:​ + pidof /​usr/​lib/​virtualbox/​vboxwebsrv
 +</​file>​
 +
 +<code bash>
 +mkdir /​var/​lib/​vbox
 +chown vbox.vboxusers /​var/​lib/​vbox
 +</​code>​
 +
 +
 +''/​lib/​udev/​rules.d/​20-virtualbox2.rules'':​
 +<​file>​
 +KERNEL=="​vboxdrv",​ NAME="​vboxdrv",​ OWNER="​root",​ GROUP="​vboxusers",​ MODE="​0660"​
 +KERNEL=="​vboxdrvu",​ NAME="​vboxdrvu",​ OWNER="​root",​ GROUP="​vboxusers",​ MODE="​0660"​
 +KERNEL=="​vboxnetctl",​ NAME="​vboxnetctl",​ OWNER="​root",​GROUP="​vboxusers",​ MODE="​0660"​
 +</​file>​
 +
 +
 +''/​lib/​systemd/​system/​vboxweb.service''​
 +-> ggf. public IP setzen: -H 1.2.3.4
 +
 +<code bash>​systemctl enable vboxweb-service.service</​code>​
 +
 +<​file>​
 + Created symlink from /​etc/​systemd/​system/​multi-user.target.wants/​vboxweb-service.service to /​lib/​systemd/​system/​vboxweb-service.service.
 +</​file>​
 +
 +Shell setzen nötig??? -> 
 +<code bash>​chsh -s /bin/bash vbox</​code>​
 +
 +LAMP installieren:​ <code bash>​apache2 mysql-server libapache2-mod-php php php-curl php-soap php-xml</​code>​
 +
 +
 +<​file>​
 +<​VirtualHost *:443>
 +
 +  ServerName Host.domain.tld
 +  ServerAdmin webmaster@domain.tld
 +  DocumentRoot "/​srv/​www"​
 +
 +
 +  SSLEngine On
 +  SSLProtocol ALL -SSLv2 -SSLv3
 +
 +  SSLHonorCipherOrder On
 +  SSLCipherSuite '​EECDH+ECDSA+AESGCM:​EECDH+aRSA+AESGCM:​EECDH+ECDSA:​EECDH:​EDH+AESGCM:​EDH:​ECDH+AESGCM:​ECDH+AES:​ECDH:​HIGH:​MEDIUM:​!RC4:​!3DES:​!CAMELLIA:​!SEED:​!aNULL:​!MD5:​!eNULL:​!LOW:​!EXP:​!DSS:​!PSK:​!SRP'​
 +
 +  <​IfModule mod_headers.c>​
 +          Header always set Strict-Transport-Security "​max-age=15768000"​
 +  </​IfModule>​
 +
 +  SSLCertificateFile /​etc/​apache2/​CERTFILE.crt
 +  SSLCertificateKeyFile /​etc/​apache2/​KEYFILE.net.key
 +  SSLCACertificateFile /​etc/​apache2/​CA-bundle.crt
 +
 +  ErrorLog ${APACHE_LOG_DIR}/​error.log
 +  CustomLog ${APACHE_LOG_DIR}/​access.log combined
 +
 +  <​Directory "/​srv/​www"​ >
 + Options -Indexes -MultiViews +FollowSymLinks +ExecCGI
 + AllowOverride AuthConfig FileInfo Limit Indexes
 + Order allow,deny
 + allow from all
 + # Apache 2.4+: Require all granted
 +        Require all granted
 +   </​Directory>​
 + 
 + </​VirtualHost>​
 +</​file>​
 +
 +phpvirtualbox -> config.php erzeugen
 +
 +Login mit: admin / admin
 +
 +<code bash>
 +mkdir /​home/​vbox/​VirtualBox\ VMs
 +chown vbox.vboxusers /​home/​vbox/​VirtualBox\ VMs
 +
 +mkdir /​home/​vbox/​iso
 +chown vbox.vboxusers /​home/​vbox/​iso
 +</​code>​
 +
 +**Einschränkungen**:​
 +  * Remotedesktop geht nur mit Außen-IP (nicht ::1 127.0.0.1 / localhost): ​
 +  * leider basiert das plugin von phpvirtualbox auf flash (funktioniert bei Firefox nicht)
 +
 +''/​etc/​vbox/​vbox.cfg''​ neu anlegen:
 +<​file>​
 +# Set this to 1 if you would like the virtualbox modules to be loaded by
 +# the init script.
 +LOAD_VBOXDRV_MODULE=1
 +
 +# SHUTDOWN_USERS="​foo bar"
 +#   check for running VMs of user '​foo'​ and user '​bar'​
 +#   '​all'​ checks for all active users
 +# SHUTDOWN=poweroff
 +# SHUTDOWN=acpibutton
 +# SHUTDOWN=savestate
 +#   ​select one of these shutdown methods for running VMs
 +#   ​acpibutton and savestate causes the init script to wait
 +#   30 seconds for the VMs to shutdown
 +SHUTDOWN_USERS="​vbox"​
 +SHUTDOWN=savestate ​
 +
 +VBOXWEB_USER=vbox
 +</​file>​
 +
 +
 +=== Quellen ===
 +
 +  - https://​www.virtualbox.org/​wiki/​Linux_Downloads
 +  - https://​www.thomas-krenn.com/​de/​wiki/​VirtualBox_im_Headless-Modus_starten
 +  - https://​www.howtoforge.de/​anleitung/​vboxheadless-virtuelle-maschinen-mit-virtualbox-4-1-auf-einem-headless-centos-6-2-server/​
 +  - Windows: https://​sourceforge.net/​projects/​vboxvmservice/?​source=recommended
 +  - https://​www.howtoforge.de/​anleitung/​headless-virtualbox-installation-mit-phpvirtualbox-verwalten-centos-6-2/​
 +  - https://​askubuntu.com/​questions/​741564/​how-can-i-get-vboxweb-to-start-properly-at-boot
 +  - https://​bbs.archlinux.org/​viewtopic.php?​id=187863
 +  - https://​sourceforge.net/​p/​phpvirtualbox/​wiki/​vboxweb-service%20Configuration%20in%20Linux/​
 +  - https://​sourceforge.net/​p/​phpvirtualbox/​wiki/​Home/#​virtualbox-40-remote-console-access-note
 +
 +=== upgrade-Probleme ===
 +
 +nach dem Paket-upgrade von virtualbox wird immer wieder das unit-file zurückgesetzt,​ danach fehlen die beiden Zeilen:
 +''/​etc/​systemd/​system/​multi-user.target.wants/​vboxweb-service.service''​
 +<​file>​
 +User=vbox
 +Group=vboxusers
 +</​file>​
 +
 +cat /​lib/​systemd/​system/​vboxweb.service
 +<​file>​
 +[Unit]
 +Description=VirtualBox Web Service
 +After=virtualbox.service
 +
 +[Service]
 +Type=forking
 +ExecStart=/​usr/​bin/​vboxwebsrv --pidfile /​home/​vbox/​vboxweb.pid ​ --background
 +PIDFile=/​home/​vbox/​vboxweb.pid
 +User=vbox
 +Group=vboxusers
 +
 +[Install]
 +WantedBy=multi-user.target
 +</​file>​
 +
 +<code bash>
 +systemctl daemon-reload
 +systemctl restart vboxweb.service
 +</​code>​
 +Bei upgrades geht (regelmäßig) kaputt:
 +
 +''/​etc/​systemd/​system/​multi-user.target.wants/​vboxweb-service.service''​
 +<​file>​
 +User=vbox
 +Group=vboxusers
 +</​file>​
 +
 +Außerdem muss die Datei ''/​etc/​vbox/​vbox.cfg''​ wieder neu anlegt werden:
 +<​file>​
 +# Set this to 1 if you would like the virtualbox modules to be loaded by
 +# the init script.
 +LOAD_VBOXDRV_MODULE=1
 +
 +# SHUTDOWN_USERS="​foo bar"
 +#   check for running VMs of user '​foo'​ and user '​bar'​
 +#   '​all'​ checks for all active users
 +# SHUTDOWN=poweroff
 +# SHUTDOWN=acpibutton
 +# SHUTDOWN=savestate
 +#   ​select one of these shutdown methods for running VMs
 +#   ​acpibutton and savestate causes the init script to wait
 +#   30 seconds for the VMs to shutdown
 +SHUTDOWN_USERS="​vbox"​
 +SHUTDOWN=savestate ​
 +
 +VBOXWEB_USER=vbox
 +</​file>​
  
 ==== phpvirtualbox ==== ==== phpvirtualbox ====