Setting Up Ubuntu and Judge0 on Windows: A Complete Guide for Developers ๐Ÿ–ฅ๏ธ๐Ÿš€

Prerequisites โš™๏ธ

Before we dive into the installation steps, I request you to install warp terminal => link Trust me, youโ€™ll thank me later.

  • ๐Ÿ”ง Why install Warp?
    With Warp, you can debug your errors directly inside the terminal, improving your development workflow!

1. Installing Ubuntu on Windows with WSL ๐Ÿง๐Ÿ’ป

To begin, youโ€™ll need to install Ubuntu on your Windows machine using Windows Subsystem for Linux (WSL).

  1. Enable WSL

    • Open PowerShell as Administrator and run

    • Run this command

        wsl --install
      
      • This command will install WSL along with the default Ubuntu distribution.

      • After installation, restart your system to complete the setup.

  2. Set Up Ubuntu

    • Open the Ubuntu terminal from the Start menu and follow the prompts to create a UNIX username and password.

  3. Update Ubuntu

    • Once Ubuntu is set up. update all the installed packages by running the following commands :

        sudo apt update
      
    • upgrade the installed packages:

        sudo apt upgrade -y
      

Now, Youโ€™re all set to start working on Ubuntu within Windows! ๐ŸŽ‰

Now that Ubuntu is up and running, letโ€™s move on to installing Docker and Docker Compose to manage containers efficiently.


2. Installing Docker and Docker Compose ๐Ÿณ๐Ÿ“ฆ

Make sure you are in the ubantu terminal

  1. Install Docker

    • After updating, run this command to install Docker:

        sudo apt install -y docker.io
      
  2. Install Docker Compose

    • Once Docker is installed, run the following command to install Docker Compose:

        sudo apt install -y docker-compose
      

Docker and Docker Compose are now ready for use on your Ubuntu environment! ๐ŸŽ‰


3. Installing Judge0 on Your Local Server โš™๏ธ๐Ÿ’ก

Letโ€™s install Judge0, a powerful online code execution API, on your local machine. Follow these steps carefully.

  1. Download Judge0

    • First, run the following command to download the Judge0 release archive:

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

    • After the download is complete, run the following command to unzip the archive:

        unzip judge0-v1.13.1.zip
      

NOTE => you will get an error here, so firstly you have to install unzip in your terminal. In such situations, warp terminal makes your life easy

  1. Set Up Secure Passwords

    • Visit random.org password generator and copy two random passwords.

    • Open the .env configuration file by running:

        nano judge0-v1.13.1/.env
      
    • Update password with the generated passwords, you will find these fields when you scroll down

      • REDIS_PASSWORD

      • POSTGRES_PASSWORD

    • Save the file and exit => follow the instruction on there

  2. Start Judge0 Services

    • Navigate to the Judge0 folder where you downloaded and extracted the files:

        cd judge0-v1.13.1
      

    • Now all the things will take place in this directory itself

    • Start the database and Redis services by running:

        docker-compose up -d db redis
      
    • Wait for a few seconds:

        sleep 10s
      
    • start the remaining services:

        docker-compose up -d
      
    • Wait for a few more seconds:

        sleep 5s
      

Judge0 should now be up and running on your local server! ๐ŸŽฏ


4. Verifying the Installation โœ…๐Ÿ”

To make sure everything is set up correctly, follow these steps:

  1. Check Judge0 API Docs

    • Open your browser and go to:

        http://localhost:2358/docs
      
    • You should see the Judge0 API documentation page. This confirms that the installation was successful

    • If you go to dummy client then a dummy client will appear, you can play in here

Make sure the server is running when you are using this, How to make sure this works
- simple in the warp terminal , ask to check for judge0 server running in your system

sudo docker ps | grep judge0

Connect with Me ๐ŸŒ

Feel free to reach out or follow me on my social media platforms:

11
Subscribe to my newsletter

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

Written by

Gaurav Kumar Maurya
Gaurav Kumar Maurya