How to install VirtualBox on Scaleway's x86_64 servers

Posted on Aug 13, 2016

Scaleway offers reasonably priced dedicated servers that are now even cheaper than Hetzner’s robo market.

I wanted to use them for doing Ansible tests using Vagrant. The problem is you can’t easily install VirtualBox there, and it’s needed for Vagrant to work.

Here’s a script that should do most of the work for you:


# Expects Ubuntu 16.06 (xenial) and kernel 4.x.
# Based upon a blog post by Zach at

set -eux

# Have the user call sudo early so the credentials is valid later on
sudo whoami 

for x in xenial xenial-security xenial-updates; do 
  egrep -qe "deb-src.\* $x " /etc/apt/sources.list || echo "deb-src ${x} main universe" | sudo tee -a /etc/apt/sources.list

echo "deb xenial contrib" | sudo tee -a /etc/apt/sources.list.d/virtualbox.list
sudo apt update
sudo apt-get install dkms virtualbox-5.0 -y

KERN\_VERSION=$(uname -r |cut -d'-' -f1)
EXTENDED\_VERSION=$(uname -r |cut -d'-' -f2-)
cd /var/tmp
tar xf linux-${KERN\_VERSION}.tar.xz -C /var/tmp/
cd "${KERN\_DIR}"
zcat /proc/config.gz > .config

# Fetch the tools necessary to build the kernel. Using generic because there may not be a package for our $KERN\_VERSION.
sudo apt-get build-dep linux-image-generic -y

NUM\_CORES=$(cat /proc/cpuinfo|grep vendor\_id|wc -l)

make -j${NUM\_CORES} oldconfig include modules

sudo -E /sbin/rcvboxdrv setup

# Check that it's fine.
VBoxManage --version

I hope it works for you. It worked for me. See also the gist here. You can download it directly from your box:

$ wget

```Let me know how it goes. Have fun!
# Archived Comments