How to Install DOMjudge on Debian Latest

DOMjudge is an open-source online judge system that is used in programming contests to evaluate solutions submitted by contestants. In this tutorial, you will learn how to install DOMjudge on Debian latest.

Prerequisites

Before you begin, make sure you have the following prerequisites:

Steps to Install DOMjudge

Follow the steps below to install DOMjudge on Debian latest:

Step 1: Install Required Dependencies

  1. Update the package repository and upgrade the installed packages:

    sudo apt update
    sudo apt upgrade
    
  2. Install the required dependencies:

    sudo apt install build-essential apache2 libapache2-mod-php libcurl4-gnutls-dev libxml2-dev libicu-dev libbz2-dev libzip-dev libgmp-dev mariadb-server mariadb-client php php-curl php-intl php-bcmath php-gmp php-xml php-json php-mbstring php-zip
    

Step 2: Download and Install DOMjudge

  1. Download the DOMjudge source code:

    sudo curl -L https://www.domjudge.org/releases/domjudge-7.3.3.tar.gz -o domjudge-7.3.3.tar.gz
    
  2. Extract the downloaded archive:

    sudo tar xfz domjudge-7.3.3.tar.gz
    
  3. Navigate to the extracted directory:

    cd domjudge-7.3.3
    
  4. Compile and install DOMjudge:

    sudo ./configure --with-baseurl=/{your_domjudge_path} --with-domjudge-user=judge --with-apache-user=www-data --with-db-host=localhost --with-db-user=root --with-db-name=domjudge --with-db-password={your_db_password}
    sudo make domserver
    sudo make install-domserver
    sudo make judgehost
    sudo make install-judgehost
    

    Replace {your_domjudge_path} with the path where DOMjudge will be installed and {your_db_password} with your MySQL root password.

Step 3: Configure Apache2

  1. Create a new virtual host configuration file for Apache2:

    sudo nano /etc/apache2/sites-available/domjudge.conf
    
  2. Add the following content to the file:

    <VirtualHost *:80>
        ServerName domain.tld
        DocumentRoot /{your_domjudge_path}/public/
     
        <Directory /{your_domjudge_path}/public/>
            AllowOverride None
            Require all granted
            Options FollowSymLinks Indexes
        </Directory>
    
        ErrorLog /var/log/apache2/domjudge_error.log
        CustomLog /var/log/apache2/domjudge_access.log combined
    </VirtualHost>
    

    Replace domain.tld with your domain name and {your_domjudge_path} with the path where DOMjudge is installed.

  3. Enable the virtual host:

    sudo a2ensite domjudge
    
  4. Reload Apache2:

    sudo systemctl reload apache2
    

Step 4: Configure MySQL

  1. Login to MySQL:

    sudo mysql -u root -p
    
  2. Create a new database for DOMjudge:

    CREATE DATABASE domjudge;
    
  3. Create a new MySQL user for DOMjudge:

    CREATE USER 'domjudge'@'localhost' IDENTIFIED BY '{your_domjudge_password}';
    

    Replace {your_domjudge_password} with your desired password for the DOMjudge user.

  4. Grant privileges to the DOMjudge user:

    GRANT ALL PRIVILEGES ON domjudge.* TO 'domjudge'@'localhost';
    
  5. Flush the privileges:

    FLUSH PRIVILEGES;
    

Step 5: Initialize DOMjudge Database

  1. Change to the DOMjudge installation directory:

    cd /{your_domjudge_path}
    
  2. Initialize the DOMjudge database:

    sudo bin/dj_setup_database.sh -u root -p {your_db_password}
    

    Replace {your_db_password} with your MySQL root password.

  3. Create an admin user:

    sudo bin/dj_add_user.sh -u admin -p {your_admin_password} -a -f Admin -l User -e admin@domain.tld
    

    Replace {your_admin_password} with your desired password for the admin user.

Step 6: Start DOMjudge

  1. Start the DOMjudge daemon:

    sudo systemctl start domjudge
    
  2. Enable the DOMjudge daemon to start on boot:

    sudo systemctl enable domjudge
    
  3. Verify that DOMjudge is running:

    sudo systemctl status domjudge
    

    You should see a message indicating that the service is active and running.

Step 7: Access DOMjudge Web Interface

  1. Open your web browser and navigate to your domain name or IP address, followed by /judge.

    http://domain.tld/judge
    
  2. Log in with the admin username and password that you created earlier.

Congratulations! You have successfully installed DOMjudge on Debian latest. You can now use it to run programming contests and evaluate submissions from contestants.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!