Installing Red on openSUSE Leap 15.2+¶
Warning
For safety reasons, DO NOT install Red with a root user. If you are unsure how to create a new user on Linux, see DigitalOcean’s tutorial: How To Create a New Sudo-enabled User.
Installing the pre-requirements¶
We recommend installing a community package to get Python 3.9 on openSUSE Leap 15.2+. This package will
be installed to the /opt directory.
First, add the Opt-Python community repository:
source /etc/os-release
sudo zypper -n ar -f https://download.opensuse.org/repositories/home:/Rotkraut:/Opt-Python/openSUSE_Leap_${VERSION_ID}/ Opt-Python
sudo zypper -n --gpg-auto-import-keys ref
Now install the pre-requirements with zypper:
sudo zypper -n install opt-python39 opt-python39-setuptools git-core java-11-openjdk-headless nano
sudo zypper -n install -t pattern devel_basis
Since Python is now installed to /opt/python, we should add it to PATH. You can add a file in
/etc/profile.d/ to do this:
echo 'export PATH="/opt/python/bin:$PATH"' | sudo tee /etc/profile.d/opt-python.sh
source /etc/profile.d/opt-python.sh
Now, bootstrap pip with ensurepip:
sudo /opt/python/bin/python3.9 -m ensurepip --altinstall
Note
After this command, a warning about running pip as root might be printed. For this specific command, this warning can be safely ignored.
Creating a Virtual Environment¶
Tip
If you want to learn more about virtual environments, see page: About Virtual Environments
We require installing Red into a virtual environment. Don’t be scared, it’s very straightforward.
Using venv¶
This is the quickest way to get your virtual environment up and running, as venv is shipped with
python.
First, choose a directory where you would like to create your virtual environment. It’s a good idea
to keep it in a location which is easy to type out the path to. From now, we’ll call it
redenv and it will be located in your home directory.
Create your virtual environment with the following command:
python3.9 -m venv ~/redenv
And activate it with the following command:
source ~/redenv/bin/activate
Important
You must activate the virtual environment with the above command every time you open a new shell to run, install or update Red.
Installing Red¶
Choose one of the following commands to install Red.
To install without additional config backend support:
python -m pip install -U pip setuptools wheel
python -m pip install -U Red-DiscordBot
Or, to install with PostgreSQL support:
python -m pip install -U pip setuptools wheel
python -m pip install -U "Red-DiscordBot[postgres]"
Setting Up and Running Red¶
After installation, set up your instance with the following command:
redbot-setup
This will set the location where data will be stored, as well as your storage backend and the name of the instance (which will be used for running the bot).
Once done setting up the instance, run the following command to run Red:
redbot <your instance name>
It will walk through the initial setup, asking for your token and a prefix. You can find out how to obtain a token with this guide.
Tip
If it’s the first time you’re using Red, you should check our Getting started guide that will walk you through all essential information on how to interact with Red.