How to Install Oracle VirtualBox On Ubuntu 18.04.2 LTS Headless Server

Install Oracle VirtualBox On Ubuntu 18.04 LTS server

43 Responses

  1. Gianni Franceschinis says:

    This is a great guide.
    Thanks so much!!!

  2. Daryl Lee says:

    Nice work. But when I browse to phpvirtualbox and log in, I get a failure to connect to “”. Any idea what that’s all about? The userid/pwd is correct

    • Vinicius Zanellato says:

      For me too. Did you fixed?

      • Bart Cockheyt says:

        Change to your actual servers ip adress on line 16 in sudo nano /var/www/html/phpvirtualbox/config.php
        Then restart the services.

    • Peter says:

      Had the same problem here, running VBox 5.2.28 and phpvirtualbox 5.2.1

      Changing to the actual IP did not change an thing. Why should it? They are both pointing to the same machine.

      The command vboxwebsrv -H told me that VBox could not access the folder .config in my home. Checking this showed that both .config and .local were owned by root, possibly to an unnecessary sudo while installing.

      chown fixed the whole thing 🙂

  3. Chuck Razalas says:

    Great tutorial but like every other time I have tried I get the same issue about failure to connect to “” and I have changed the IP and I have changed the usernames and I have made sure to allow the port 18083 and no matter what I do it NEVER works. I have tried on CentOS 7 and now Ubuntu 16.04 LTS and same issue every single time no matter what tutorial I try. I followed this guide to a “T” and same as all the rest. Why is this so complicated and why does it NEVER work?

    • Chuck Razalas says:

      Ok never mind. I finally got it to work. I didn’t change the this time and most importantly, I made sure I did all the steps with the correct User this time. So overall your tutorial was 100% dead on I just didn’t follow the users clause so that was on me. Thanks so much for providing a tutorial that was easy to follow and that actually worked for me.

  4. Chuck Razalas says:

    Quick question SK. Ok so I have everything working perfectly and I did end up having to change the IP to my actual server IP after all. I can login to the PHP Virtual box login and I can see the VM I created and it’s running and all is well except one problem. I can only see it in the console screen and I cannot access the VM from a web browser. My VM is Univention Corporate Server and again I can see it running in the Console but I need to access the Univention Portal from a web browser and not the Virtual Box console. How can I see a VM I create from the outside? No matter what I do I just can’t access it. Thanks in advance.

    • SK says:

      If both systems (VM and the host) are in the same network, you can access it from the web browser. Check the network settings of your VM and make sure you have selected the “Bridged network” option.

      • Chuck Razalas says:

        One problem with that SK. My hosting company 1&1 doesn’t allow Bridging, go figure right? So what I have tried is using adapter 1 as Host Only and adapter 2 as Nat but no luck. I even tried port forwarding from my server ip to and still no luck. Also tried adding the following command in IP Tables: iptables -t nat -A PREROUTING -p tcp -d my.server.ip –dport 80 -j DNAT –to-destination and also no luck. I have tried with Ubuntu 16.04 LTS and now trying again with CentOS 7 as the base. The VirtualBox install process goes off without a hitch. I am then trying to install Univention Corporate Server as a VM in VirtualBox and it installs but always says it could not set a default route and makes me manually enter my netwwork details. I input my server ip, then the submask comes up and it’s different than what the host server submask actually is. I change it to what it is on the actual host server, then when Gateway comes up I try what my hosting company says the host Gateway IP is and always get an error saying it’s unreachable. I then try again with the auto defaults that pop up and again nothing. I’m so frustrated with this at this point. Any other ideas?

        • SK says:

          Hello Chuck, enabling bridge network on VM has nothing to do with hosting provider as far as I know. Because, you’re enabling it on your VM, not in the host system. The VM (The univention server) should be reachable in-order to access it from a remote system. I am not a expert in networking. I don’t know how to do it. My apologies.

  5. Lucien Bunel says:

    Hello !
    I just switched from Ubuntu server 16.04 LTS to Ubuntu server 18.04 LTS
    and I lost my PhPvirtualbox … so I did your tutorial like I did for 16.04, but the Apache2 does not want to start?
    root @ proliant: ~ # journalctl -xe
    – Support:

    – The vboxdrv.service unit (unit) has completed its startup, with the RESU result
    Aug 30 10:58:40 proliant systemd [1]: Starting The Apache HTTP Server …
    – Subject: The unit (unit) apache2.service started to start
    – Defined-By: systemd
    – Support:

    – The unit (unit) apache2.service started to start.
    Aug 30 10:58:40 proliant apachectl [5348]: (98) Address already in use: AH00072:
    Aug 30 10:58:40 proliant apachectl [5348]: (98) Address already in use: AH00072:
    Aug 30 10:58:40 proliant apachectl [5348]: no listening sockets available, shutt
    Aug 30 10:58:40 proliant apachectl [5348]: AH00015: Unable to open logs
    Aug 30 10:58:40 proliant apachectl [5348]: Action ‘start’ failed.
    Aug 30 10:58:40 proliant apachectl [5348]: The Apache error log
    Aug 30 10:58:40 proliant systemd [1]: apache2.service: Control process exited, c
    Aug 30 10:58:40 proliant systemd [1]: apache2.service: Failed with result ‘exit-
    Aug 30 10:58:40 proliant systemd [1]: Failed to start The Apache HTTP Server.
    – Subject: The unit (unit) apache2.service failed
    – Defined-By: systemd
    – Support:

    – The unit (unit) apache2.service failed, with result RESULT.
    proliant root @: ~ #
    do you have an idea ?
    Thanks part ahead

  6. Lucien Bunel says:

    hello it works now after installing
    soap extension

  7. Tanvir says:

    Thank you .
    it worked fine

  8. Gary Cuppett says:

    Are these instructions complete and working for Ubuntu 18.04.1 LTS ???

  9. John Anderson says:

    Just as a note, I was not able to install until I enabled the Canonical universe libraries too.

  10. Shaly says:

    It fails to install virtualbox package expecting few libraries as dependencies – and those libraries are not available as packages from the default repo’s from what I’m seeing. Is that die to the canonical universe libraries?

  11. Jens G says:

    Thanks for this. But I get:

    The following packages have unmet dependencies:
    virtualbox-5.2 : Depends: libqt5x11extras5 (>= 5.6.0) but it is not installable
    Recommends: libsdl-ttf2.0-0 but it is not installable
    Recommends: pdf-viewer

    When running sudo apt install virtualbox-5.2

    Any ideas?

  12. Robin van Ruitenbeek says:

    Hmm.. everything seems to be working but when i try to login it says:

    Exception Object
    [message:protected] => DTD are not supported by SOAP (
    [string:Exception:private] =>
    [code:protected] => 64
    [file:protected] => /var/www/html/phpvirtualbox/endpoints/api.php
    [line:protected] => 134
    [trace:Exception:private] => Array

    [previous:Exception:private] =>

  13. greg says:

    i make it work try this
    vboxwebsrv -H

  14. Toby says:

    Your instructions are on the mark! Much gratitude!

  15. germanguy32 says:

    Oracle Homepage looses against you!
    after a short periode reading on your site, it can be seen: there’s a checker on work! good to know…
    Thx man. can be soo easy—

  16. Ben says:

    Brilliant guide, thankyou!

    Just a heads up on Ubuntu server 18.04 I couldn’t for the life of me get virtualbox to run until I disabled secureboot, followed these instructions to do it :

  17. jfgvtyfyu says:

    Exception Object
    [message:protected] => Could not connect to host (
    [string:Exception:private] =>
    [code:protected] => 64
    [file:protected] => /var/www/html/phpvirtualbox/endpoints/api.php
    [line:protected] => 134
    [trace:Exception:private] => Array

    [previous:Exception:private] =>

    ● vboxweb-service.service
    Loaded: loaded (/usr/lib/virtualbox/; enabled; vendor prese
    Active: active (exited) since Fri 2019-02-22 18:10:56 UTC; 1min 17s ago
    Process: 12659 ExecStop=/usr/lib/virtualbox/ stop (code=exit
    Process: 12667 ExecStart=/usr/lib/virtualbox/ start (code=ex

    févr. 22 18:10:56 ns3311288 systemd[1]: Starting vboxweb-service.service…
    févr. 22 18:10:56 ns3311288 systemd[1]: Started vboxweb-service.service.
    lines 1-8/8 (END)…skipping…
    ● vboxweb-service.service
    Loaded: loaded (/usr/lib/virtualbox/; enabled; vendor preset: enabled)
    Active: active (exited) since Fri 2019-02-22 18:10:56 UTC; 1min 17s ago
    Process: 12659 ExecStop=/usr/lib/virtualbox/ stop (code=exited, status=0/SUCCESS)
    Process: 12667 ExecStart=/usr/lib/virtualbox/ start (code=exited, status=0/SUCCESS)

    févr. 22 18:10:56 ns3311288 systemd[1]: Starting vboxweb-service.service…
    févr. 22 18:10:56 ns3311288 systemd[1]: Started vboxweb-service.service.

    service starting work login

    user admin
    password admin

    not work please solve

  18. jfgvtyfyu says:

    ok service not corect start

    juste restart use full command line

    /usr/lib/virtualbox/ stop

    /usr/lib/virtualbox/ start

    and working please update your tutorial

    for add this command

  19. Based on you tutorial I automated the installation and config, also updated the phpvirtualbox to latest and VirtualBox too. Anyone can use this script in terminal copy and execute this –> bash <(curl -sS installVBoxClient –logon-password 'The current user's password'.

    The –logon-password is to install and configure the vbox 6.0 and phpvirtualbox 5.2-1 unattended.

    After installation remember to change the admin/admin credentials.

    Give it a try.

  20. Eric Marcus says:

    Hi, sorry, I didn’t understand the last steps:

    If you want to allow https traffic, but only http (80) traffic, run:

    $ sudo ufw app info “Apache”

    ??? This is just a repeat of a previous step for ufw info, it doesn’t modify the ufw rules?

    Otherwise, thanks!

  21. Roberto says:

    Thanks for this excellent tutorial!!

    Everything works fine, except the phpvirtualbox’s console.

    Clicking on “Console” button, the error message “The Adobe Flash plugin is not installed” shows up.

    I’m using Google Chrome browser (ver. 75.0 last update on July 5, 2019).

    Thanks for any help.

    Best regards

  22. TheWeasel says:

    Having trouble accessing the VMs using rdp. I have tried to create my own RDP connection, and I have clicked on the port number in phpvirtualbox to get a rdp config downloaded. I have updated the IP address to the servers real address, but still can not get a connection to run. I just get the following error.
    1. Remote access to the server is not enabled
    2. The Remote Computer is turned off
    3. The remote computer is not available on the network.

  23. Hugo says:

    Excellent guide.
    Just completed installation of Ubuntu server on a ProLiant 380 box previously running VMware on which I installed VirtualBox.

    The instructions made this task a piece of cake.

    Thank you very much.

  24. george says:

    i would like to set this up on a ubuntu 18.04 LTS server headless thats running iredmail with lemp. how would these instructions differ if this is even possible? thanks Looks like a great tutorial.

  25. Arman says:

    Hello! I want to thank You for this article. It is great, thank You very much I have already install my vm with phpvirtualbox. Thanks a lot.

  26. Martin says:

    Excellent tutorial – however for me it doesn’t work 🙁
    When I try to start phpVirtualBox I get a message box saying
    “An unknown PHP error occurred. This is most likely a syntax error in config.php in phpVirtualBox’s folder. The most common errors are an unclosed quote or a missing semicolon in a configuration item that has been entered (e.g. location, username, or password).

    Depending on your PHP configuration, navigating directly to config.php in your web browser may display the PHP error message.

    If find that this is not the case, or have no idea what this error message means, please raise the issue at

    with no help or indication of what to do.
    I have changed all the ip addresses I can find from to my host ip but that doesn’t work.

    I’m running on ubuntu server 18.04

    Any suggestions on finding and fixing the error message?


  27. Jay says:

    Thank you,

    I am new to Linux and command lines but its fully working

    With love

  28. Peter says:

    If you have set authentication is phpvirtualbox config.php, make sure to do:
    passwd vbox
    –> password
    and set:
    /* Username / Password for system user that runs VirtualBox */
    var $username = ‘vbox’;
    var $password = ‘password’;

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.