Bot de Telegram en VPS en 10 minutos (guía 2026)

Paso a paso: despliega un bot de Telegram en Python en un VPS con reinicio automático mediante systemd. Comandos reales, funciona en cualquier VPS Ubuntu. Desde 12 €/mes.

Funciona en cualquier VPS Ubuntu 22.04/24.04. Coste total: desde €12/mes - un bot no necesita más que el plan de entrada.

1. Consiga un servidor

Pida cualquier plan en nuestra página de planes - para un bot, Core VPS 4 (€12) basta. Recibirá la IP, el inicio de sesión y la contraseña por correo, normalmente en pocos minutos.

2. Conéctese y prepárese

ssh root@YOUR_SERVER_IP
apt update && apt upgrade -y
apt install -y python3-pip python3-venv

3. Código del bot

mkdir -p /opt/mybot && cd /opt/mybot
python3 -m venv venv
source venv/bin/activate
pip install "python-telegram-bot==21.*"
cat > bot.py <<'EOF'
from telegram.ext import ApplicationBuilder, CommandHandler
async def start(update, context):
    await update.message.reply_text("Hello from Buran!")
app = ApplicationBuilder().token("YOUR_BOT_TOKEN").build()
app.add_handler(CommandHandler("start", start))
app.run_polling()
EOF

4. Systemd: el bot sobrevive a los reinicios

cat > /etc/systemd/system/mybot.service <<'EOF'
[Unit]
Description=My Telegram Bot
After=network-online.target
[Service]
WorkingDirectory=/opt/mybot
ExecStart=/opt/mybot/venv/bin/python bot.py
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable --now mybot
systemctl status mybot

Listo. El bot se reinicia tras un fallo y al reiniciar el servidor. ¿Necesita una ruta de actualización más adelante? Vea todos los planes.

Relacionado

Ver planesGuíasFAQ