Setting up a linux server for bots
Here we’ll explain how to deploy a virtual private linux server instance on our favorite VPS provider Vultr.
You can use your own server provider if you wish, but we won’t support nor cover the different details regarding every other provider.
- Click here to register on Vultr.
- Click Products.
- Click the + blue sign that displays “Deploy New Server”.
- Click “Cloud Compute”.
- Choose Tokyo (better ping if you are using Binance or FTX).
- Server type is 64 bits Ubuntu 20.04 x64.
- Server size is 55GB SSD, 1 CPU, 2048MB memory and 2000GB Bandwidth.
- Don’t enable additional features.
- Set up hostname with something like “server” (without the quotes), and set a label that you can use to identify the server.
- Click “Deploy Now” and wait until the server is ready.
- Depending on your OS (your own computer OS):
After logging in as root, we need to create a new username. You should see root@hostname in the console, where “hostname” is the hostname you set up before. You do not need to type # as it just indicates that you are logged in as “root” and have administrator permissions.
# adduser username (replace username with your desired name) # usermod -aG sudo username (give your user admin permissions)
We need to change the ssh port, disable root login, and import ssh-key. To edit files we will use a pre-installed program called nano. Make sure to save the files after modifying them by pressing Control+O, then Control+X to exit.
# nano /etc/ssh/sshd_config
Search for “PermitRootLogin”, remove the # if it’s commented out, then change it from “Yes” to “No” (you can use the arrow keys to move through the file).
You can change the port 22 to a different port, but make sure to remember this port’s number as you’ll need it when you log in with the other username using SSH or PuTTy. Optional (more secure login):
Search for “PubKeyAuthentication” in /etc/ssh/sshd_config/ and remove the # symbol, then set its value to “Yes”.
Generating SSH Key
- For Windows: https://www.ibm.com/support/knowledgecenter/en/HW94I/svc_generatingsshkeypair_2mu1y4.html
- For Linux/macOS: https://www.ibm.com/support/knowledgecenter/en/HW94I/svc_generatesshopen.html
Enabling UFW (firewall), allow SSH connections, installing fail2ban
# ufw default deny incoming # ufw default allow outgoing # apt install fail2ban # cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local # ufw allow ssh (this is assuming you’re using port 22, replace ssh with another port if you used another port) # ufw enable # nano /etc/fail2ban/jail.local
Search for “ssh” then erase the # symbol from the [sshd] line and the “enabled = true” line below it.
That’s it, your server should be ready to go! From now on we’ll log in as the new username rather than the root account. We’ll cover how to install specific bots in another post.