domjusge installation -- Installation of judgehost

Keywords: Ubuntu

Prepare in advance

Article reference

Download the stable version of domjudge 7.2.1 from the official website of domjudge


vmware installation

Since the computer I use is windows, this domjudge needs to be run on ubuntu, so install ubuntu system on the virtual machine

Available for reference (vmware download and installation):

Image installation

Download (Ubuntu version 18.04):

Import of ios image

Refer to:

Set user name and password

In fact, you need to enter the user name and password. Please fill in the user name and password according to your own needs

After waiting patiently for a few minutes, the following interface appears:

After clicking the user name, you need to enter the password. After logging in, the following interface appears:

Open the terminal:

Set the root user name and password

1. Input

sudo passwd

2. Display

Enter new UNIX password: 
Retype new UNIX password: 

3. Set the password

4. Switch to root

su root

5. Enter the password

Connect network

You can click the upper right corner to connect to the Internet

Check whether you are connected to the network



Installation dependency (under user)

sudo apt install make sudo debootstrap libcgroup-dev lsof \

php-cli php-curl php-json php-xml php-zip procps \

gcc g++ openjdk-8-jre-headless \

openjdk-8-jdk ghc fp-compiler \

libcurl4-gnutls-dev libjsoncpp-dev libmagic-dev

You will install judgehost in / opt/domjudge/judgehost.

Installation and compilation (under the user)

If it is a virtual machine with graphical interface, you can drag it in directly.

tar zxvf domjudge-7.2.1.tar.gz
cd domjudge-7.2.1
./configure --prefix=/opt/domjudge --with-baseurl=
make judgehost && sudo make install-judgehost

Add user (under user)

sudo useradd -d /nonexistent -U -M -s /bin/false domjudge-run

Configure sudoers

sudo cp /opt/domjudge/judgehost/etc/sudoers-domjudge /etc/sudoers.d/

Change REST password

sudo vim /opt/domjudge/judgehost/etc/restapi.secret
default  judgehost  8z1nAtFoGD0QAMcG

Change here to and domservser equally

Note: this format is endpoint api_url username password
endpoint: can remain unchanged
api_url: use the address of the domserver
username and password: be consistent with etc/restapi.secret on the judgeserver

Build chroot environment

sudo vim  /domjudge/judgehost/bin/dj_make_chroot

Change the ubuntu image to a domestic source. (line 172)

# Ubuntu mirror, modify to match closest mirror

[ -z "$DEBMIRROR" ] && DEBMIRROR="["
sudo bash /opt/domjudge/judgehost/bin/dj_make_chroot

Wait for a while. I need to download something

Set cgroup

cd  /opt/domjudge/judgehost/etc
sudo vim  /etc/default/grub

Put this:

Amend to read:

In execution

sudo update-grub

Start judgehost

sudo bash /opt/domjudge/judgehost/bin/create_cgroups
cd    /opt/domjudge/judgehost/bin



As shown in the figure, you can use the problem judging machine

matters needing attention:

1. domserver and domhost must be on the same network segment

(requirement: you can access the domjudge web page where the domserver is located on domhost)
2. If it is not started, it can be as follows:

Execute judgehost / bin / DJ first_ make_ Chroot script

sudo bash judgehost/bin/dj_make_chroot

In execution

sudo update-grub
sudo bash /opt/domjudge/judgehost/bin/create_cgroups
cd    /opt/domjudge/judgehost/bin



3. In case of error: Call to undefined function curl_init(), you can install PHP curl to solve the problem

Write at the end

You can use it, but you owe Erik a free beer
you're allowed to use it, but you owe Erik a free beer in case might you encounter him

Posted by Eggzorcist on Fri, 08 Oct 2021 00:17:48 -0700