I tested this on Debian 9.6 however this guide should work on any recent Debian distribution such as Ubuntu.
Required Packages
First we need to install all of the required programs and library's.
Open up a root terminal. If your not root, enter this to become root
sudo su
Install the following packages
apt install git make cmake libssl-dev libbz2-dev build-essential default-libmysqlclient-dev
We need to grab the mysql stuff from here. Follow the instructions there. A