OptionsApp on Linux, part 1: set up the Ubuntu server
This is part 1 of 4 of the guide OptionsApp on Linux. You create an SSH key, install Ubuntu on the server and open the required ports. Then you connect to the server for the first time, set it up with the setup script and give your user SSH access. The guide is meant for users who already work with Linux. Requirements and placeholders such as IP-ADDRESS and USERNAME are listed in the overview.
Step 1: Create an SSH key on Windows
An SSH key lets you log in to the server without a password. It consists of 2 files: the private key, which stays on your PC, and the public key (extension .pub), which you add to the server.
Open PowerShell and enter:
mkdir -Force $HOME\.ssh
ssh-keygen -t ed25519 -f $HOME\.ssh\optionsapp_vpsssh-keygen asks for a passphrase. This is a password that encrypts the private key.
Write the passphrase down in your password manager right away. It is not stored anywhere and cannot be recovered. You can also leave it empty (press Enter twice), but then anyone who gets hold of the key file can connect to your server.
Display the public key:
Get-Content $HOME\.ssh\optionsapp_vps.pubThe output is a single line that starts with ssh-ed25519. You need this line in step 2.
Only share the file with the extension .pub. The file optionsapp_vps without an extension is your private key and must not leave your PC.
Step 2: Install Ubuntu and add the key
At STRATO, you add the public key when you install or reinstall the operating system. Select Ubuntu (LTS version) under "Betriebssystem" and paste the line from step 1 into the field "Public SSH-Key". This means you have to create the key before the installation. It is already in the OpenSSH format that STRATO requires, so you paste the line unchanged. STRATO describes this here (in German): SSH-Keys erstellen, um sich an Ihrem STRATO VPS/VDS Linux anzumelden.
STRATO also asks for a password for root in this dialog ("Passwort"). Write it down as well. You do not need it for SSH, but for the console in the customer portal (see the emergency exit in step 10).
Reinstalling deletes all data on the server.
With other providers, the option is usually called "SSH key" and is requested when you create the server.
If your provider does not accept the key, create it in RSA format with ssh-keygen -t rsa -b 4096 -f $HOME\.ssh\optionsapp_vps. The file name stays the same, and all other commands work unchanged.
After the installation, note down the IP address of the server. Your key is now set up for the user root.
Step 3: Open the ports in the firewall
Only 2 ports need to be reachable from outside:
| Port | Protocol | Used for |
|---|---|---|
| 22 | TCP | SSH: setup and file transfer |
| 3389 | TCP | Remote Desktop (RDP, Remote Desktop Protocol) |
All other incoming ports can stay closed. Outgoing connections must stay allowed, otherwise updates, the connection of TWS to Interactive Brokers and OptionsApp will not work.
If you have a static IP address, open the ports for this address only. Port 3389 is constantly scanned on the internet for weak passwords. If your IP address changes regularly, step 10 (access via Tailscale only) is the better solution; afterwards, both ports stay closed.
You set the firewall rules in your provider's customer portal. You do not need to set anything on the server itself for this, and at this step you have no access to it yet. At STRATO, you also have to switch the firewall on in the customer portal: as long as "Inaktiv" (inactive) is shown at the top right, none of the rules apply, so click "Aktivieren" (activate).
Step 4: Run the setup script
In PowerShell, connect to the server as root:
ssh -i $HOME\.ssh\optionsapp_vps root@IP-ADDRESSOn the first connection, ssh asks whether you trust the server ("Are you sure you want to continue connecting"). Answer with yes. If you set a passphrase, you are asked for it now.
Then start the setup script on the server. It sets up the Xfce desktop (a lightweight graphical desktop environment for Linux) and xrdp (a server for RDP, the protocol of Windows Remote Desktop Connection). This step is required: without the script, system libraries that OptionsApp needs are missing (among them libxcb-cursor0), and OptionsApp does not start.
Option A downloads the script as a file first, so you can look at it beforehand (less setup_ubuntu_xrdp.sh):
curl -sSLo setup_ubuntu_xrdp.sh https://optionsapp-bucket.s3.eu-central-1.amazonaws.com/setup_ubuntu_xrdp.sh && sudo bash setup_ubuntu_xrdp.shOption B downloads and starts it in one step:
curl -sSL https://optionsapp-bucket.s3.eu-central-1.amazonaws.com/setup_ubuntu_xrdp.sh | sudo bash -sThe script asks for:
- "Enter username": the user you will later log in with via Remote Desktop. Lowercase letters and digits only, without spaces or accented characters, e.g.
juan. - "Enter password" and "Confirm password": the password for this user, shown as asterisks. Choose a strong password, because you use it to log in via Remote Desktop and to confirm
sudocommands.
After that, the script runs without further questions, for about 10 to 20 minutes depending on the server. At the end, "Setup complete!" appears.
What the script sets up:
| Area | What happens |
|---|---|
| System | All installed packages are updated. |
| Swap | Swap space as large as the RAM (8 GB of RAM gives 8 GB of swap), so that the server does not terminate programs when RAM runs low. |
| Desktop | Xfce as a lightweight graphical desktop. |
| Remote Desktop | xrdp, so that you can log in with Windows Remote Desktop Connection. |
| Browser | Firefox as a regular package (not a Snap) with automatic updates. The Remote Desktop session is configured so that links from OptionsApp open in the browser. |
| Libraries | The Qt and X11 libraries that OptionsApp needs, e.g. libxcb-cursor0. The OptionsApp package does not install them itself. |
| User | Your user with sudo rights. |
You can safely run the script again, e.g. if it was interrupted. Steps that are already done are skipped. If you enter a user that already exists, their password is set to the newly entered one.
Step 5: Set up SSH access for your user
So far, your key is only set up for root. To also log in as your user via SSH and copy files directly into their home directory, you copy the key. Run the following in the SSH session as root and replace USERNAME in the first line:
U=USERNAME
install -d -m 700 -o "$U" -g "$U" "/home/$U/.ssh"
install -m 600 -o "$U" -g "$U" /root/.ssh/authorized_keys "/home/$U/.ssh/authorized_keys"Then restart the server once so that all updates from step 4 take effect:
rebootAfter about a minute, the server is reachable again. In PowerShell, test the login as your user:
ssh -i $HOME\.ssh\optionsapp_vps USERNAME@IP-ADDRESSYou are not asked for a password, at most for the passphrase of your key. Type exit to end the session.
Optional: shorter commands
With an entry in the SSH configuration, you do not have to specify the key, user and IP address every time. Run this once in PowerShell, replacing IP-ADDRESS and USERNAME first:
Add-Content -Encoding ascii $HOME\.ssh\config @"
Host optionsapp-vps
HostName IP-ADDRESS
User USERNAME
IdentityFile ~/.ssh/optionsapp_vps
"@After that, ssh optionsapp-vps and scp file.zip optionsapp-vps:~/ are enough.
Continue with part 2: Remote Desktop and file transfer. All parts at a glance: OptionsApp on Linux.
More in the article Video 2: Adding a Strato Server.