How to Install Judge0 (Self Hosted) – Step-by-Step Guide for Developers

Sagar Kumar JhaSagar Kumar Jha
6 min read

Introduction

Judge0 is robust, scalable, and open-source code execution platform. Which enable us to create large and scalable softwares for competetive-programming, online IDEs,, online code editors, programming assessments, etc.

It contains support for 60+ languages.


Installating judge0

We are going to install judge0-v1.13.1 on our PCs.

System Requirements

Judge0 has been tested only for linux platforms that’s why there is no official support for installations in other platforms.

Note:- We are going to see how to install judge0 in Windows and Linux.

Prerequisites

  1. A Laptop or desktop PC with Wndows or Linux .

  2. A stable internet connection.

With the above prequisites lets proceed for the installation

Preinstallations

Windows WSL


For installation of WSL we need to enable some features in out windows machine.

Enabling WSL and Virtual Machine platform'

  1. Press 🪟 + r and type optionalfeatures.exe click on OK.

  2. Allow for permission.

  3. Mark check for enabling Virtual Machine Platform and Windows Subsystem For Linux and press ok.

  4. Wait for checking requirements.

  5. Click on restart.

Installing wsl

  1. Open powershell.

  2. Install wsl package

wsl.exe --install
  1. Check installation using
wsl -v # or wsl --version
  1. Install Ubuntu
# wsl --install <Distro_name>
wsl --install # it will install latest version of Ubuntu 24.04 as a default
  1. Using ubuntu using WSL
 wsl -d Ubuntu # For using any other distro of linux replace Ubuntu with the Name of Distribution

Ubuntu (Linux platform)


  1. Use sudo to open file /etc/default/grub
sudo nano /etc/default/grub
  1. Add systemd.unified_cgroup_hierarchy=0 in the value of GRUB_CMDLINE_LINUX variable.
GRUB_CMDLINE_LINUX="systemd.unified_cgroup_hierarchy=0"

If the line already contains other parameters, ensure you add this parameter within the quotes, separated by a space. For instance:

GRUB_CMDLINE_LINUX="quiet splash systemd.unified_cgroup_hierarchy=0"
  1. Apply the changes:
sudo update-grub
  1. Restart your server:
sudo reboot

Common Installation

Step 1: Open terminal (Windows open WSL CLI)

Step 2: Update your System

Mac:

sudo softwareupdate --install --all

Linux or WSL:

sudo apt update -y && sudo apt upgrade -y

Step 3: Download Docker and Docker Compose (Skip If you have already installed)

Mac

brew install --cask docker

Linux or WSL

sudo apt install docker.io && sudo apt install docker-compose

Step 4: Install unzip Package

Mac

brew install unzip

Linux or WSL

sudo apt install unzip

Step 5: Download the judge0’s release archive

wget https://github.com/judge0/judge0/releases/download/v1.13.1/judge0-v1.13.1.zip

You can directly download judge0’s release archive from here.

Step 6: Extract or Unzip the judge0’s release archive

unzip judge0-v1.13.1.zip

Step 7: Go into judge0-v1.13.1 extracted folder

cd judge0-v1.13.1

Step 8: Update the variable REDIS_PASSWORD in the judge0.conf file.

nano judge0.conf

Instead of YourPassword use generated password for both REDIS_PASSWORD and POSTGRES_PASSWORD.

Passwords can be different(prefer) or same

  1. Write and Save

    press ctrl + o and save as same name

  2. To come out the file :

    press ctrl + x

‼️Do not modify docker-compose.yml, modify it only if you know what are you doing 💀.

Step 9: Run these commands to initialize redis and postgres:

docker-compose up -d db redis # use sudo for smooth experience

wait for initialization of redis and postgres.

Step 10: Run these commands to initialize workers and server:

docker-compose up -d # use sudo for smooth experience

After these commands end, your instance of Judge0 CE v1.13.0 is now available at : http://0.0.0.0:2358 or http://localhost:2358 don’t worry your installation is working if you are getting empty white-page.

Helping links:

  • Judge0 Dummy Client Page - go to directory ‘/dummy-client.html

    you can try here dummy code executions

  • Judge0 Languages Page - go to directory ‘/languages’

  • Judge0 Documentation Page - go to directory ‘/docs’


Testing Installation

Visit http://localhost:2358/dummy-client.html try to run.

If you are getting accepted then congratulations installation is successful if compilation error check the Source Code stdin and expected output.

If your are facing internal error with Message: 'No such file or directory @ rb_sysopen - /box/script.js' then goto

Edit this text


Message: 'No such file or directory @ rb_sysopen - /box/script.js',

Before we start, I want to inform that in some PCs you don’t need to configure that much but If you are getting the Message: 'No such file or directory @ rb_sysopen - /box/script.js'. Many of my collegues are getting this error too. So together we tried to solve the problem.

This may or may not work for your operating system due to some architecture issues over operating system or machines try reinstall the docker.

Reason: Docker Desktop uses a Linux VM under the hood (e.g., Alpine or Debian-based), and cgroups are part of the Linux kernel. So you'll need to check cgroup version inside the Docker VM or container.

stat -fc %T /sys/fs/cgroup  # use directly in linuc or mac and use into WSL for windows to check it

Outputs**:**

  • cgroup2fs → Cgroup v2

  • tmpfs or cgroup → Cgroup v1

If your docker-desktop is running at CgroupV2 you need to downgrade it.

Step 1: Open settings.json or settings-store.json

Windows

code "C:\Users\[Username]\AppData\Roaming\Docker\settings-store.json"
# setting-store is not present then use settings.json

Mac

vim ~/Library/Group\Containers/group.com.docker/settings-store.json 
#setting-store is not present then use settings.json

Linux

nano ~/.docker/desktop/settings-store.json # setting-store is not present then use settings.json

Step 2: Append “DeprecatedCgroupv1”: true in settings-store.json file or use ”deprecatedCgroupv1”: true in settings.json

{
    “DeprecatedCgroupv1”: true
}

Step 3: Restart docker

Additionally Enable Use Rosetta for x86_64/amd64 emulation on Apple Silicon in Mac OS.

Test it again, if this is useful “You’re Welcome”


Still getting the error

Step 1: Goto directory where setting-store.json is present and search for .setting-store.json.swp and delete it.
Step 2: Restart docker and rerun judge0

Still not able to resolve use Sulu or Rapid Api.

From WSL to Docker-Desktop (for windows users only)

  1. From the Docker menu, select Settings > General

  2. Make sure that ‘Use the WSL 2 based engine’ is selected

  3. Then go to Settings > Resources > WSL Integration in Docker Desktop and enable Ubuntu.

  4. Now you can see containers running in the docker-desktop.


How to re run the judge0 container?

Step 1: Open the judge0 folder with files (docker-compose.yml and Jude0.conf).

Step2: Open the terminal and use

docker-compose up -d

How to stop judge0 container?

Step 1: Open the judge0 folder with files (docker-compose.yml and Jude0.conf).

Step2: Open the terminal and use

docker-compose down

References


Suggestion

  • If you are somehow failed to install/config judge 0 try reinstalling from start.

  • Avoid multiple downloads of judge0’s release archive.

41
Subscribe to my newsletter

Read articles from Sagar Kumar Jha directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sagar Kumar Jha
Sagar Kumar Jha