-
Notifications
You must be signed in to change notification settings - Fork 106
安装指南
这是一个UOJ的docker版本。在安装之前,请确认Docker已经安装在您的操作系统中。
这个docker的映像是64位的版本,在32位的系统上安装可能会出现错误。
请先下载 JDK7u76 和 JDK8u31,并把他们放置在docker/jdk-7u76-linux-x64.tar.gz
与docker/jdk-8u31-linux-x64.tar.gz
中。 这两个压缩文件会被用在 judge_client 来测试Java的程序。如果你不喜欢下载那么大的文件的话,你可以放两个空vfk在那里充数(前提是文件名一样)。
然后,回到clone的目录(也就是docker的上级目录)运行以下指令
./install
如果运气够好,而且vfk大的话,你将会看见Successfully built <image-id>
在最后一行.
如果你要启动UOJ的主服务器,你需要运行如下指令
docker run -it -p 80:80 -p 3690:3690 <image-id>
如果你运行docker在Mac OS上,或者在上传题目数据的时候遇到了形如:std: compile error. no comment
的信息,你可能需要用以下指令来替代上一个指令:
docker run -it -p 80:80 -p 3690:3690 --privileged --cap-add SYS_PTRACE <image-id>
默认的主机名是local_uoj.ac
,所以你需要在您服务器的hosts文件中添加以下行:
127.0.0.1 local_uoj.ac
::1 local_uoj.ac
或使用Menci的玄学大法(replace from XXX to YYY)
find . | xargs sed -i 's/XXX/YYY/g'
当你做完了这些 您就可以直接从浏览器访问您自己的uoj辣!
如果你需要一个超级用户,请注册一个账户,并在tableuser_info
将其的usergroup
改成"S"。
请运行
mysql app_uoj233 -u root -p
来登录您服务器的mysql(默认密码是root)
如果您只需要一个判题的客户端,那您已经完成了这个事情!vfk向您发来贺电!恭喜!
However, if you want more judge clients, you need to set up them one by one. First run:
./config_judge_client
and answer the questions.
- uoj container id: the container id of the main server.
- uoj ip: the ip address of the main server.
- judger name: you can take a name you like, such as judger, judger_2, very_strong_judger. (containing special characters may cause unforeseeable consequence.)
After that, a sql command is given, we will talk about it later.
Next, we need to run:
./install_judge_client
to build the docker image. If you want to run judger at the same server, you just need to run
docker run -it <image-id>
And, you need to complete the sql command given just now with the ip address of the judger docker, and modify the database. To someone who do not know how to get the ip address of a docker container, here is the answer:
docker inspect --format '{{ .NetworkSettings.IPAddress }}' <container-id>
Or, if you want to run judger at different server, you need to copy the image to the other server, and run
docker run -p 2333 -it <image-id>
Similarly, you need to complete the sql command and modify the database. This time, you need to fill with the ip address of the host machine of the judger docker.
You may meet many difficulties during the installation. Good luck and have fun!
mysql default password: root
local_main_judger password: judger
You can change the default hostname and something else in /var/www/uoj/app/.config.php
. However, not all the config is here, haha.