How to Move a Telegram Bot from Your Home Computer to a VPS in 30 Minutes
VPS and servers Published: 15.09.2026 · 7 min read
A bot running on a laptop lives exactly until you close the lid. Moving it to a VPS takes half an hour and costs 4 000 UZS per day — below is a step-by-step guide for Python and Node.js.
Step 1. Create a server
In the client panel, choose Ubuntu 22.04 or 24.04, 1 vCPU, 1 GB RAM, 20 GB disk — enough for several bots. In 10–15 minutes you’ll receive an IP address and the root password. For Node.js and Python the OS choice doesn’t matter much; Ubuntu is the most predictable option.
Step 2. Connect and prepare the system
ssh root@YOUR_IP
apt update && apt upgrade -y
adduser bot
usermod -aG sudo bot
Working as root is a bad habit; create a separate user. All further commands are run as that user.
Step 3. Install the environment
Python:
sudo apt install -y python3 python3-venv python3-pip git
cd ~ && git clone https://github.com/you/your-bot.git bot
cd bot && python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt
Node.js:
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs git
cd ~ && git clone https://github.com/you/your-bot.git bot
cd bot && npm install
Put the bot token and other secrets in a .env file in the project folder, not in the code. Check that the bot starts manually: python bot.py or node index.js. If it replies in Telegram, move on.
Step 4. Run it as a systemd service
This is the key step: the service restarts automatically after a crash or a server reboot. Create the file /etc/systemd/system/bot.service:
[Unit]
Description=Telegram bot
After=network.target
[Service]
User=bot
WorkingDirectory=/home/bot/bot
EnvironmentFile=/home/bot/bot/.env
ExecStart=/home/bot/bot/venv/bin/python bot.py
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
For Node.js, change ExecStart to /usr/bin/node index.js. Then:
sudo systemctl daemon-reload
sudo systemctl enable --now bot
sudo systemctl status bot
journalctl -u bot -f
The last command shows logs in real time — that’s where you’ll see errors if something goes wrong.
Step 5 (optional). Webhooks instead of polling
Long polling works out of the box and needs nothing extra. Webhooks are faster and more efficient, but you need a domain and HTTPS. Point the domain’s A record to the server IP, then install Nginx and certbot:
sudo apt install -y nginx certbot python3-certbot-nginx
sudo certbot --nginx -d bot.your-domain.uz
In the Nginx config, proxy location /webhook to the port your bot listens on (for example, 8080), and register the webhook via setWebhook. Telegram accepts webhooks on ports 443, 80, 88 and 8443.
Step 6. Basic security
- Enable the firewall:
sudo ufw allow OpenSSH && sudo ufw allow 443 && sudo ufw enable. - Disable password login for SSH and allow keys only (
PasswordAuthentication noin/etc/ssh/sshd_config). - Install
fail2ban— it will block password brute-forcing. - Take a server snapshot in the client panel — a restore point in case an experiment goes wrong.
What’s next
When you have several bots or add a database, add more memory — no reinstall needed. Docker installs normally too, if you prefer containers. Plans and answers to common questions are on the Telegram bot server page.
We’ll pick a configuration, calculate the cost and migrate your project for free.