系统:Ubuntu 20.04.4 Focal Fossa
配置apt镜像源,可到清华镜像站探求合适版本
- sudo vi /etc/apt/sources.list
复制代码 以下为清华Ubuntu 20.04 LTS (focal)镜像源
- # 默认注释了源码镜像以提高 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 http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
- # deb-src http://security.ubuntu.com/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
复制代码 更新软件源,漫长的时间……
更新完成之后安装docker和docker-compose
- sudo apt install docker.io docker-compose
复制代码 利用下列命令查看版本判断是否安装成功
docker-compose version 1.25.0, build unknown
Docker version 24.0.5, build 24.0.5-0ubuntu1~20.04.1
接下来到GZ:CTF根据文档部署,起首创建一个GZCTF文件夹,根据文档创建配置appsettings.json和docker-compose.yml文件
appsettings.json
- {
- "AllowedHosts": "*",
- "ConnectionStrings": {
- "Database": "Host=db:5432;Database=gzctf;Username=postgres;Password=<Your POSTGRES_PASSWORD>"
- },
- "EmailConfig": {
- "SendMailAddress": "a@a.com",
- "UserName": "",
- "Password": "",
- "Smtp": {
- "Host": "localhost",
- "Port": 587
- }
- },
- "XorKey": "<Your XOR_KEY>",
- "ContainerProvider": {
- "Type": "Docker", // or "Kubernetes"
- "PortMappingType": "Default", // or "PlatformProxy"
- "EnableTrafficCapture": false,
- "PublicEntry": "<Your PUBLIC_ENTRY>", // or "xxx.xxx.xxx.xxx"
- // optional
- "DockerConfig": {
- "SwarmMode": false,
- "Uri": "unix:///var/run/docker.sock"
- }
- },
- "RequestLogging": false,
- "DisableRateLimit": true,
- "RegistryConfig": {
- "UserName": "",
- "Password": "",
- "ServerAddress": ""
- },
- "CaptchaConfig": {
- "Provider": "None", // or "CloudflareTurnstile" or "GoogleRecaptcha"
- "SiteKey": "<Your SITE_KEY>",
- "SecretKey": "<Your SECRET_KEY>",
- // optional
- "GoogleRecaptcha": {
- "VerifyAPIAddress": "https://www.recaptcha.net/recaptcha/api/siteverify",
- "RecaptchaThreshold": "0.5"
- }
- },
- "ForwardedOptions": {
- "ForwardedHeaders": 5,
- "ForwardLimit": 1,
- "TrustedNetworks": ["192.168.12.0/8"]
- }
- }
复制代码 docker-compose.yml
- version: "3.0"
- services:
- gzctf:
- image: gztime/gzctf:latest
- restart: always
- environment:
- - "LANG=zh_CN.UTF-8" # choose your backend language `en_US` / `zh_CN` / `ja_JP`
- - "GZCTF_ADMIN_PASSWORD=<Your GZCTF_ADMIN_PASSWORD>"
- ports:
- - "80:8080"
- volumes:
- - "./data/files:/app/files"
- - "./appsettings.json:/app/appsettings.json:ro"
- # - "./kube-config.yaml:/app/kube-config.yaml:ro" # this is required for k8s deployment
- - "/var/run/docker.sock:/var/run/docker.sock" # this is required for docker deployment
- depends_on:
- - db
-
- db:
- image: postgres:alpine
- restart: always
- environment:
- - "POSTGRES_PASSWORD=<Your POSTGRES_PASSWORD>"
- volumes:
- - "./data/db:/var/lib/postgresql/data"
复制代码 搞完之后启动
- sudo docker-compose up -d
复制代码- [sudo] password for osboxes:
- Creating network "gzctf_default" with the default driver
- Pulling db (postgres:alpine)...
- alpine: Pulling from library/postgres
- 4abcf2066143: Pull complete
- 8e53739c72bf: Pull complete
- 6b2f54332fe1: Pull complete
- 3ed99af0e76b: Pull complete
- f54035dfc9b0: Pull complete
- 16374409674c: Pull complete
- 09b009446613: Pull complete
- a76c5f01e503: Pull complete
- f6dfa742bdd5: Pull complete
- Digest: sha256:bbd7346fab25b7e0b25f214829d6ebfb78ef0465059492e46dee740ce8fcd844
- Status: Downloaded newer image for postgres:alpine
- Pulling gzctf (gztime/gzctf:latest)...
- latest: Pulling from gztime/gzctf
- e1caac4eb9d2: Pull complete
- bee002b96029: Pull complete
- e65deb0614ae: Pull complete
- 31a62e83c1b2: Pull complete
- 97d7b6e68a6e: Pull complete
- 67c6e8d22e3d: Pull complete
- 4edd0400ef8d: Pull complete
- c20d573e682c: Pull complete
- b468dfa08eb4: Pull complete
- Digest: sha256:e0222340c9a2ee8644cef5f037eb472a4fad81b85a476ae8efc5b5bb1728dd16
- Status: Downloaded newer image for gztime/gzctf:latest
- Creating gzctf_db_1 ... done
- Creating gzctf_gzctf_1 ... done
复制代码 就完成了,根据服务器对应IP访问即可
- osboxes@osboxes:~/GZCTF$ sudo docker ps
- CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
- 295d52db022b gztime/gzctf:latest "dotnet GZCTF.dll" 42 seconds ago Up 9 seconds (health: starting) 0.0.0.0:80->8080/tcp, :::80->8080/tcp gzctf_gzctf_1
- fb8b49a2d948 postgres:alpine "docker-entrypoint.s…" 43 seconds ago Up 42 seconds 5432/tcp gzctf_db_1
复制代码 好耶,完结撒花❀
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |