DOMjudge安装
官网:https://www.domjudge.org/
文档:https://www.domjudge.org/documentation
不能使用root用户安装但要求用户有sudo权限
新建domjudge用户并授予sudo权限
sudo adduser domjudge
sudo usermod -aG sudo domjudge
安装基础环境,在Debian GNU/Linux上(例如Ubuntu)
domserver所需软件:
sudo apt install gcc g++ make zip unzip mysql-server-5.7 apache2 php php-cli libapache2-mod-php php-zip php-gd php-curl php-mysql \
php-json php-xml php-intl php-mbstring acl bsdmainutils ntp phpmyadmin \
python-pygments libcgroup-dev linuxdoc-tools linuxdoc-tools-text groff \
texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended texlive-lang-european
sudo apt install libcurl4-gnutls-dev libjsoncpp-dev libmagic-dev libcurl4-openssl-dev
可能需要启用PHP模块在Ubuntu上:
sudo phpenmod json
judgehost所需软件:
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
配置mysql、apache2、php
查看mysql用户名密码:
cat /etc/mysql/debian.cnf
登陆mysql:
mysql -u <username> -p <password>
修改root用户密码:
update mysql.user set authentication_string=password('<password>') where user='root';
update mysql.user set plugin="mysql_native_password";
如需远程访问,权限远程访问限制:
update mysql.user set Host ='%' where user='root';
刷新权限:
FLUSH PRIVILEGES;
如需mysql远程访问,权限远程访问限制:
修改/etc/mysql/mysql.conf.d/mysqld.cnf 中 bind-address 为
bind-address = 0.0.0.0
修改后重启mysql服务生效
安装domserver
下载domjudge:
wget https://www.domjudge.org/releases/domjudge-7.0.1.tar.gz (根据需要选择版本,这里是目前的最新版)
解压文件
tar -zxvf domjudge-7.0.1.tar.gz
进入domjudge目录
cd domjudge-7.0.1/
安装目录
./configure --prefix=$HOME/domjudge
进入目录
cd $HOME/domjudge
根据需要分别构建安装domserver、judgehost、docs:
make domserver && sudo make install-domserver
make judgehost && sudo make install-judgehost
make docs && sudo make install-docs
安装数据库结构及实例数据:
domserver/bin/dj_setup_database genpass
domserver/bin/dj_setup_database -r install
配置apache2:
ln -s $HOME/domserver/etc/apache.conf /etc/apache2/conf-available/domjudge.conf
根据需要修改apache2配置 /etc/apache2/conf-available/domjudge.conf
重启apache2服务:
a2enmod rewrite
a2enconf domjudge
service apache2 reload
查看web管理员密码:
cat domserver/etc/initial_admin_password.secret
浏览器访问 http://<your ip | host>/domjudge/ 可以看到web界面,说明已经安装成功。
微调服务器,修改如mysql、php、apache2等软件配置,尤其是在高负载的情况下。
domserver配置完毕
安装judgehost
创建judgehost所需用户,在root用户下:
useradd -d /nonexistent -U -M -s /bin/false domjudge-run
修改 /etc/default/grub 中 GRUB_CMDLINE_LINUX_DEFAULT 为:
GRUB_CMDLINE_LINUX_DEFAULT="quiet cgroup_enable=memory swapaccount=1"
更新GRUB配置:
update-grub
重启服务器:
reboot
进入judgehost目录:
cd $HOME/domjudge/judgehost/etc
增加judgehost权限:
sudo cp sudoers-domjudge /etc/sudoers.d
judgehost配置文件:
/home/domjudge/domjudge/judgehost/etc/restapi.secret
运行judgehost:
./$HOME/domjudge/judgehost/bin/create_cgroups
./$HOME/domjudge/judgehost/bin/judgedaemon
安装成功后在 http://<your ip | host>/domjudge/jury/judgehosts 看到judgehost运行状态
注:每次重启都需要运行./$HOME/domjudge/judgehost/bin/create_cgroups,否则提交会编译错误
judgehost配置完毕
尾注:
domjudge的https访问、客户端提交、ip/x-header认证等其他问题请详细阅读文档。
参考文档:
1.https://www.domjudge.org/docs/admin-manual.html
2.https://blog.csdn.net/AASE1235779/article/details/84110193