How To Deploy A Bot On Server

How To Deploy A Bot On Server

This is a follow up of the How To Create A Personalized Resume Bot With Sarufi. In there we discussed how to easily create a personlized resume bot using Sarufi and Telegram. In this article I will show you how to deploy your bot so that it can be up and running 24/7 using Linode.

Do note that you'll need to pay a monthly fee of $5 (Tshs 12,500). I tried a bunch of free services before writing this article, none of them worked.

Creating An Account With Linode

Linode provides hosting services which will allow us to deploy our bot. What we will do is rent a computer that is always connected to the internet from Linode (the computer is technically called a VPS) and run our python script from there. Do note that the VPSs in linode are just regular computers with the difference that they are always connected to the internet.

To create a linode account, go to their Sign Up Page and create a new account. Fill in your details, verify your account and put in your card details. If everything goes well you should be redirected to the Linode dashboard as shown below:


Create Your VPS

Remember, a VPS is just a regular computer we are renting from Linode. Here's a step by step guide on how to create a VPS with linode, its a mouthful so bare with me:

  • Click the Create and select Linode button as shown below:


  • Fill in the options as shown below. Make sure to select Shared CPU and Nanonde for a rate of $5 a month.


  • Fill in your root password. Keep it in a safe space because we will need it.


  • If all's good, tap the Create Linode button. You'll see your new server created as shown below. Do note the IP address and SSH Access. We will need them later.


Accessing The VPS

Now although VPS are regular computers, we will need a special way on how to access them. Below is a step by step guide on how to regardless of the operating system you have.


  • Install Putty
  • Fill in the IP address of your VPS. You'll get the VPS IP address from your linode dashboard.


  • Leave the Port to 22 and click Open
  • If its your first time you'll see a screen like this, just click accept.


  • You'll be asked to provide your username and password. The username is root and the password is the password you filled in when creating your linode VPS.
  • If all is well you'll have successfuly logged into your VPS

Linux / Mac / Android

  • Make sure you have OpenSSH installed. Most linux distro's already have this installed.
  • Open your terminal (or termux if using android)
  • Log into the VPS by inserting the following command. Replace 172.XXX.XXX.XXX with your actual VPS address.
ssh root@172.XXX.XXX.XXX
  • If its your first time you will be prompted to type yes to accept the connection.

Setting Up The Server

Not so bad yeah? Now that we have successfuly logged into our VPS, we need to do a few things before we deploy our bot. We're almost done, I promise.

  • Install pip and Python with the following command:
sudo apt install python3 && pip3
  • Create A Project folder with the following command:
mkdir resume-bot && cd resume-bot
  • Now let's install the python packages necessary to run our bot with the following command:
pip3 install pyrogram tgcrypto sarufi
  • Now drink some water.

  • Now let's create a our file, these will hold our credentials. Create the file with nano, paste the content of the we created in the previous tutorial and save it with CTRL+S. You can exit the nano editor with CTRL+X.


  • Finally, we will create the script with nano, and paste the contents of the we created in the previous tutorial. Use CTRL+S to save and CTRL+X to exit.


Deploying Our Bot

Now let's test the python script by running the command python3 Go to your Telegram bot and send a message. It should respond back.

Got a response? Good. Since we know the bot is working fine, stop the bot with CTRL+C then run the script again, but this time we will use the nohup command as shown below:

nohup python3

nohup is a program that will allow us to run our python script (or any command) in the background.

Send a message to your bot again and it should respond.

Congratulations, your bot will now be available 24/7. You can exit your server by typing exit if you're on Linux or closing the Putty application if you are on Windows.

For any feedback, recommendations and what not, do email me. Cheers!