- 环境说明
- 系统:debian11 64bit
- Open5GS:2.7.0 点击下载源码
- MongoDB:6.0.0
- 安装MongoDB
-
安装必要的包
sudo apt install gnupg curl
-
导入MongoDB公钥
curl -fsSL https://www.mongodb.org/static/pgp/server-6.0.asc | sudo gpg --dearmor -o /usr/share/keyrings/mongodb-archive-keyring.gpg
-
创建MongoDB源列表文件
echo "deb [signed-by=/usr/share/keyrings/mongodb-archive-keyring.gpg] http://repo.mongodb.org/apt/debian bullseye/mongodb-org/6.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
-
更新包列表并安装MongoDB
sudo apt update sudo apt install mongodb-org
-
启动并设置开机启动
sudo systemctl start mongod sudo systemctl enable mongod
-
检查服务状态
sudo systemctl status mongod
-
创建管理员用户
执行mongosh进入MongoDB shell 切换到admin数据库并创建管理员用户:use admindb.createUser({user: "admin",pwd: "admin",roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]})
-
配置MongoDB安全设置
编辑MongoDB配置文件:sudo vi /etc/mongod.conf security:authorization: enabled 重启生效:sudo systemctl restart mongod
-
验证是否生效
mongosh -u admin -p --authenticationDatabase admin
-
- 安装Open5GS
wget -qO - https://download.opensuse.org/repositories/home:/acetcom:/open5gs:/latest/Debian_10/Release.key | sudo apt-key add - sudo sh -c "echo 'deb https://download.opensuse.org/repositories/home:/acetcom:/open5gs:/latest/Debian_11/ ./' > /etc/apt/sources.list.d/open5gs.list" sudo apt update sudo apt install open5gs
- 安装Open5GS的WebUI
- 安装Node.js
# Download and import the Nodesource GPG key sudo apt install -y ca-certificates curl gnupg sudo mkdir -p /etc/apt/keyrings curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg# Create deb repository echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list# Run Update and Install sudo apt update sudo apt install nodejs -y
- 安装WebUI:(方法1)
curl -fsSL https://open5gs.org/open5gs/assets/webui/install | sudo -E bash -输出:==============================================================================================================================## Download the Open5GS Source Code (v2.7.0)...+ curl -sLf 'https://github.com/open5gs/open5gs/archive/v2.7.0.tar.gz' | tar zxf -## Build the Open5GS WebUI...+ cd ./open5gs-2.7.0/webui && npm clean-install && npm run buildnpm warn EBADENGINE Unsupported engine {npm warn EBADENGINE package: 'react-jsonschema-form@0.50.1',npm warn EBADENGINE required: { node: '>=6', npm: '^2.14.7' },npm warn EBADENGINE current: { node: 'v20.19.0', npm: '10.8.2' }npm warn EBADENGINE }added 813 packages, and audited 814 packages in 1m19 packages are looking for fundingrun `npm fund` for details94 vulnerabilities (5 low, 8 moderate, 42 high, 39 critical)To address issues that do not require attention, run:npm audit fixTo address all issues (including breaking changes), run:npm audit fix --forceRun `npm audit` for details.npm noticenpm notice New major version of npm available! 10.8.2 -> 11.2.0npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.2.0npm notice To update run: npm install -g npm@11.2.0npm notice> open5gs@2.7.0 build> next build> Using external babel configuration> Location: "/home/hslong/open5gs-2.7.0/webui/.babelrc"## Install the Open5GS WebUI...+ mkdir -p /usr/lib/node_modules+ mv ./open5gs-2.7.0/webui /usr/lib/node_modules/open5gs+ chown -R open5gs:open5gs /usr/lib/node_modules/open5gs+ cat << EOF > /lib/systemd/system/open5gs-webui.service[Unit]Description=Open5GS WebUIWants=mongodb.service mongod.service[Service]Type=simpleWorkingDirectory=/usr/lib/node_modules/open5gsEnvironment=NODE_ENV=productionExecStart=/usr/bin/node server/index.jsRestart=alwaysRestartSec=2[Install]WantedBy=multi-user.targetEOF+ systemctl daemon-reload+ systemctl enable open5gs-webuiCreated symlink /etc/systemd/system/multi-user.target.wants/open5gs-webui.service → /lib/systemd/system/open5gs-webui.service.+ deb-systemd-invoke start open5gs-webui## Default Administrator Account [Username:admin, Password:1423]...+ mongosh open5gs ./open5gs-2.7.0/docs/assets/webui/mongo-init.js+ rm -rf ./open5gs-2.7.0==============================================================================================================================
- 安装WebUI:(方法2)
- wget https://github.com/open5gs/open5gs/archive/v2.7.0.tar.gz
- tar xvf v2.7.0.tar.gz
- mv open5gs-2.7.0 /opt
- cd /opt/open5gs-2.7.0/webui
- npm clean-install && npm run build
- 前台运行:node server/index.js
- 系统自启动:
sudo vi /etc/systemd/system/open5gs-webui.service [Unit] Description=Open5GS WebUI After=network.target[Service] User=root WorkingDirectory=/opt/open5gs-2.7.0/webui ExecStart=/usr/bin/node server/index.js Restart=always[Install] WantedBy=multi-user.target
- systemctl daemon-reload
- systemctl enable open5gs-webui
- 查看webui服务状态:systemctl status open5gs-webui
- 查看启动日志:sudo tail -f /var/log/syslog
- 登录WebUI
- http://localhost:9999
- 账号:admin
- 密码:1423
- 安装Node.js
- 配置Open5GS
- 各个组件默认配置
MongoDB = 127.0.0.1 (subscriber data) - http://localhost:9999MME-s1ap = 127.0.0.2 :36412 for S1-MME MME-gtpc = 127.0.0.2 :2123 for S11 MME-frDi = 127.0.0.2 :3868 for S6aSGWC-gtpc = 127.0.0.3 :2123 for S11 SGWC-pfcp = 127.0.0.3 :8805 for SxaSMF-gtpc = 127.0.0.4 :2123 for S5c SMF-gtpu = 127.0.0.4 :2152 for N4u (Sxu) SMF-pfcp = 127.0.0.4 :8805 for N4 (Sxb) SMF-frDi = 127.0.0.4 :3868 for Gx auth SMF-sbi = 127.0.0.4 :7777 for 5G SBI (N7,N10,N11)AMF-ngap = 127.0.0.5 :38412 for N2 AMF-sbi = 127.0.0.5 :7777 for 5G SBI (N8,N12,N11)SGWU-pfcp = 127.0.0.6 :8805 for Sxa SGWU-gtpu = 127.0.0.6 :2152 for S1-U, S5uUPF-pfcp = 127.0.0.7 :8805 for N4 (Sxb) UPF-gtpu = 127.0.0.7 :2152 for S5u, N3, N4u (Sxu)HSS-frDi = 127.0.0.8 :3868 for S6a, CxPCRF-frDi = 127.0.0.9 :3868 for GxNRF-sbi = 127.0.0.10:7777 for 5G SBI SCP-sbi = 127.0.0.200:7777 for 5G SBI SEPP-sbi = 127.0.0.250:7777 for 5G SBI SEPP-n32 = 127.0.0.251:7777 for 5G N32 SEPP-n32f = 127.0.0.252:7777 for 5G N32-f AUSF-sbi = 127.0.0.11:7777 for 5G SBI UDM-sbi = 127.0.0.12:7777 for 5G SBI PCF-sbi = 127.0.0.13:7777 for 5G SBI NSSF-sbi = 127.0.0.14:7777 for 5G SBI BSF-sbi = 127.0.0.15:7777 for 5G SBI UDR-sbi = 127.0.0.20:7777 for 5G SBI
- 各个组件默认配置
- 启动和停止open5GS
- 重启
sudo systemctl restart open5gs-mmed sudo systemctl restart open5gs-sgwcd sudo systemctl restart open5gs-smfd sudo systemctl restart open5gs-amfd sudo systemctl restart open5gs-sgwud sudo systemctl restart open5gs-upfd sudo systemctl restart open5gs-hssd sudo systemctl restart open5gs-pcrfd sudo systemctl restart open5gs-nrfd sudo systemctl restart open5gs-scpd sudo systemctl restart open5gs-seppd sudo systemctl restart open5gs-ausfd sudo systemctl restart open5gs-udmd sudo systemctl restart open5gs-pcfd sudo systemctl restart open5gs-nssfd sudo systemctl restart open5gs-bsfd sudo systemctl restart open5gs-udrd sudo systemctl restart open5gs-webui
- 停止
sudo systemctl stop open5gs-mmed sudo systemctl stop open5gs-sgwcd sudo systemctl stop open5gs-smfd sudo systemctl stop open5gs-amfd sudo systemctl stop open5gs-sgwud sudo systemctl stop open5gs-upfd sudo systemctl stop open5gs-hssd sudo systemctl stop open5gs-pcrfd sudo systemctl stop open5gs-nrfd sudo systemctl stop open5gs-scpd sudo systemctl stop open5gs-seppd sudo systemctl stop open5gs-ausfd sudo systemctl stop open5gs-udmd sudo systemctl stop open5gs-pcfd sudo systemctl stop open5gs-nssfd sudo systemctl stop open5gs-bsfd sudo systemctl stop open5gs-udrd sudo systemctl stop open5gs-webui
- 重启