OptionsApp on Linux, part 3: install OptionsApp and TWS or IB Gateway
This is part 3 of 4 of the guide OptionsApp on Linux. You install OptionsApp and TWS or IB Gateway in the Remote Desktop session and connect the two. The guide is meant for users who already work with Linux. It builds on part 1 and part 2.
Step 8: Install OptionsApp
The installation file is called optionsapp_VERSION_amd64.deb. Bring it to the server with method A or method B from step 7. Open a terminal in the Remote Desktop session and change to the folder that contains the file, e.g.:
cd ~/DownloadsInstall the file:
sudo apt install ./optionsapp_VERSION_amd64.debsudo asks for the password of your user. You do not have to type the file name: enter ./optionsapp and press the Tab key, and the terminal completes the rest. The ./ before the file name is important. Without it, apt searches the internet for a package with this name. apt installs the dependencies listed in the package automatically; the other libraries come from the setup script in step 4.
At the end, apt may print a notice starting with "Download is performed unsandboxed as root". It only says that apt read the file with root rights, because its own user _apt has no access to your home directory. The installation is complete.
You start OptionsApp from the menu ("Office", then "OptionsApp") or in the terminal with optionsapp.
Update and uninstall
OptionsApp keeps your settings, strategies and trade data in the folder ~/.local/share/OptionsApp. Back up this folder before every update and before uninstalling. Close OptionsApp first, then copy the folder in the terminal:
cp -a ~/.local/share/OptionsApp ~/OptionsApp-backup-$(date +%F)| Task | Command |
|---|---|
| Update to a new version | sudo apt install ./optionsapp_NEW-VERSION_amd64.deb |
| Uninstall | sudo apt remove optionsapp |
Close OptionsApp before you install a new version. sudo apt remove optionsapp removes the program only; the folder ~/.local/share/OptionsApp with your data stays on the server. If you want to remove the data as well, delete this folder yourself after backing it up.
Step 9: Install TWS or IB Gateway
OptionsApp connects to Trader Workstation (TWS) or to IB Gateway from Interactive Brokers. Both provide the same API connection; they differ in their user interface. Install the program in the Remote Desktop session, because its installer has a graphical interface. Where this guide mentions TWS, the same applies to IB Gateway.
On a server, IB Gateway is the better choice. It needs noticeably less RAM and CPU than TWS, because it does not load the trading interface of TWS. This leaves more resources for OptionsApp.
Use the version that OptionsApp recommends. You find the matching installers for Linux on the "Downloads" page of the OptionsApp user portal, under "TWS & IB Gateway". Download the file for x64 in Firefox in the Remote Desktop session.
Install IB Gateway (recommended)
The file is called e.g. ibgateway-stable-standalone-linux-x64_VERSION.sh. Make it executable in the terminal and start it. You do not have to type the file name: enter ./ibgateway and press the Tab key.
cd ~/Downloads
chmod +x ibgateway-stable-standalone-linux-x64_VERSION.sh
./ibgateway-stable-standalone-linux-x64_VERSION.shThe installer guides you through the installation. Afterwards, you find IB Gateway in the menu. The API settings of IB Gateway are the same as on Windows, see TWS API settings in the OptionsApp documentation.
Install TWS (alternative)
If you prefer the full trading interface of TWS, install TWS the same way. The file is called e.g. tws-stable-standalone-linux-x64_VERSION.sh:
cd ~/Downloads
chmod +x tws-stable-standalone-linux-x64_VERSION.sh
./tws-stable-standalone-linux-x64_VERSION.shThe installer guides you through the installation. Afterwards, you find TWS in the menu. The API settings of TWS are the same as on Windows, see TWS API settings in the OptionsApp documentation.
Connect OptionsApp to TWS or IB Gateway
OptionsApp and TWS or IB Gateway run on the same server. In the connection settings of OptionsApp, enter 127.0.0.1 as the host and the port of the program you use:
| Program | Account | Port |
|---|---|---|
| TWS | Live | 7496 |
| TWS | Paper | 7497 |
| IB Gateway | Live | 4001 |
| IB Gateway | Paper | 4002 |
These are the default ports of Interactive Brokers. The port in OptionsApp must match the socket port in the API settings of TWS or IB Gateway. Host, port and client ID are described in TWS API settings.
Back to part 2: Remote Desktop and file transfer. Continue with part 4: Tailscale, troubleshooting and security. All parts at a glance: OptionsApp on Linux.
See also: Download & Installation of OptionsApp and Recommended TWS Restart Settings.