/
build_free5GC.sh
executable file
·86 lines (75 loc) · 2.31 KB
/
build_free5GC.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# !/bin/bash
# Automatically setup the free5GC experiment
node_name=$(hostname)
workdir=$(pwd)
echo "Working directory is $workdir"
cd $workdir
echo "Start to configure free5GC on $node_name ..."
echo "========= Check whether GO is installed ========="
if command -v go >/dev/null 2>&1; then
version=$(go version | awk '{print $3}')
if [ $version == 'go1.14.4' ]; then
echo "Current go version is $version"
else
echo 'exists go, remove the existing version and install Go 1.14.4:'
# this assumes your current version of Go is in the default location
sudo rm -rf /usr/local/go
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
rm go1.14.4.linux-amd64.tar.gz
fi
else
echo 'no exists go'
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
rm go1.14.4.linux-amd64.tar.gz
fi
echo "========= Install control-plane supporting packages ========="
sudo apt -y update
sudo apt -y install mongodb wget git
sudo systemctl start mongodb
echo "========= Install user-plane supporting packages ========="
# 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
echo "========= Install gtp5g ========="
cd $HOME
git clone https://github.com/free5gc/gtp5g.git
cd $HOME/gtp5g
git checkout v0.4.0
make
sudo make install
echo "========= Sync and Update submoudle ========="
cd $workdir
git submodule sync
git submodule update --init
echo "========= Build Kernel free5GC ========="
cd $workdir/kernel-free5gc3.0.5
git submodule sync
git submodule update --init
echo "Build smf"
make smf
echo "Build amf"
make amf
echo "Build nssf"
make nssf
echo "Build pcf"
make pcf
echo "Build nrf"
make nrf
echo "Build ausf"
make ausf
echo "Build udm"
make udm
echo "Build udr"
make udr
echo "Build UPF"
make upf
echo "========= free5GC is set up ========="