Installation
Ubuntu 24.04 LTS setup for Red-DiscordBot using Python 3.11, a virtual environment, and systemd.
1. Install Ubuntu packages
Recommended base system: Ubuntu 24.04 LTS.
sudo apt update
sudo apt -y install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt update
sudo apt -y install python3.11 python3.11-dev python3.11-venv git openjdk-17-jre-headless build-essential nano2. Create RedBot virtual environment
python3.11 -m venv ~/redenv
source ~/redenv/bin/activate
pip install -U pip wheel setuptools
pip install Red-DiscordBot3. Create the bot instance
Run setup and choose your instance name. In my setup the instance name was also redbot, but yours can be different.
redbot-setup4. Start manually once
In redbot redbot, the first redbot is the terminal command. The second redbot is the instance name made by redbot-setup. Replace the second one if your instance name is different.
redbot YOUR_INSTANCE_NAME --owner YOUR_DISCORD_USER_ID --team-members-are-owners5. systemd service
Create a template service so red@YOUR_INSTANCE_NAME starts the matching RedBot instance.
sudo nano /etc/systemd/system/red@.service[Unit]
Description=%i redbot
After=network-online.target
Wants=network-online.target
[Service]
User=ubuntu
Group=ubuntu
WorkingDirectory=/home/ubuntu
ExecStart=/home/ubuntu/redenv/bin/python -O -m redbot %i --owner YOUR_DISCORD_USER_ID --team-members-are-owners --no-prompt --rpc
Restart=on-failure
RestartSec=20
[Install]
WantedBy=multi-user.target6. Enable and start
Replace YOUR_INSTANCE_NAME with the instance name you created in redbot-setup.
sudo systemctl daemon-reload
sudo systemctl enable red@YOUR_INSTANCE_NAME
sudo systemctl start red@YOUR_INSTANCE_NAME
sudo systemctl status red@YOUR_INSTANCE_NAME7. Check logs
sudo journalctl -u red@YOUR_INSTANCE_NAME -n 80 --no-pager