Howto Install an Ubuntu Server for Metatrader5 (MT5) (with RDP)

Choose a Server

I personally prefer a German Cloud Server from Hetzner.com, very reliable and good prices. First choose a location (Nuremberg, Falkenstein and Helsinki available). It doesnt make a big difference where your Cloud is located, unless you are a High-Frequency Scalper. Then choose the newest Ubuntu Image available (eg. 20.04) and a non-dedicated Server with a local SSD. You really dont need many CPU ressources or Network storage.
Lastly I recommand to choose 2 Cores (VCPUs), 4GB Ram and the lowest SSD size available (40GB is more than enough). In this case the Server costs are 5.83€/monthl (CX21). Thats enough to smoothly run Ubuntu with a Desktop you can connect to via RDP, start several independant Metatrader 5 instances via the Windows Emulator WINE and open a dozen Charts with EAs on top of it. After you get the Root-Password from your Provider and you logged in as Root, proceed as follows:

Update, Cleanup

Update all, Cleanup all
apt -y update && apt -y upgrade && apt -y autoclean && apt -y clean && apt -y autoremove --purge

Install some basic stuff
apt install -y vim mc tree wget curl bzip2 unzip tar git htop ca-certificates rsync bind9-utils net-tools

Install Firewall related
apt install -y fail2ban

Create a User

adduser matze
usermod -aG sudo matze
passwd -l root disable root account, reboot and log in as user. Never log in as root again.

Harden, Firewall

sudo vi /etc/ssh/sshd_config
PermitRootLogin no
MaxAuthTries 4
MaxSessions 2


sudo vi /etc/fail2ban/jail.local
[DEFAULT]
bantime = 8h
ignoreip = 127.0.0.1/8
ignoreself = true
[sshd]
enabled = true
port = 22
filter = sshd
logpath = /var/log/auth.log
maxretry = 3


Start and check Firewalls
sudo ufw allow ssh
sudo ufw enable
sudo ufw status
sudo fail2ban-client status

Install RDP Remote Desktop

sudo apt install -y xrdp
sudo systemctl status xrdp
sudo ufw allow 3389
sudo adduser xrdp ssl-cert

Install Desktop Environment, Wine

sudo apt install ubuntu-desktop gnome-tweaks
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y wine wine32 wine64 winbind

Connect with your Server via RDP

  • Reboot your Server, Desktop Environment should start now and you can connect to your Server via RDP, Username and Password
  • Change setting: Activities -> Tweaks -> "Adwaita Dark" ...
  • Start Firefox and download Metatrader5 / Metatrader4, open a terminal in your Download Directory /home/matze/Downloads/ and execute
    wine mt5setup.exe
  • Install Python3 for various scripts

    sudo apt install python3-pip pip3 install pandas # dataframes
    pip3 install ccxt # coin exchange lib
    pip3 install scipy # various computing
    pip3 install scikit-learn # ML
    pip3 install finplot # pyqtgraph metalib