How to install VirtualBox on Scaleway's x86_64 servers

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!

Popular posts from this blog

How to crack Windows Terminal Services 3 month trial

Caveats about Linux connection tracking and high traffic servers