Hosting a Discord Bot on a VPS in 2025

Tue, July 22, 2025 - 2 min read

🌐 How to Host a Discord Bot on a VPS (2025 Guide)

Running your Discord bot 24/7 on your PC isn’t ideal, that’s where a VPS (Virtual Private Server) comes in! With a VPS, your bot stays online all the time. In this quick guide, you’ll learn how to:

  • Connect to your VPS using SSH
  • Install Python and dependencies
  • Upload your bot files
  • Run your bot on the VPS

Let’s get started 🚀


📌 Step 1: Connect to Your VPS

When you buy a VPS (from providers like DigitalOcean, Linode, or AWS), you’ll get:

  • An IP Address
  • A username (usually root)
  • A password or SSH key

To connect, open your terminal and run:

ssh root@YOUR_SERVER_IP

Enter the password when asked. You’re now inside your VPS 🎉.


🐍 Step 2: Install Python and pip

Most Discord bots are made in Python. Install it on your VPS:

apt update && apt install -y python3 python3-pip

📂 Step 3: Upload Your Bot Files

There are two common ways:

  1. Using scp (secure copy):
scp -r ./my-bot root@YOUR_SERVER_IP:/home/root/

This copies your bot folder to the VPS.

  1. Or, you can clone from GitHub (if your code is there):
git clone https://github.com/yourusername/your-bot.git
cd your-bot

📦 Step 4: Install Requirements

Inside your bot folder, install dependencies (like discord.py):

pip3 install -r requirements.txt

▶️ Step 5: Run Your Bot

python3 bot.py

If everything works, your bot should come online 🎊.


⚡ Bonus: Keep It Running After Logout

If you close your SSH session, the bot will stop. To keep it running, use nohup:

nohup python3 bot.py &

Now it will continue running in the background


✅ That’s It!

You’ve successfully hosted your Discord bot on a VPS using SSH! Your bot is now online 24/7 without needing your PC.