Open RAN  - free5GC








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 ?


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.






NOTE : I have tried with Ubunto Desktop (20.04.1 LTS, 5.11.0-43-generic) but the installation was not so successful. Most of the parts worked as expected but gtp5g compilation failed with this setup.


NOTE : At first, golang was not installed in my setup and I installed according to the Installation document.




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


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 



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 

NOTE : <dn_interface> is your network interface name which has access to external world. In my cause the command was as follows : sudo iptables -t nat -A POSTROUTING -o enp0s3 -j MASQUERADE



Clone the free5GC repository


I tried the followings but it didn't work at the second line. I modified it to

      [git clone --recursive]


cd ~
git clone --recursive -b v3.0.6 -j `nproc`
cd free5gc 



Compile network function services in free5gc


I tried this and no problem with this process.


cd ~/free5gc



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 ] 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
cd gtp5g
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*


NOTE :  Sometimes this command does not remove all of the mongo db components. Especially when you tried to install (expectedly or unexpectedly) and failed, you would still various remainings even after you executed this command. In that case, you may need to remove those remaining files manually. What I tried was as follows.

    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 - | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] 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


NOTE : If you have any permission issue when you run any of these commands, run following command and run the above commands with root account.


      # su



Confirm that mongodb is running


If everything went well, you would see mongodb running as shown below.