在Ubuntu安裝DMOJ Judge  Server

Step1)安裝Judge伺服器

$ sudo apt install python3-dev python3-pip build-essential libseccomp-dev -y

$ . dmojsite/bin/activate

(dmojsite)$  pip3 install  dmoj

Step2)設定id與key

登入DMOJ的管理者,點選「Summissions -> Judge」,新增Judge主機的Name與讓DMOJ產生key,如下圖

將Judge主機的Name與key填入judge.yml的id與key,如下範例。

id: jian

key: "uB3ehed:g+q#;LYa;-rN<z#Cxxxxxxxxxxxxxxxxxxxxxxxx"

Step3)使用dmoj-autoconf產生runtime的設定,貼到/home/jang/site/judge.yml

$. dmojsite/bin/activate

(dmojsite)$ dmoj-autoconf

runtime:

  as_x64: /usr/bin/x86_64-linux-gnu-as

  as_x86: /usr/bin/as

  awk: /usr/bin/mawk

  cat: /usr/bin/cat

  g++: /usr/bin/g++

  g++11: /usr/bin/g++

  g++14: /usr/bin/g++

  g++17: /usr/bin/g++

  gcc: /usr/bin/gcc

  gcc11: /usr/bin/gcc

  ld_x64: /usr/bin/x86_64-linux-gnu-ld

  ld_x86: /usr/bin/ld

  perl: /usr/bin/perl

  python3: /home/jang/dmojsite/bin/python3

  sed: /usr/bin/sed


Step4)使用problem_storage_root設定測資資料夾,建立資料夾/home/jang/site/problems,資料夾下需要有該題測資,該題目才會有此judge server,出題時題目測資會上傳到此資料夾。

完整judge.yml如下

Step5)執行Judge Server,使用不是root的使用者,進入dmojsite虛擬環境,執行「dmoj  -c  judge.yml  localhost」啟動Judge  Server

$  .   /home/jang/dmojsite/bin/activate

(dmojsite) $   dmoj  -c  judge.yml  localhost

出現綠色勾勾表示,DMOJ連到此Judge Server

Step6)使用Supervisor啟動Judge  Server

編輯/etc/supervisor/conf.d/judge.conf,如下,dmoj不能使用root執行,指定使用其他使用者,檢查資料夾路徑與使用者名稱是否需要修改。

$  sudo supervisorctl  update

$ sudo supervisorctl  restart  judge

$ sudo  supervisorctl  status