apt换源
打开配置文件
vim /etc/apt/sources.list
更改配置(按i进入INSERT模式进行编辑)
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
按ESC退出INSERT模式,Shift + zz 保存并退出
若退出时显示E45: 'readonly' option is set (add ! to override)
解决方法:
(1)按ESC
(2)输入set noreadonly
(3)输入wq就可保存退出
更新软件包
apt-get update && apt-get upgrade
平台部署
先安装git命令,再下载源码到系统中,安装python2
apt-get install git
git clone https://github.com/zhl2008/awd-platform
apt-get install python2
接下来需要下载docker,安装好docker之后下载比赛docker镜像
apt install docker.io
docker pull zhl2008/web_14.04
docker tag zhl2008/web_14.04 web_14.04
如果下载太慢了可以考虑docker换源,vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://registry.docker-cn.com","http://hub-mirror.c.163.com"]
}
换源之后要重启docker服务,service docker restart
环境启动
进入awd-platform目录,以创建两个队伍为例,用python2运行脚本,首先初始化配置,然后启用环境
python2 batch.py web_yunnan_simple 2
python2 start.py ./ 2
docker ps
docker attach check_server
python check.py
环境关闭
在awd-platform目录下执行脚本
python2 stop_clean.py
Github地址:https://github.com/zhl2008/awd-platform
flag提交以及一些使用方法可查看文件夹内的AWD线下环境手册.md,大部分问题可以得到解决