青岛大学开源OJ平台搭建

源码地址为:https://github.com/QingdaoU/OnlineJudge

可参考的文档为:https://github.com/QingdaoU/OnlineJudgeDeploy/tree/2.0

一、安装所依赖的环境

sudo apt-get update && sudo apt-get install -y vim python-pip curl git

sudo apt-get install docker-compose

二、使用Git克隆项目并完成部署

git clone -b 2.0 https://github.com/QingdaoU/OnlineJudgeDeploy.git && cd OnlineJudgeDeploy

docker-compose up -d(root用户使用该命令)或sudo -E docker-compose up -d(非root用户使用该命令)

用户名和密码分别是:root和rootroot

浏览器默认打开为:http://IP地址/

例如http://192.168.126.128,显示界面如下:

三、常见问题

常见问题一

错误信息:ERROR: Version in "./docker-compose.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a version of "2" (or "2.0") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/


解决办法:修改docker-compose.yml中的version由3改为2

常见问题二:

错误信息:ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?

解决办法:
docker-compose up -d(root用户使用)
非root执行会出现这个异常

非root应该执行这条命令
sudo -E docker-compose up -d

四、小结

这个OJ平台是国内开源的相对环境很好搭建的,其实参考官方文档也能搭建,本人之所以写,一来为自己,二为分享给其他朋友,让他们尽可能少吃点亏。

猜你喜欢

转载自www.cnblogs.com/youcong/p/10085387.html