This is an installation guide for the latest version of BlueZ, the official Linux Bluetooth protocol stack, on Ubuntu.

I used this to get MIDI over BLE working on Ubuntu 16.04.

Installing the Dependencies

Use your package manager to install the following dependencies:

sudo apt install libudev-dev libical-dev libreadline-dev libdbus-1-dev libasound2-dev
You'll also need the usual build tools, so install them as well if you haven't already:
sudo apt install build-essential

Downloading BlueZ

You can download the latest version from www.bluez.org, or download it directly from the command line. Then extract the file you downloaded.

cd /tmp
wget https://mirrors.edge.kernel.org/pub/linux/bluetooth/bluez-5.50.tar.xz
tar -xf bluez-5.50.tar.xz

Building and Installing BlueZ

Finally, run the configure script and make and install everything. Also reinstall the version from the package manager, as explained here.

cd bluez-5.50
./configure --enable-midi --with-systemdsystemunitdir=/etc/systemd/system
make
sudo make install
sudo apt-get install --reinstall bluez
That's it! After rebooting, MIDI over BLE should work.
The first time after rebooting, my computer seemed kind of slow, but rebooting again solved that problem.

Shell Script

Here's a shell script that executes the previous steps for you.

bluez.sh

sudo apt-get install -y \
    libudev-dev libical-dev libreadline-dev libdbus-1-dev libasound2-dev \
    build-essential

cd /tmp 
wget https://mirrors.edge.kernel.org/pub/linux/bluetooth/bluez-5.50.tar.xz
tar -xf bluez-5.50.tar.xz

cd bluez-5.50
./configure --enable-midi --with-systemdsystemunitdir=/etc/systemd/system
make
sudo make install
sudo apt-get install --reinstall bluez

You can download it here. Then allow execution and run it:

chmod +x bluez.sh
./bluez.sh

Tested on