open5gs/docs/_docs/platform/05-macosx.md

116 lines
3.0 KiB
Markdown
Raw Normal View History

2019-04-27 15:01:51 +00:00
---
title: Mac OS X
head_inline: "<style> .blue { color: blue; } </style>"
---
This guide is based on **macOS High Sierra 10.13.3**.
{: .blue}
### Installing Homebrew
---
```bash
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```
### Getting MongoDB
---
Install MongoDB with Package Manager.
```bash
$ brew install mongodb
```
Run MongoDB server.
```bash
$ mkdir -p ./data/db
$ mongod --dbpath ./data/db
```
### Setting up TUN device (No persistent after rebooting)
---
Install TUN/TAP driver
- You can download it from [http://tuntaposx.sourceforge.net/](http://tuntaposx.sourceforge.net/)
Configure the TUN device.
```bash
$ sudo ifconfig lo0 alias 127.0.0.2 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.3 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.4 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.5 netmask 255.255.255.255
```
Enable IP forwarding & Masquerading
```bash
$ sudo sysctl -w net.inet.ip.forwarding=1
$ sudo sh -c "echo 'nat on {en0} from 45.45.0.0/16 to any -> {en0}' > /etc/pf.anchors/org.nextepc"
$ sudo pfctl -e -f /etc/pf.anchors/org.nextepc
```
**Tip:** The script provided in [$GIT_REPO/support/network/restart.sh](https://github.com/{{ site.github_username }}/nextepc/blob/master/support/network/restart.sh) makes it easy to configure the TUN device as follows:
`$ sudo ./support/network/restart.sh`
{: .notice--info}
### Building NextEPC
---
Install the depedencies for building the source code.
```bash
$ brew install autoconf automake libtool gnu-sed mongo-c-driver libusrsctp gnutls libgcrypt libidn libyaml pkg-config
```
Git clone with `--recursive` option.
```bash
➜ open5gs git clone --recursive https://github.com/{{ site.github_username }}/nextepc
```
To compile with autotools:
```bash
➜ open5gs cd nextepc
➜ nextepc git:(master) ✗ autoreconf -iv
➜ nextepc git:(master) ✗ ./configure --prefix=`pwd`/install
➜ nextepc git:(master) ✗ make -j `nproc`
```
2019-06-01 10:53:57 +00:00
Check whether the compilation is correct.
**Note:** This should require *sudo* due to access `/dev/tun0`.
2019-04-27 15:01:51 +00:00
{: .notice--danger}
2019-06-01 10:53:57 +00:00
```bash
➜ nextepc git:(master) ✗ sudo make check
```
2019-04-27 15:01:51 +00:00
2019-08-25 11:50:01 +00:00
**Tip:** You can also check the result of `make check` with a tool that captures packets. If you are running `wireshark`, select the `loopback` interface and set FILTER to `s1ap || gtpv2 || diameter || gtp`. You can see the virtually created packets. [[testcomplex.pcapng]]({{ site.url }}{{ site.baseurl }}/assets/pcapng/testcomplex.pcapng)
2019-04-27 15:01:51 +00:00
{: .notice--info}
2019-08-25 11:50:01 +00:00
You need to perform **the installation process**.
2019-04-27 15:01:51 +00:00
```bash
2019-08-25 11:50:01 +00:00
➜ nextepc git:(master) ✗ make install
2019-04-27 15:01:51 +00:00
```
### Building WebUI of NextEPC
---
[Node.js](https://nodejs.org/) is required to build WebUI of NextEPC
```bash
$ brew install node
```
Install the dependencies to run WebUI
```bash
➜ nextepc git:(master) ✗ cd webui
➜ webui git:(master) ✗ npm install
```
The WebUI runs as an [npm](https://www.npmjs.com/) script.
```bash
➜ webui git:(master) ✗ npm run dev
```