How to Install Redbot Discord Bot on Ubuntu 20.04 LTS

Discord is a top-rated online chatting program, especially amongst the gaming community. A popular feature with these channels is the inclusion of bots that range from moderation commands, music bots, trivia bots, leveling, and much more. Most bots are run on servers, and you can invite them. However, many of these Bots require monetary requirements to unlock more features, which can be unstable and a security risk.

So, a growing trend lately is the rise of open-source, self-hosted free Discord bots, one of the absolute powerhouses in this field is called Red Discord Bot. Redbot comes with all features that can be enabled or disabled, along with a vast 3rdParty plugin page of community projects.

The Discord bot can be installed on various operating systems. However, you will learn how to install Redbot on a Ubuntu 20.04 LTS server for the tutorial, a popular choice amongst Discord bots.

Update Ubuntu

Before you begin, make sure Ubuntu is up-to-date using the following command.

sudo apt update && sudo apt upgrade


You will need to install GIT:CORE PPA, which the git developers maintain. Our tutorial on how to install the custom PPA can be found here.

sudo apt install software-properties-common && sudo add-apt-repository ppa:git-core/ppa -y

Install Dependencies – Python3, PIP, OpenJDK

To install Python 3 and Pip3 and additional packages, Redbot requires running the following commands.

sudo apt install python3.8 python3.8-dev python3.8-venv python3-pip git openjdk-11-jre-headless build-essential nano -y

Create a Virtual Environment

Redbot is required to be installed in a virtual environment. You cannot skip this step.

You can create a virtual environment using the python-venv environment, which is more straightforward.

python3.8 -m venv ~/redenv

Then activate the virtual environment.

source ~/redenv/bin/activate

Next, you will be in the virtual environment shell, and you will notice your prefix will have (redenv) as this was the name you assigned when creating the environment.


(redenv) joshua@ubuntu:~$

Install Redbot Discord Bot

Now that you are in your virtual environment, you can install Redbot in the virtual environment you have created and run.

The first option, install without additional config backend support:

python3 -m pip install -U pip setuptools wheel && python3 -m pip install -U Red-DiscordBot -y

The second option, to install with PostgreSQL support:

python3 -m pip install -U pip setuptools wheel && python3 -m pip install -U "Red-DiscordBot[postgres]" -y

Redbot Discord Bot Set-Up

Now you have installed Redbot in your virtual environment. We can now set the discord bot up on your server.

To set up the Discord bot instance, type the following command.


This will set the location of data, your storage backend, and the instance’s name (used for running the bot).

Once done setting up the instance, run the following command to run Red:


Next, you will see the following output. The self prompts are pretty straightforward as per the below example.

First, you will see you enter the instance name. In our example, we used Redbot.

~$ redbot-setup
 Hello! Before we begin, we need to gather some initial information for the new instance.
 Please enter a name for your instance, it will be used to run your bot from here on out.
 This name is case-sensitive and should only include characters A-z, numbers, underscores (_) and periods (.).

Depending on the install option you choose for back-end support, pick the storage backend.

We've attempted to figure out a sane default data location which is printed below. If you don't want to change this default please press [ENTER], otherwise input your desired data location.
 Default: /home/bytesboss/.local/share/Red-DiscordBot/data/redbot
   You have chosen /home/bytesboss/.local/share/Red-DiscordBot/data/redbot to be your data directory.
   Please confirm [Y/n]: y 
 Please choose your storage backend (if you're unsure, just choose 1).
 JSON (file storage, requires no database).
 PostgreSQL (Requires a database server) 

Once Redbot has finished setting up, your final output should be as follows.

Your basic configuration has been saved. Please run redbot <name> to continue your setup process and to run the bot.
 First time? Read the quickstart guide:

Create Discord Bot Application

Now, everything has been sorted with Redbot and your self-hosted server; when running the command “redbot <your instance name,” you would have noticed that you saw the following output.

Please enter a valid token.
 You can find out how to obtain a token with this guide:

You will need to create a Discord Bot application to enter a token ID. You achieve this in the following steps below.

Create Application

Make sure you have created the discord account that will be its owner as below steps.

  1. Make sure you’re logged on to the Discord website.
  2. Navigate to the application page.
  3. Click on the “New Application” button.
ubuntu 20.04 redbot discord bot new application

After clicking “New Application,” give your new Discord application a name and hit create.

ubuntu 20.04 redbot discord bot create application

Navigate to the “Bot” tab on the left-hand side of your developer Discord page, then hit add a bot.

ubuntu 20.04 redbot discord bot build a bot

Suppose you want others to be able to invite your bot to tick the Public Bot. Keeping it unticked will prevent others from asking your bot to their servers, and only you will be able to add the bot to servers (provided that you have needed permissions in the server you want to add the bot to).

ubuntu 20.04 redbot discord bot new bot name and settings
Make sure Require OAuth2 Code Grant is unchecked.

Now, hit the copy the token button. You can now enter this in your Ubuntu terminal for the token ID. Do not share this token. It is a password and should be treated with the utmost care, or else security issues could occur.

Enabling Privileged Intents

Discord API requires all intents, or your Redbot instance will give you the following error output.

Red requires all Privileged Intents to be enabled.
 You can find out how to enable Privileged Intents with this guide:

To enable the required privileged intents permissions, navigate to the Bot section in your Discord developers page.

ubuntu 20.04 redbot discord bot privileged intents

Scroll down to the “Privileged Gateway Intents” section, enable both privileged intents and save your changes.

ubuntu 20.04 redbot discord bot privileged gateway intents

Next, re-run your Redbot instance. You now should see the error is gone and a new set-up option visible.

Choose a prefix for your Redbot to listen for in the Discord channels. Popular ones are! And @.

Pick a prefix. A prefix is what you type before a command. Example:
 ^ The exclamation mark is the prefix in this case.
 The prefix can be multiple characters. You will be able to change it later and add more of them.
 Choose your prefix:
 Prefix> !

Redbot instance is now running as per below.

ubuntu 20.04 redbot discord bot final look and operational

Comments and Conclusion

Redbot is the most giant free, open-source, actively developed self-hosted discord bot known. If privacy concerns public discord bots, you can efficiently run this even for your friends in a VMware or Docker setup with self-hosting. The plugin libraries are vast and cover most of what popular Discord bots cover. However, if you want web UI’s, you will need a domain and some know-how—the trade-offs for running your Discord bot instance far outway any negatives. Also, Redbot is secure, giving you peace of mind.

Community plugins for Redbot which have been verified can be found by clicking here.


Like to get automatic updates? Follow us on one of our social media accounts!