SUPERALGOS TIPS & TRICKS

Superalgos Setup Tutorial for Ubuntu with a Free VPS

This tutorial aims to help everyone to install ubuntu on a VPS and run the Superalgos platform… all for free!

Vice Remix
Superalgos | Algorithmic Trading

--

Photo by Fotis Fotopoulos on Unsplash

If you are not familiar with Linux or running a Server on a VPS stay with me, I’ll show you every step.

Who didn’t dreamed of being able to run a Linux Server on a VPS and install the most powerful Crypto Trading Tool?

For those of you who don’t know what is Superalgos. Superalgos is an open-source project crowdsourcing superpowers for retail traders with a trading automation platform that helps them play smarter, stronger, and faster, either building their own strategies or following others, working alone or joining decentralized trading organizations. Exciting isn’t it?

Let’s have a look at the entire process so you can understand what we will do today!

First we will subscribe to Oracle Cloud for a free Linux VPS , then we will create an Ubuntu Virtual Machine.

Once this is done we will go into the dark part of Linux … the terminal!

But don’t worry, I got you covered, you’ll just have to follow and copy / paste command lines!

Once Ubuntu is set up, we will install the Superalgos platform.

Are you ready to dive in?

First thing first we need to subscribe to Oracle Cloud for their Free Tier offer. You can get for free one VM with 4 Arm-based Ampere A1 cores and 24 GB of memory plus 200 Go of storage! Isn’t it incredible for free?! This may depend on your location, though.

Just go to…

https://www.oracle.com/cloud/free/#always-free

… and create your account. You will be asked for some personal details and your credit card info (they will make a 1$ transaction and send you the money back just to ensure your account is not a spamming bot.)

Once it’s done let the fun part begin!

Disclaimer: This entire tutorial is made on an OSX machine. You can easily follow along from a Windows computer by downloading a free software called “Putty SSH” which will replace the SSH Key generation and the Terminal. So if you are on Windows when you read “open the Terminal” for you it’ll means “Open Putty SSH”!

Before creating the VM on Oracle we will need to generate an SSH key.

SSH stands for Secure Shell and is a cryptographic protocol based on the concept of public-private keys.

SSH is a way to authenticate with a server, without exposing your username and password.

I’ll cover how to do it on OSX in the Terminal but the process if very similar for Windows just google search “putty generate ssh key” and you will be good to go.

For OSX users, open the Terminal on your Mac by typing “Terminal” on the Spotlight Search and then type:

ssh-keygen -t rsa

The Terminal will ask you where do you want to save the key. The default folder is ( /Users/YOURUSERNAME/.ssh/ ) and it’s perfect because it will be easy to find your key later on. Just hit Enter!

Then the terminal will stop again and ask for a Passphrase. Don’t skip this part, please type a password to secure the access to your SSH Key.

You should get this result:

Your identification has been saved in /Users/YOURUSERNAME/.ssh/id_rsa
Your public key has been saved in /Users/YOURUSERNAME/.ssh/id_rsa.pub

This command just created two files, the .pub is the public one, the one we will need to upload on Oracle Cloud.

To find this files just open a Finder windows and use this keyboard shortcut:

Shift + Command + G

For the destination just paste the folder you get in the previous terminal windows:

/Users/YOURUSERNAME/.ssh

You should have a finder windows like this:

Folder containing your SSH Public and Private Key

You can keep this windows open we will need it in the next step.

Now it’s time to create the Virtual Machine on Oracle Cloud.

Just follow this quick video :

Once your VM is running we will configure the Oracle Firewall to allow Remote Desktop connection later on.

Talking about Firewall and security… during the setup process we will disable the Ubuntu Firewall and use only the one from Oracle cloud to allow connection on the ports we need. This VM will be “vulnerable” so don’t use it to trade like that, security measure will be covered on a next article.

Now the Virtual Machine is running and the Remote Desktop port is open let’s jump in the fun part!!

You will need the IP address of your Oracle VM and your username to connect. This info can be found on your Instances panel on Oracle Cloud.

Here is the Oracle Panel where you can find the infos you need.

Let’s go back to the terminal and connect for the first time to your VM with this simple ssh command :

ssh username@ipadress

Adapt this command to connect to your server with YOUR username and YOUR IP address of course. For me it will be:

ssh ubuntu@141.145.207.179

You should get a security message because it’s the first time you connect to this server:

Type yes and hit enter.

This IP address is added to the list of known hosts and you get disconnected. Sometimes you don’t get disconnected, just skip the next command if you didn’t get disconnected.

Type the SSH connection command again if you got disconnected:

ssh ubuntu@141.145.207.179

The server will ask for your SSH Passphrase. I hope you write it down somewhere because now you will need it! (By the way, when you type password on Linux, nothing happens on your screen. That’s normal, just type your password and hit enter at the end.

Here is what you should see on your terminal after the Passphrase :

The last line is the most important, you see your user name @ your instance name. if that’s the case it’s perfect!

Now let’s make you a root user to install all what we need!

Type:

sudo -s 

You should get this:

Can you see the # at the end of the line? This mean your are a root user! Nothing can stop you now.

Type:

cd

This brings you back to your home folder on this VM.

You should have this. You are still here? Let’s dive in!

First we will update everything. With Linux you need two actions to do that; one to check what needs to be updated and one to update packages.

Type:

apt update -y

Lots of things will happen on the terminal but it’s ok!

You should get something like this saying X packages can be upgraded.

So let’s upgrade them!

To do so, type:

apt upgrade -y

During the update you might encounter one or two very ugly pink screen…no worries!

Just hit enter for this one!
And for this one press “Tab” to move the cursor to the “ok” button and hit enter!

After the updating process you should get this:

Nothing is outdated so we are good to go!

Now let’s install a desktop interface and the XRDP protocol to access this server with a remote desktop in case some of you prefer this option over a headless server.

Type:

apt-get install ubuntu-desktop -y

This might take around 5 to 8 min to run… what a perfect timing for a coffee break!

Photo by Alexander Mils on Unsplash

You might see the ugly pink screen again… just do the same as before. Hit enter on the message without option and press “Tab” for the other one until you can hit “Ok”. Don’t worry about the reboot warning on this message; we will reboot pretty soon!

Now we will install XRDP which is the protocol to use Microsoft Remote Desktop and access our Ubuntu desktop.

Type:

apt-get install xrdp -y

Once again you might encounter the pink screen… just hit ok on them!

Now we will erase the Ubuntu Firewall settings because it’s easier to manage the security with the Oracle Cloud Interface (more on that at the end of this article). To do that, type:

cp /etc/iptables/rules.v4 /etc/iptables/rules.v4.bak && sudo truncate -s 0 /etc/iptables/rules.v4

The next command will fix a small Ubuntu bug which ask for your password every 5 minutes when you use the Remote desktop…it’s so annoying, let’s disable it!

 rm /usr/share/polkit-1/actions/org.freedesktop.color.policy

Now we need to change the root password to be able to connect via Remote Desktop, type this command and please choose a strong password:

passwd

You will be asked to type your new password 2 times to confirm.

When it’s done we can reboot our server.

Just type:

reboot

And you will be disconnected.

Let’s wait one minute for the server to reboot (1 Mississippi , 2 Mississippi, 3 Mississippi, … come on 60 Mississippi it’s not that far…)

Next step is to check the remote desktop connection before installing all the packages we need to run Superalgos.

To use the Remote Desktop I suggest that you install Microsoft Remote Desktop which is a free OSX Software from Microsoft and if you are following this tutorial on Windows it’s already installed on every Windows computer.

To connect to the Ubuntu VM, just add the IP address as the PC Name in Remote Desktop.

We will add user / password info when prompted.

At this point the User is “root” and the password is the one you changed just before rebooting the server.

When you first connect with the remote desktop you’ll be welcomed with a quick setup from Ubuntu and we have to remove some screen privacy features in order not to get locked out, just follow the steps in this video!

As you see at the end of the video I opened the Terminal on the Ubuntu Desktop. This is not mandatory, having a remote desktop is just an “option”. You can use it if you want but in my case I will stay with the terminal of my own computer and SSH into the server (like we did earlier) to run all the commands needed to install Superalgos. At this point it’s up to you, results will be the same. And if you are wondering why I choose to use the Terminal on my own computer, it’s because it’s faster.

Before running Superalgos we need to install: Node JS / Git / Python / Chrome-Based Browser if you want to use Remote Desktop.

The first good news is that when we installed Ubuntu-Desktop we already installed a lot of useful packages including Git and Python.

Let’s first check if they are really there.

Type this command if you want to connect via your own computer. Open the Terminal and connect via SSH. If not just skip this step.

ssh ubuntu@YOURIPADRESS

Enter your Passphrase for the SSH Key (this password is not the same as the Root user we created earlier).

Run this command to become root:

sudo -s

Jump back to the home folder:

cd

Lets check if Git is installed and which version is running:

git --version

You should have something like this:

Git is already installed. Perfect!

Now lets check Python (it’s not necessary to install Python except if you want to use the Machine Learning part of Superalgos but it’s already installed so let’s just check if Python is ok.)

Type:

python3 --version

Here is the result:

Python is also installed. Lets move on!

Now we will install Node Js and a few packages that make everything run smoothly.

Just follow the next sequences of commend line and you will be good to go!

First a quick update check:

apt update -y

This should be the result:

All packages are up to date. Perfect!

Then we will install a bundle of useful packages:

apt install build-essential

Type “Y” and hit enter to confirm when prompted.

Here is the result:

Next let’s install Node Js with this command:

apt-get install -y nodejs

And when the terminal finished we will check the version with:

node -v

You should get this:

We have the v18.12.1. Is it good? Just go to www.nodejs.org and check is this is the latest LTS version.

We will then install NPM Webpack to run Node JS without errors.

Just type:

npm install webpack

Here is the result:

Oh! It seems there is a newer version… ok let’s update it!

Type:

 npm install -g npm@9.1.2

We will then check node version:

node -v

And check npm version:

npm -v

You should have something like this:

Ok it seems we are ready to install Superalgos!

Node Js installed? Yes! Git installed? Check! Chrome Browser? Not yet! But for now we don’t need it!

Let’s go for Superalgos install!

I won’t cover in every details how to install Superalgos because you might already be familiar with this process. If it’s not the case you will find all the info you need on the Superalgos Github at this address.

https://github.com/Superalgos/Superalgos

We will install the Developers and Contributors version of Superalgos. Scroll the Github page until you find the part 2 of the install because we just finished the part 1 together on the Ubuntu server.

Type in the terminal:

git clone <URL of your Superalgos fork>

This command will clone your Github Fork into “Superalgos” folder.

Once it’s complete you should get this:

Now it’s the moment of truth!

We will run the “Node setup” command… and this is where usually errors might happens but don’t worry if that’s the case we will handle it!

First lets jump in the Superalgos folder. To do so type:

cd Superalgos

You should get this result:

Notice the /Superalgos# (this is the path where you are).

Now type:

node setup

If nothing exploded you should get something like this:

As we can see there is “vulnerabilities” so let fix them!

To fix and update everything just type:

npm audit fix --force

Here is the result:

We still have vulnerabilities… hum…

Lets follow Ubuntu advice and run the same command again:

npm audit fix --force

Here is the result:

No more High vulnerabilities…we are good to go!

Now we will install all the Superalgos Plugins with this command:

node setupPlugins <Your-Github-Username> <Your-Github-Personal-Access-Token>

Here is the output:

Everything is installed! Lets run Superalgos as a headless server!

We will run the command to launch Superalgos and check if everything works!

node platform

Here is the output:

It works!!!! Yeahhhhhh! Congratulations!!!!

So… that’s it? Now what? How do we access the Design Space to start coding the trading strategy of your dreams?

At this point we have two solutions:

install a Chrome Browser and access the Superalgos interface via the remote desktop.

update the Oracle firewall and access the Ubuntu server running Superalgos on your own computer (called a headless server, which will be perfect for a live trading machine but not for a powerful computer to run data mining).

Lets look first at the Chrome Browser on the Ubuntu Virtual Machine (it will be very slowwwwww… be prepared… i don’t recommend using it this way but it works in case you really need it.)

First we will stop the Superalgos server with this shortcut:

Ctrl + c

Then we will go back to the home folder by typing:

cd

You should be there:

Lets install Chromium which is a light version of Chrome for Linux:

apt install chromium-browser

When it’s done you can connect to the remote desktop, launch chromium and restart the Superalgos server to access it via the Ubuntu Desktop.

Be prepared…on this type of free VM machine…it’s slow! That’s why I won’t go further.

Let’s now look at how can we access the Superalgos instance on the Ubuntu server from our own computer. To do so you need to have Superalgos installed on your own computer.

Some of you might remember on the first tutorial when you were asked if you accessed Superalgos from localhost or from a remote…this is it! Today we will change this setting and access it from a remote computer.

Let’s dive in!

First we need to allow incoming connections on the ports used by Superalgos (port: 18041 and port: 34248). To do so we will go back to Oracle Cloud Dashboard.

Just follow this video.

Now lets run Superalgos on your own computer with the “node platform command”.

To help you understand what’s going on, here is a view of my two terminal. The one one the left is my personal computer (Matrix Style) the one on the right is the Ubuntu Server we just created.

Let’s launch Superalgos on both machines. Don’t forget to jump to the good folder before running:

node platform
On the left my computer, on the right the Ubuntu Server, both running Superalgos.

When SA launch on your computer, load the “Getting started tutorial” so you will be guided to change the Lan Network Node.

Start the tutorial until Step 9: Accessing Remotely?

When you are there, just follow the tutorial, open the Lan Network Node, click Configure and replace the host:localhost by host:Ipadressoftheserver.

When it’s done you can Rename and save the Workspace before reloading the page.

The following video is just to show how it goes when everything works.

I start a Data Mining task in the Ubuntu Server and I want to be sure which one is working to be sure I will check my 2 terminals.

Are you still there? I hope you are and if you are you can be proud that you now have a free Superalgos VM waiting for your amazing trading strategies to be deployed!

So now what’s next?

At this point everything work but we have seen some security issues with this setup, stay tuned for the next article where we will focus on tweaking this Ubuntu Server to make it secure enough to run your live trading task.

Thanks for reading!

--

--