RAN CN 테스트베드 구축/OAI+Free5GC (RAN-Core)

VM에 Free5GC Docker Compose 설치하기

gksyb4235 2026. 4. 26. 15:32

VM에 Free5GC Docker Compose 설치하기


예전에 Kubernetes로 Free5GC 환경설정을 세팅했었는데,

리비전까지 시간이 얼마 안남아서 조금 더 빠른 환경설정을 위해 free5gc docker-compose로 한 번에 깔려고 한다.

 

우선 Ubuntu 20.04로 VM 하나 설치해준다.

 

 

 

이후 아래를 참고해서 free5gc docker-compose를 설치했다.

Core를 VM으로 한 이유는 kernel 버전과 관련된 이슈가 많기 때문.

네트워크 설정은 NAT와 Host-only로 해줬다.

 

 

일단 Kernel Vesrion이 반드시 5.4.x 아니면 5.0.0-23-generic이어야 한다.

Ubuntu 20.04의 kernel 버전이 디폴드로 5.4.x로 되어 있다길래 Ubuntu 20.04를 iso 파일로 설정함.

# 확인 방법
uname -r

 

 

근데 막상 깔았더니 커널 버전이 왜인진 모르겠는데 5.15.0으로 되어 있음..

이거 해결하는 방법은 아래와 같다.

sudo -i
apt-get install -y linux-image-generic
apt install linux-headers-5.4.0-216-generic
cp /etc/default/grub /etc/default/grub.bak
vi /etc/default/grub

 

 

그 다음에 Vim 편집기에서 GRUB_DEFAULT를 이렇게 바꿔준다.

:w 명령어로 편집된 내용 저장하고 나오기

그리고 update-grub 명령어를 치고 reboot

 

 

설치 1. gpt5g kernel 설치


https://github.com/free5gc/gtp5g

 

GitHub - free5gc/gtp5g: GTP-U Linux Kernel Module

GTP-U Linux Kernel Module. Contribute to free5gc/gtp5g development by creating an account on GitHub.

github.com

sudo apt -y update
sudo apt -y install gcc g++ cmake autoconf libtool pkg-config libmnl-dev libyaml-dev

git clone --branch v0.9.5 --depth 1 https://github.com/free5gc/gtp5g.git
cd gtp5g

sudo make clean && make
sudo make install

 

 

 

설치 2. Docker 설치


https://docs.docker.com/engine/install

 

Install Docker Engine

Learn how to choose the best method for you to install Docker Engine. This client-server application is available on Linux, Mac, Windows, and as a static binary.

docs.docker.com

# 필수 패키지
sudo apt update
sudo apt install ca-certificates curl gnupg lsb-release

# Docker 공식 GPG 키 추가
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

# 저장소 등록
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# 설치
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# 설치 확인
docker --version
docker compose version
sudo systemctl status docker

 

 

 

 

설치 3. Free5gc docker-compose 설치


https://github.com/free5gc/free5gc-compose

 

GitHub - free5gc/free5gc-compose

Contribute to free5gc/free5gc-compose development by creating an account on GitHub.

github.com

# Clone the project
cd ~
git clone https://github.com/free5gc/free5gc-compose.git
cd free5gc-compose

# clone free5gc sources
cd base
git clone --recursive -j `nproc` https://github.com/free5gc/free5gc.git
cd ..

# Build the images
sudo make all
docker compose -f docker-compose-build.yaml build

 

Run free5gc

# use local images
cd ~/free5gc-compose
docker compose -f docker-compose-build.yaml up -d

 

 

 

 

실행 상태 확인

docker compose -f docker-compose-build.yaml ps

 

# 그리고 WebUI 접속:
http://<VM-IP>:5000

# VM 안 브라우저에서 접속하면:
http://localhost:5000

 

 

중지 및 컨테이너 삭제

# 중지:
docker compose -f docker-compose-build.yaml down

# 컨테이너 삭제:
docker compose -f docker-compose-build.yaml rm