Verbatim large column https://www.dazhuanlan.com/2019/08/27/5d646e937bce9/
Some time ago the school community organized a CTF small game, when the CTFd is to use this platform. Frustratingly CTFd recently updated, so the old version of the package I have not installed on. Recent studies a bit new version of CTFd (v2.1.2), incidentally also finished a new version of CTFd. Overall, the current CTFd more powerful, and became the team competition and individual competition in two modes, you can also operate rewards points, and so to some users in the background ... administrators
official Github Address
Environmental requirements
Installation process
I feel Docker installation easier, and therefore the installation of a docker-compose up way.
First install Docker
Installation package needed
1 |
sudo yum install -y yum-utils device-mapper-persistent-data lvm2 bind-utils |
Set yum source
1 |
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo |
Installation docker
1 |
sudo yum install docker-ce |
Start and join the boot
1 |
sudo systemctl start docker |
Verify that the installation was successful
1 |
docker version |
Installation docker-compose
Reference link
to install python-pip
1 |
yum -y install epel-release |
Pip check whether the installation was successful
1 |
pip -V |
To pip install upgrade (optional)
1 |
pip install --upgrade pip |
Officially begin the installation docker-compose
1 |
pip install docker-compose |
Installation pip error and workarounds
1 |
If the error: ReadTimeoutError: HTTPSConnectionPool (host = ' pypi.python.org', port = 443): Read timed out |
Check the docker-compose is successfully installed
1 |
docker-compose -version |
Download CTFd
If you do not install the git git on your system
1 |
sudo yum install -y git |
From the clones CTFd Github
1 |
git clone https://github.com/ctfd/ctfd.git |
You can also download my good package archive upload it directly to your server, v2.1.2 version, current date.
Download link address, password: xg7e
download after successful decompression, you can see a CTFd document folder
home directory structure of CTFd
thereafter you can choose whether to use the Chinese version, if you want to use the Chinese version, download the finished package offered to replace my home directory themes directory under / CTFd path to (remember to do a backup).
Finished package download link address, password: nkqd
then under the home directory CTFd
1 |
docker-compose up |
Quietly wait for the installation to complete successfully will pop up http://0.0.0.0:8000
at this time, your CTFd installation is complete.
If you can not access the installation is successful, look at the port is not a firewall to filter out.
Speaking effect
替换themes目录后效果如下:
后续运维
CTFd的数据库用的是mariadb,看一下docker运行了哪些容器
可以看到运行了三个容器,分别是ctfd,mariadb,redis
我们可以直接进入到各个容器进行操作。
1 |
docker exec -it [CONTAINER ID] /bin/bash |
数据库root账户的密码默认为ctfd
原先旧版的CTFd如果数据库不设置UTF-8会乱码,新版本测试过程中没碰到此类问题,如果乱码就进入到ctfd数据库敲一下命令
1 |
ALTER TABLE [table name] CONVERT TO CHARACTER SET utf8; |
配置Nginx
如果有需要的话也可以配置一下nginx,这样访问速度会变快,而且作为一个中间件更改端口会更方便(当然小伙伴们选择Apache也是可以的)。
参考链接
安装所需环境
1 |
yum install gcc-c++ |
根目录下新建一个文档夹nginx
1 |
mkdir /nginx |
然后进入到目录下进行编译
1 |
./configure |
查找一下nginx的位置whereis nginx
nginx常见命令
启动、停止nginx
1 |
cd /usr/local/nginx/sbin/ |
nginx开机自启动
即在rc.local增加启动代码就可以了。vi /etc/rc.local
增加一行 /usr/local/nginx/sbin/nginx (根据whereis nginx实际的位置为准)
设置执行权限:chmod 755 rc.local
配置nginx
配置之前需要先运行一下nginx
1 |
./nginx |
然后在修改配置文档vim /usr/local/nginx/conf/nginx.conf(whereis nginx 实际情况)
server下的location替换为
1 |
location /{ |
Finally, the need to open firewall port 80 firewall-cmd --zone=public --add-port=80/tcp --permanent
and then start clicking nginx can access your CTFd 80 through the port.
Note: Some installation steps from the Internet, have marked the original link.