How to install Sonic Robo Blast 2 on Linux


SRB2 version featured in the article: 2.2.9
If the current version number varies from the one featured in the article, do not use the "Building from source code" instructions as they may be outdated and cause unexpected issues.
If you have any questions or if you want to contribute additional information you can contact me on Twitter.

The various ways to install SRB2 include:

Building from source code

1. Download and install all of the necessary components:
If the distro is based on Debian:
sudo apt install git make libsdl2-dev libsdl2-mixer-dev nasm libpng-dev zlib1g libupnp-dev libgme-dev libgme0 libopenmpt-dev upx-ucl libcurl4-gnutls-dev
2. Download the SRB2 source code and access the directory its source code is in:
git clone https://github.com/STJr/SRB2/ && cd SRB2
3. Build SRB2:
If 64-bit: make -C src/ LINUX64=1 LIBGME_LDFLAGS=-lgme LIBGME_CFLAGS=
If 32-bit: make -C src/ LINUX=1 LIBGME_LDFLAGS=-lgme LIBGME_CFLAGS=
4. Access the directory the newly-compiled binary is in:
If 64-bit: cd bin/Linux64/Release
If 32-bit: cd bin/Linux/Release
5. Rename the binary and move it to the default location for executable files:
sudo mv lsdl2srb2 /usr/local/bin/srb2
6. Create a local SRB2 directory where some SRB2 data will be stored:
cd && mkdir .srb2 && cd .srb2
7. Download SRB2 libraries:
wget https://github.com/STJr/SRB2/releases/download/SRB2_release_2.2.9/SRB2-v229-Full.zip
8. Extract them and delete the zip file:
unzip "SRB2-v229-Full.zip" '*.pk3' '*.dta' '*.dat' 'models/**/*' && rm -r SRB2-v229-Full.zip
9. Create a directory for SRB2 libraries:
sudo mkdir -p /usr/local/share/games/SRB2
10. Move all the libraries over to a global directory:
find . -maxdepth 1 \( -name '*.pk3' -o -name '*.dta' \) -exec sudo mv "{}" /usr/local/share/games/SRB2 \;
11. Move the SRB2 icon to a specific directory so that it can be seen in the shortcut file:
cd && mv SRB2/srb2.png $HOME/.icons/srb2.png
12. The source code folder is no longer needed, the command below deletes it:
rm -r SRB2
13. Download the shortcut file:
wget https://nzar.xyz/srb2/srb2.desktop
14. Move said shortcut file to the local shortcut directory:
mv srb2.desktop .local/share/applications/srb2.desktop

AppImage (Easiest method)

Maintained by GoldenTails

Option 1 (RECOMMENDED FOR BEGINNERS)
An AppImage can be downloaded. It requires least effort and can be opened without any installation.
The following command will download the game to your home folder and make it executable:
wget https://github.com/GoldenTails/SRB2/releases/latest/download/srb2.AppImage && chmod +x srb2.AppImage

Option 2 (NOT RECOMMENDED FOR BEGINNERS)
If you want to download the game without any assets included, you can execute the following command:
wget https://github.com/GoldenTails/SRB2/releases/latest/download/srb2-noassets.AppImage && chmod +x srb2-noassets.AppImage

Arch Linux

Maintained by JJK

Option 1 (RECOMMENDED)
1. Install git:
pacman -S git
2. Download, compile and install SRB2 libraries:
git clone https://aur.archlinux.org/srb2-data.git && cd srb2-data && makepkg -si
3. Download, compile and install the SRB2 binary:
git clone https://aur.archlinux.org/srb2.git && cd srb2 && makepkg -si
4. Remove the directories you no longer need:
rm -r srb2 srb2-data

Option 2 (NOT RECOMMENDED)
1. Install yay (skip this step if you have an AUR helper of your own):
sudo pacman -Syyu
sudo pacman -S git
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
2. Install SRB2 from the user repository:
yay -S srb2 srb2-data

Gentoo

Maintained by Zibon Badi

SRB2 can be installed on Gentoo using an overlay.
Link to the overlay

Flatpak

Maintained by ghisvail and ElonSatoshi

SRB2 can be installed using Flatpak.
1. If you do not have Flatpak installed, you can do so by following official instructions.
2. Once you have Flatpak installed, you can install the game:
flatpak install flathub org.srb2.SRB2

Installing the legacy 2.1 version of Sonic Robo Blast 2

In case if you want to play the previous major version version of Sonic Robo Blast 2, you can build it from source code alongside the current version of SRB2.
1. Download and install all of the necessary components:
If the distro is based on Debian:
sudo apt install git make libsdl2-dev libsdl2-mixer-dev nasm libpng-dev zlib1g libupnp-dev libgme-dev libgme0 libopenmpt-dev upx-ucl libcurl4-gnutls-dev
2. Download the source code:
wget https://github.com/STJr/SRB2/archive/refs/tags/SRB2_release_2.1.25.tar.gz
3. Extract source code from the archive:
tar -xvzf "SRB2_release_2.1.25.tar.gz"
4. Remove said archive and access the directory the source code is in:
rm SRB2_release_2.1.25.tar.gz && cd SRB2-SRB2_release_2.1.25
5. Change the default directory so that version 2.1 does not interfere with version 2.2:
sed -i 's/#define DEFAULTDIR ".srb2"/#define DEFAULTDIR ".srb2-2.1"/' ./src/doomdef.h
6. Repeat this step for another line of code:
sed -i 's/#define DEFAULTDIR "srb2"/#define DEFAULTDIR "srb2-2.1"/' ./src/doomdef.h
7. Build SRB2:
If 64-bit: make -C src/ LINUX64=1 LIBGME_LDFLAGS=-lgme LIBGME_CFLAGS=
If 32-bit: make -C src/ LINUX=1 LIBGME_LDFLAGS=-lgme LIBGME_CFLAGS=
8. Access the directory the newly-compiled binary is in:
If 64-bit: cd bin/Linux64/Release
If 32-bit: cd bin/Linux/Release
9. Rename the binary and move it to the default location for executable files:
sudo mv lsdl2srb2 /usr/local/bin/srb2-2.1
10. Create a local SRB2 directory where most of the SRB2 data will be stored:
cd && mkdir ".srb2-2.1" && cd ".srb2-2.1"
11. Download SRB2 libraries:
wget https://nzar.xyz/srb2/srb2.1.tar.xz
12. Extract them and delete the tar.xz file:
tar xf "srb2.1.tar.xz" && rm "srb2.1.tar.xz"
13. Exit the directory and move the SRB2 icon to a specific directory so that it can be seen in the shortcut file:
cd && mv SRB2-SRB2_release_2.1.25/srb2.png $HOME/.icons/srb2-2.1.png
14. The source code folder is no longer needed, the command below deletes it:
rm -r SRB2-SRB2_release_2.1.25
15. Download the shortcut file:
wget https://nzar.xyz/srb2/srb2-2.1.desktop
16. Move said shortcut file to the local shortcut directory:
mv srb2-2.1.desktop .local/share/applications/srb2-2.1.desktop

Ending

That is all you need to do! You can now launch and play Sonic Robo Blast 2.
Update 1: Updated steps 9 and 11 so the icon is located in a local directory instead of a global one.
Updated step 8 so that only required files are extracted.
Update 2: Fixed a minor mistake in step 2.
Added instructions for Arch Linux.
Update 3: Rewrote the "Building from source code" section so that it works with SRB2 v2.9
Added instructions for AppImage, Gentoo and Flatpak packages.
Update 4: Added additional instructions for AppImage.
Update 5: Revamped the instructions for Arch Linux.
Update 6: Added instructions for Sonic Robo Blast 2 version 2.1.