# Setting up CTFd

![Setting up CTFd](https://cdn.hashnode.com/res/hashnode/image/upload/v1680986838976/8b448d2c-5b8a-444e-9312-f8b9aed2c7e8.jpeg)

I was recently tasked with setting up a ctf environment and I have been researching ever since. After looking through other platforms such as rctf and fbctf, I settled on CTFD. **CTFd** is a Capture The Flag (CTF) framework designed for ease of use for both administrators and users. Not only is **CTFd** full featured, but it's open source, written in the simple Flask framework, and easy to modify. So lets get into it!

* * *

### Prerequisites

(There isn't many tbh)

*   VPS (with your prefered flavour of Linux)
*   Internet connection

I am still in the testing stages of this platform. Therefore, I will be not be deploying this on a live production server. I will be working on a virtual machine instead. I will be using a fresh install of [Ubuntu 20.04](https://ubuntu.com/download/desktop) on VMware Workstation Pro.

* * *

### Install Docker & Docker Compose

The first thing we need to ensure that we have is `docker` and `docker compose`! This step is very crucial as we are going to be running our webserver on a `docker container`. You can take a look at [this post](/docker-containers/) of mine to install both of these :) !

TLDR; Here are the install commands

    root@ubuntu:~# sudo apt install docker.io docker-compose
    

Before we move on lets check if the installation was successful

    root@ubuntu:~# docker --version
    
    root@ubuntu:~# docker-compose --version
    

![Setting up CTFd](/content/images/2020/07/image-49.png)

* * *

### Clone the CTFd repository

Now that we have `docker` and `docker compose` installed, its time to clone CTFd's [github repository](https://github.com/CTFd/CTFd.git) onto our local machine.

    root@ubuntu:/ctfd# git clone https://github.com/CTFd/CTFd.git
    

![Setting up CTFd](/content/images/2020/07/image-50.png)

* * *

### Build CTFd docker container

Following the git clone, we are now ready to build the docker image. All you have to do is enter 1 command.

    root@ubuntu:/#cd /CTFd 
    root@ubuntu:/CTFd# docker-compose up

![Setting up CTFd](/content/images/2020/07/image-51.png)

Now we wait for it to finish building!

![Setting up CTFd](/content/images/2020/07/image-53.png)

Once we see something like this, we are DONE!!

* * *

### Setup the CTFd portal

Now that we are all setup we can access the server IP address on port 80 using any browser. We will be greeted with this page.

![Setting up CTFd](/content/images/2020/07/image-52.png)

Once we see this page, we are all set! We can go head and configure the portal to our liking and conduct our CTF event!

* * *

That was easier than I thought. I was kinda intimidated by the thought of setting up a CTF framework but it went pretty smooth! I hope to use this framework for the project that I am embarking on! Hope you learnt something too ♥!

~Nee
