# Setting Up The Environment for free5GC

The [free5GC](https://free5gc.org/) is an open-source project for 5th generation (5G) mobile core networks. The ultimate goal of this project is to implement the 5G core network (5GC) defined in 3GPP Release 15 (R15) and beyond.

So, first things first, let's set up an environment for installing free5GC. We will need a Linux machine with:

* [Docker](https://www.docker.com/)
    
* [gtp5g](https://github.com/free5gc/gtp5g/) kernel module
    

I'll be using a Linux machine with "Ubuntu 24.04 LTS" operating system.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723905772802/7b1b0410-c169-4215-b0bd-12f08b9abdf3.png align="center")

---

# Install docker

[Docker](https://www.docker.com/) is an open-source platform designed to automate the deployment, scaling, and management of applications using containerization.

Docker makes it possible to deploy something like a 5G Core Network on a single machine as all 5GC network functions will be running inside docker containers. Docker Compose on the other hand is a tool for defining and running multi-container applications, making it easy to manage services, networks, and volumes in a single, comprehensible YAML configuration file.

Refer to [docker documentation](https://docs.docker.com/engine/install/) for installation steps as it differs according to the operating system. Here are the steps for Ubuntu.

Add Docker's official GPG key

```bash
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
```

Add the repository to Apt sources

```bash
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
```

Install docker

```bash
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
```

Verify docker installation

```bash
sudo docker run --rm hello-world
```

We can add our user to docker group to run docker commands without `sudo` (log out and log in again after this step)

```bash
sudo usermod -aG docker $USER
```

Check the version of docker and docker compose

```bash
docker version
docker compose version
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723908023487/3cd2bd99-4481-4b0a-93c3-a357480971be.png align="center")

---

# Install gtp5g kernel module

`gtp5g` is a customized Linux kernel module gtp5g to handle packet by PFCP IEs such as Packet Detection Rules `PDR` and Forwarding Action Rules `FAR`.

Installation steps are documented [here](https://github.com/free5gc/gtp5g). At the time of writing this article, I used gtp5g version v0.8.10 (not the latest), as newer versions have caused an error in UPF container (It could be solved later).

Install `make` and `gcc-13`

```bash
sudo apt install make gcc-13
```

Clone gtp5g git repository and switch to version `v0.8.10` tag

```bash
git clone https://github.com/free5gc/gtp5g.git
cd gtp5g
git checkout v0.8.10
```

Build and install gtp5g kernel module

```bash
sudo make clean
sudo make
sudo make install
```

Now we are all set up to run free5GC on our machine!
