Gunbot 7.0.2 and Zeno GUI 1.31 setup on Ubuntu 17.10

TL;DR

In this post I will explain step by step how to install and setup Gunbot 7.0.2 and Zeno GUI 1.31 on Ubuntu 17.10. It also shows how to access the Gunbot GUI and Zeno GUI through a SSH tunnel using PuTTY with port forwarding for enhanced security. A no thrills quick and dirty write-up.

What will we cover in this post?

  1. Setup SSH [client]
  2. Install Gunbot [server]
  3. Configure Gunbot GUI [client]
  4. Install Zeno GUI [server]
  5. Configure Zeno GUI [client]
  6. Install PM2 [server]
  7. Setup aliases [server]

Okay now we know what to do lets get going.

Prerequisites

To follow this blog post the follow prerequisites must be met:

  • You have registered for the exchanges (Bittrex, Binance, Kraken, Poloniex, Cryptopia) you want to run Gunbot against.
  • You have generated two separate API keys pairs for each exchanges you want to buy Gunbot for. Why two separate key API pairs? Too have separate API key pairs for the ProfitTrailer license and for trading on the exchanges itsef. The API keys being used for the Gunbot license only needs minimum authorizations (read only).
  • You have bought a Gunbot licenses and Gunbot licenses for one or exchanges.
  • You have a VPS to run Gunbot on. I use the following two providers, as they provide very good servers at extremely good value for money: RouterHosting and Contabo.
  • You have setup the VPS and connect to it through SSH. Need help? Check out this post.

Optionally you have bought a Zeno GUI licenses for the exchanges you have a Gunbot licenses for. Please use different API keys for the Zeno GUI licenses!

1. Setup SSH [client]

Gunbot currently does not support two factor authentication (2FA) like Zeno GUI does. I also do not feel comfortable opening the server up to the outside world, as the server contains a lot sensitive information e.g. API secret keys. For enhanced security we will use SSH with port forwarding so that the Gunbot GUI and Zeno GUI can only be accessed through an SSH tunnel. This means that the only port that will be exposed to the outside world is the SSH port, which is more hardened and battle tested than either Gunbot GUI or Zeno GUI will ever be.

The following steps are done on the client that will be accessing the server. I have it setup on my Windows laptop, Android phone and Android tablet. For Windows I’m using PuTTY and Android JuiceSSH. The instruction here are limited to PuTTY.

For these instruction we will be running Gunbot GUI (5000), Gunbot WebSocket (5001) and Zeno GUI (8080) on the default ports.

PuTTY is an SSH client. It enables you to create profiles for connections to SSH servers.

  • Start PuTTY by double-clicking its executable file or hitting the Windows key and typing “putty” and hitting the “enter” key;
  • PuTTY’s categories can be navigated on the left-hand side of the window. PuTTY’s initial window is the category “Session”;
  • In the field “Host Name (or IP address)”, enter the IP address of the server or its fully qualified domain name (FQDN) if it is setup in a DNS;
  • Enter the port number in the “Port” field. For added security, consider changing your server’s SSH port to a non-standard port or setting up a SSH/SSL multiplexer;
  • Select “SSH” under “Connection type”;
  • Select the sub-category “Data” under “Connection”;
  • In the field “Auto-login username” enter the user to use when logging into the SSH server. For now enter root here;
  • Expand the sub-category “SSH” under the category “Connection”;
  • Highlight the sub-category “Auth”;
  • Click on the button “Browse”;
  • Select the users private key and click the button “Open”;
  • Select the sub-category “Tunnels” under the sub-category “SSH”;
  • Enter the value “5000” in the field “Source port”, enter the value “localhost:5000” in the field “Destination” and click the button “Add”;
  • Enter the value “5001” in the field “Source port”, enter the value “127.0.0.1:5001” in the field “Destination” and click the button “Add”;
  • Enter the value “8080” in the field “Source port”, enter the value “localhost:8080” in the field “Destination” and click the button “Add”;
  • Return to the category “Session” and enter a name for this profile in the field “Saved Sessions”, e.g. [email protected] or [email protected];
  • Click the button “Save” to save the profile;
  • Click the button “Open” to connect to the server.

2. Install Gunbot [server]

Check out the Gunbot GitHub for the latest release and adjust the following commands accordingly.

Okay lets install Gunbot so only our user has access to it and can execute it.

# Create directory for Gunbot
sudo mkdir -p /opt/gunbot/gunbot-v7.0.2

# Change ownership to our user
sudo chown -R nidkil:sudo /opt/gunbot

# Change rights so only our user can access and execute
chmod -R 700 /opt/gunbot

# Create a soft symbolic link to the current version, comes in handy for aliases
ln -s /opt/gunbot/gunbot-v7.0.2/ /opt/gunbot/gunbot-current

# Change to Gunbot directory
cd /opt/gunbot/gunbot-current

# Download latest release of Gunbot
wget https://github.com/GuntharDeNiro/BTCT/releases/download/702/Gunbot.XT.Edition.-.Linux.package.zip

# Unzip the file
unzip *.zip

# Move the files to the main directory
mv "Gunbot XT Edition - Linux package"/* .

# Remove the zip
rm *.zip

# Remove the empty directory
rm -r "Gunbot XT Edition - Linux package"

# Make programs executable
chmod u+x gunthy-linx64 gunthy-gui-linx64

# Start Gunbot GUI
./gunthy-gui-linx64

3. Configure Gunbot GUI [client]

Now open a browser on the client and enter the following URL.

http://localhost:5000

Quick steps to setup Gunbot and test if it is working correctly:

  • As it is the first time the GUI is executed you are required to create a password;
  • You have the choice of loading the settings from an existing config.js file or entering them manually. We will enter the minimum settings manually;
  • Enter the API keys for the exchanges you are licensed for;
  • On the next tab “BOT” turn on the “Watch Mode”, so that you can run against the exchange in test mode without actually trading.
  • Also turn on “Debug”.
  • In the “Advanced mode” settings enter your Telegram ID;
  • Click the button “Save”;
  • In the top bar click on the drop down button “Setups” and click on “New Setup”;
  • Select the exchange from the “Exchange” drop down you want to add a pair from;
  • Enter the pair “BTC-NEO” in the field “Pair Name”. It has the format [Base Currency]-[Market Currency]. Market currency is the currency you want to buy, base currency is the currency you want to buy it with;
  • From the drop down “Strategy” select “Emotionless”;
  • Click the button “Add”;
  • Add the following pairs with the same strategy: BTC-ETH, BTC-LTC;
  • Click the button “Create”;
  • In the top bar click on the button “Dashboard”;
  • Click on the button “Preview”;
  • Click on the button “Run Gunbot”;

Gunbot should be running without any errors. If everything is running smoothly click on the button “Stop” and click on “Logout”. Now you can close the browser.

On the server shutdown Gunbot GUI using Ctrl+C.

4. Install Zeno GUI [server]

Check out the Zeno GUI GitHub for the latest release and adjust the following commands accordingly.

wget https://github.com/zenocrypto/zeno-gui/releases/download/1.310/zeno-gui-linux-1.31.zip

# Unzip the file
unzip *.zip

# Remove the zip
rm *.zip

# Make programs executable
chmod u+x zeno-gui-linux-x64

You need to retrieve your license file from the Zeno GUI Assistant (@Zeno_GUI_bot) in Telegram.

  • Open the bot;
  • Enter “/start”;
  • Click on the option “Download license file”;
  • Click on the version you want to download the license file for;
  • Click on the file zeno-license.file;
  • Open the file and copy the contents.

Create the file on the server.

# Change to gunbot directory
cd /opt/gunbot/gunbot-current

# Create and open the license file
vim zeno-license.file

Paste the contents of the zen-license.file you downloaded from Telegram and save and close the file on the server.

Lets start Zeno GUI.

# Start Zeno GUI
./zeno-gui-linux-x64

5. Configure Zeno Bot [Telegram]

To control Zeno GUI through Telegram you need to go to BotFather (@BotFather) in Telegram.

  • Enter “/newbot”;
  • Enter “zeno_gui_bot” as the display name;
  • Enter “[unique id]_zeno_gui_bot” as the username. Replace unique_id by a value to ensure the username is unique;
  • Copy the HTTP access token you will need it in the next step.

6. Configure Zeno GUI [client]

Now open a browser on the client and enter the following URL.

http://localhost:8080

Quick steps to setup Zeno GUI and test if it is working correctly:

  • Select the option “No certificate” as we are accessing the server through an SSH tunnel we do not need a SSL or a certificate or two factor authentication (2FA);
  • Click on the button “Save”;
  • Restart Zeno GUI on the server as it was shutdown automatically;
  • In the field “Password” enter a password;
  • In the field “GUI name” enter the value “zeno-gui”;
  • Enter the API secret keys for the exchanges you are licensed for;
  • Click on the button “Save”;
  • Restart Zeno GUI on the server as it was shutdown automatically;
  • Enter your password and click on the button “Login”;
  • Click on the Gunbot configuration button;
  • Enable “debug” and “WATCH_MODE”;
  • Enter your Telegram id;
  • Click on the button “Save”;
  • Click on the “Options” button;
  • Click on the button “Add pairs”;
  • Add the following pairs with the “emotionless” strategy: BTC-NEO, BTC-LTC, BTC-ETH;
  • Click on the button “Save”;
  • Click on the “Options” button;
  • Click on the button “Edit configuration” under “Telegram bot”;
  • Past the HTTP access token you copied in the previous part;
  • Click on the button “Verify”;
  • Click on the button “Add User”;
  • Go to the bot you created in Telegram and enter “/start”;
  • Enter the code that was generated by “Add User”;
  • Click on the button “Save”;
  • Click on the “Start/Stop” button in the browser. Or alternatively you can start and stop using the Telegram bot;
  • Check that the logs do not contain errors.

Zeno GUI should be running without any errors. If everything is running smoothly click on the “Start/Stop” button. Now you can close the browser.

On the server shutdown Zeno GUI using Ctrl+C.

6. Install PM2 [server]

PM2 is a production process manager for applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks. In layman terms, it enables you to start a program and have it continue running in the background even when you logout of the server. We will use pm2 to run Gunbot GUI and Zeno GUI.

Install pm2 with the following commands.

sudo apt install npm
sudo npm install pm2 -g

Quick overview PM2 commands (see PM2 documentation for complete list)

# Start, daemonize and auto-restart application
pm2 start [/path/to/application]

# List all processes started with PM2
pm2 list

# Display memory and cpu usage of each app
pm2 monit

# Show all information about application
pm2 show [app-name]

# Display logs of all apps
pm2 logs

# Display logs for a specific app
pm2 logs [app-name]

# Start application and name it "api"
pm2 start app.js --name="api"

# Start app and pass option "-a 34" as argument
pm2 start app.js -- -a 34

# Reset all counters
pm2 reset [app-name]

# Stop all apps
pm2 stop all

# Stop process with id 0
pm2 stop 0

# Kill and delete all apps
pm2 delete all

# Delete app with id 0
pm2 delete 0

Okay, start Gunbot GUI and Zeno GUI with PM2 using the following commands.

pm2 start /opt/gunbot/gunbot-current/gunthy-gui-linx64 --name gunbot-gui
pm2 start /opt/gunbot/gunbot-current/zeno-gui-linux-x64 --name zeno-gui

7. Setup aliases [server]

Lets add some aliases for convenience. Aliases are custom commands you can issue from the command line, that execute more complex commands. Open the alias file.

vim ~/.bash_aliases

This file is loaded by ~/.bashrc. On Ubuntu 10.04, the following lines need to be uncommented to enable the use of ~/.bash_aliases. On Ubuntu 11.04 and later, it’s enabled by default. Add the following aliases.

alias gl="pm2 list"
alias gcd="cd /opt/gunbot/gunbot-current/"
alias brl="source ~/.bashrc"

The alias commands will be available on any new terminal. To have the alias commands available in the current terminal you need to run the following command.

source ~/.bashrc

Summary

This is a basic introduction to installing and configuring Gunbot and Zeno GUI. In the future I will be posting more blogs about Gunbot and Zeno GUI. Stay tuned!

Related posts

If you liked this post, you might be interested in the following posts.

Advertisements

One thought on “Gunbot 7.0.2 and Zeno GUI 1.31 setup on Ubuntu 17.10

  1. Pingback: Initial server setup Ubuntu 17.10 | Adventures of a space monkey

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s