For most of open source product, I would know you should be very lucky to build and install the package at first trial. Same applied to free5GC (at least to me). Even though I think it went smoother than any other open source product, I failed to manage to work it out completely. Good news was that at least some critical components (e.g, free5GC and gtp) seems to be installed successfully, but mongodb and webconsole does not seems to be installed properly as of Jan 31 2022.
Nevertheless, I decided to write some note about this before I forget what I have done. It will be very appreciated if there is anybody who can help me with some problems that I faces. You may email me or send me message via my linkedIn.
==> With the great help from Chlosta, Merlin, I got both mongodb and webconsole working now (Feb 23 2022).
- Where to get it ?
- My Test Setup
- Directory Structure
- Installation Process
- Golang Installation
- Control Plane Supporting Packages
- User Plane Supporting Packages
- Linux Host Network Settings
- Clone the free5GC repository
- Compile network function services in free5gc
- Retrieve the 5G GTP-U kernel module using git and build it
- Troubleshoot - mongodb installation
Where to get it ?
You can download the source code from github here.

My Test Setup
According to this document, it is said to be tested against ubuntu 18.04. Installation document says about Ubuntu Server 20.04 and I used Ubuntu Server 20.04.3 LTS which I could download from Ubuntu distribution site on Jan 29 2022. Image file name is ubuntu-20.04.3-live-server-amd64.iso.

Following is the environment that I used in writing this note. If you use different Ubuntu distribution or different source code release you may get different result.


![]()

![]()
Directory Structure
The directory structure that I have after I installed all the component described in Installation document. (I don't think mongodb is properly installed and there may be some other directory if it is installed properly)

Installation Process
I followed the procedure described in the Installation document available on Jan 29 2022. Since the document may get updated and you may see the different description at the time of your installation, I want to write down the procedure that I followed.
Golang Installation
wget https://dl.google.com/go/go1.14.4.linux-amd64.tar.gz sudo tar -C /usr/local -zxvf go1.14.4.linux-amd64.tar.gz mkdir -p ~/go/{bin,pkg,src}
# The following assume that your shell is bash echo 'export GOPATH=$HOME/go' >> ~/.bashrc echo 'export GOROOT=/usr/local/go' >> ~/.bashrc echo 'export PATH=$PATH:$GOPATH/bin:$GOROOT/bin' >> ~/.bashrc echo 'export GO111MODULE=auto' >> ~/.bashrc source ~/.bashrc
|
Control Plane Supporting Packages
I tried the followings but mongodb installation was unsuccessful at the time of Jan 29 2022. I also tried with this document, but it didn't work either.
sudo apt -y update sudo apt -y install mongodb wget git sudo systemctl start mongodb |
User Plane Supporting Packages
I tried this and no problem with this process.
sudo apt -y update sudo apt -y install git gcc g++ cmake autoconf libtool pkg-config libmnl-dev libyaml-dev go get -u github.com/sirupsen/logrus |
Linux Host Network Settings
I tried this and no problem with this process.
sudo sysctl -w net.ipv4.ip_forward=1 sudo iptables -t nat -A POSTROUTING -o <dn_interface> -j MASQUERADE sudo iptables -A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 1400 sudo systemctl stop ufw |
Clone the free5GC repository
I tried the followings but it didn't work at the second line. I modified it to
[git clone --recursive https://github.com/free5gc/free5gc.git]
cd ~ git clone --recursive -b v3.0.6 -j `nproc` https://github.com/free5gc/free5gc.git cd free5gc |
Compile network function services in free5gc
I tried this and no problem with this process.
cd ~/free5gc make |
Retrieve the 5G GTP-U kernel module using git and build it
I tried this and had problem with the first line and the last line. I modified the first line to make it work :
[git clone https://github.com/free5gc/gtp5g.git ] on Jan 29 2022
Before the last like (after make), I manually copied gtp5g.ko to the required directory printed in the error message.
git clone -b v0.4.0 https://github.com/free5gc/gtp5g.git cd gtp5g make sudo make install |
Troubleshoot - Mongodb Installation
As mentioned above, my attempt to install mongodb was not successful and I tried to fix it myself with a lot of googling but none of those attempt worked. Finally an expert sent me an email offering help with this. The expert is Chlosta, Merlin and he guided me through step by step. Also he kindly allowed me to share the troubleshooting process here in my note.
Check any existing mongodb components
My previous attempt to install mongodb failed in the middle of the installation. so it is likely that there are some components already installed even if the full installation failed.
First check which of the components are already installed with following command.
sudo apt list --installed | grep mongo |
Remove the existing components
Then remove all the mongodb related components using following commands. Without removing the existing components, most of the instructions / tips you can google may not work. It may come across another problem in the middle.
sudo apt remove mongo* |
Step 1 : Find out all the remaining mongodb components by running $ find . -name mongo*
Step 2 : Remove all the unwanted components
Download and Install mongodb
Run each of the following line to download and install mongodb.
sudo apt-get install gnupg wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add - echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse"
| tee /etc/apt/sources.list.d/mongodb-org-5.0.list
sudo apt-get update sudo apt-get install -y mongodb-org sudo systemctl daemon-reload sudo systemctl start mongod sudo systemctl enable mongod |
# su
Confirm that mongodb is running
If everything went well, you would see mongodb running as shown below.
