I'm using Xubuntu for this guide, but it should work on any Ubuntu based distribution. After much head scratching, I hammered out this script to do it:
#/bin/bash # Get current processor architecture tarc=$(dpkg --print-architecture);
echo $tarc; # Get Codename of whatever version of Ubuntu we are running trels=$(awk -v var=$(lsb_release -rs) '$3~var {print $4" "$5;exit;}' /usr/share/python-apt/templates/Ubuntu.info | cut -d"'" -f2);
echo $trels; # shorten to the first word only
treps=$(echo $trels | head -n1 | cut -d " " -f1); # make lowercase
treps=$(echo "$treps" | tr '[:upper:]' '[:lower:]'); # string composure tstr=$(echo "sudo dpkg --add-architecture "${tarc}); # run add-architecture string above as command
eval $tstr; # (this part lifted from WineHQ website)
wget -nc https://dl.winehq.org/wine-builds/winehq.key
sudo apt-key add winehq.key # more string composure trepos=$(echo "sudo add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ "$treps" main'"); # run add-repository string above as command
eval $trepos;
sudo apt update # installing the stable version. You could use 'wine-devel' or 'wine-staging' if you wanted instead of 'wine-stable'
sudo apt install --install-recommends wine-stable # run wine config to make sure wine engine is configured. Hand over to GUI prompts.
winecfg
You can copy and paste into a new document, or download the script if you want. Whichever is easiest. Don't forget to right-click > Properties > Permissions and Allow to run as a program. install-wine.sh