I wrote a little bash script that will install all the necessary packages for Ubuntu 16.04/18.04 to get phBot working. It is meant to bring a new VPS up to date and is not for anyone running Ubuntu on their desktop.
Just run this command on a new install:
wget -q https://cdn.projecthax.com/ubuntu && bash ubuntu
Script contents:
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo 'In order for this script to run correctly, it must be run as root'
exit 1
fi
read -r -p "This script is intended to be run on a fresh install of Ubuntu 16.04/18.04 x64, do you wish to proceed? [y/N] " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
# Update the system
echo '> Updating the system'
sudo apt update && sudo apt upgrade -y && sudo apt dist-upgrade -y && sudo apt autoremove -y && sudo apt install -y software-properties-common fail2ban unattended-upgrades p7zip-full curl lsb-release
# Wine repository
echo '> Adding the Wine repository'
curl https://dl.winehq.org/wine-builds/winehq.key | apt-key add -
apt-add-repository "deb https://dl.winehq.org/wine-builds/ubuntu/ $(lsb_release -c --short) main"
# Wine
echo '> Installing wine and desktop environment'
sudo add-apt-repository -y ppa:cybermax-dexter/sdl2-backport
sudo dpkg --add-architecture i386 && sudo apt update && sudo apt install -y wine-stable winetricks lxde-core lxterminal xrdp
# Add the phBot user
echo '> Adding the phBot user'
sudo useradd phBot -s /bin/bash -m -G users,sudo
sudo passwd phBot
# Change the X session for xrdp
sudo -H -u phBot echo lxsession -s LXDE -e LXDE > /home/phBot/.xsession
sudo sed -i.bak '/fi/a #xrdp multiple users configuration \n lxsession \n' /etc/xrdp/startwm.sh
# vcrun2013
echo '> Installing vcrun2013 / corefonts'
sudo -H -u phBot winetricks -q vcrun2013 corefonts
# Stable
echo '> Downloading phBot stable'
BOT_VERSION=`curl -L http://cdn.phbot.org/stable/update.txt | python3 -c 'import json,sys;obj=json.load(sys.stdin);print(obj["phBot.exe"]["version"])'`
sudo -H -u phBot curl -L http://cdn.phbot.org/stable/$BOT_VERSION.zip > /home/phBot/stable.zip
sudo -H -u phBot mkdir -p /home/phBot/Desktop/stable/
sudo -H -u phBot 7za -y x /home/phBot/stable.zip -o/home/phBot/Desktop/stable/
rm -f /home/phBot/stable.zip
# Testing
echo '> Downloading phBot testing'
BOT_VERSION=`curl -L http://cdn.phbot.org/testing/update.txt | python3 -c 'import json,sys;obj=json.load(sys.stdin);print(obj["phBot.exe"]["version"])'`
sudo -H -u phBot curl -L http://cdn.phbot.org/testing/$BOT_VERSION.zip > /home/phBot/testing.zip
sudo -H -u phBot mkdir -p /home/phBot/Desktop/testing/
sudo -H -u phBot 7za -y x /home/phBot/testing.zip -o/home/phBot/Desktop/testing/
rm -f /home/phBot/testing.zip
# Swap less often
sudo echo 'vm.swappiness=1' >> /etc/sysctl.conf
echo '> After the reboot connect to the server through Remote Desktop Connection with the username phBot and the password you have chosen'
echo '> Open the stable or testing folder on the desktop and run phBot.exe like normal'
reboot
else
exit 1
fi
If you have problems with small fonts, run winecfg
and increase the DPI to 120.