Join domain on Ubuntu

It took me a while to find out how to join a domain (Microsoft Active Directory) on Ubuntu (16.04). I’ve adapted this guide to the following:

sudo apt update
sudo apt install ssh -y
wget https://github.com/BeyondTrust/pbis-open/releases/download/8.5.2/pbis-open-8.5.2.265.linux.x86_64.deb.sh
sudo chmod +x pbis-open-8.5.2.265.linux.x86_64.deb.sh
sudo ./pbis-open-8.5.2.265.linux.x86_64.deb.sh
sudo domainjoin-cli join <domain> <username>
sudo reboot #if necessary

This is not an universal solution. There are chances you’ll need extra steps depending on your network’s configuration.