ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

genieacs 安装指南

2021-12-28 12:00:52  阅读:653  来源: 互联网

标签:指南 node sudo genieacs cwmp systemctl GenieACS 安装


目录

Installation Guide

Prerequisites

Install GenieACS

Configure systemd

genieacs配置​

cpe认证设置

Online设置

会话超时设置

其他:

genieacs基本操作

genieacs配置更改

安装过程遇到的问题:


genieacs官网:GenieACS

genieacs开发手册:Welcome to GenieACS’s documentation! — GenieACS Documentation 1.2.8 documentation

genieacs 论坛:GenieACS Forum - GenieACS community

(注意:可选用docker进行安装 ,这里不做介绍)

安装指南参考官网Installation Guide — GenieACS Documentation 1.2.8 documentation

Installation Guide

This guide is for installing GenieACS on a single server on any Linux distro that uses systemd as its init system.

The various GenieACS services are independent of each other and may be installed on different servers. You may also run multiple instances of each in a load-balancing/failover setup.

Attention

For production deployments make sure to configure TLS and change UI_JWT_SECRET to a unique and secure string. Refer to HTTPS section for how to enable TLS to encrypt traffic.

Prerequisites

Node.js

GenieACS requires Node.js 10.x and up. Refer to Node.js for instructions.

注意:如果Node.js版本过低,则运行时会出错,n模块可能存在无法升至10.x以上,建议使用nvm模块进行升级,网上资料较多并且安装简单,可自行升级,提供传送门:https://blog.csdn.net/sinat_23958625/article/details/86491282

MongoDB

GenieACS requires MongoDB 3.6 and up. Refer to MongoDB: the application data platform | MongoDB for instructions.

(注意:必须安装到对应的版本以上,否则运行不了)

Install GenieACS

Installing from NPM:

sudo npm install -g genieacs@1.2.5

Installing from source

If you prefer installing from source, such as when running a GenieACS copy with custom patches, refer to README.md file in the source package. Adjust the next steps below accordingly.

Configure systemd

Create a system user to run GenieACS daemons

sudo useradd --system --no-create-home --user-group genieacs

Create directory to save extensions and environment file

We’ll use /opt/genieacs/ext/ directory to store extension scripts (if any).

mkdir /opt/genieacs
mkdir /opt/genieacs/ext
chown genieacs:genieacs /opt/genieacs/ext

Create the file /opt/genieacs/genieacs.env to hold our configuration options which we pass to GenieACS as environment variables. See Environment Variables section for a list of all available configuration options.

GENIEACS_CWMP_ACCESS_LOG_FILE=/var/log/genieacs/genieacs-cwmp-access.log
GENIEACS_NBI_ACCESS_LOG_FILE=/var/log/genieacs/genieacs-nbi-access.log
GENIEACS_FS_ACCESS_LOG_FILE=/var/log/genieacs/genieacs-fs-access.log
GENIEACS_UI_ACCESS_LOG_FILE=/var/log/genieacs/genieacs-ui-access.log
GENIEACS_DEBUG_FILE=/var/log/genieacs/genieacs-debug.yaml
NODE_OPTIONS=--enable-source-maps
GENIEACS_EXT_DIR=/opt/genieacs/ext
GENIEACS_UI_JWT_SECRET=secret

Set file ownership and permissions:

sudo chown genieacs:genieacs /opt/genieacs/genieacs.env
sudo chmod 600 /opt/genieacs/genieacs.env

Create logs directory

mkdir /var/log/genieacs
chown genieacs:genieacs /var/log/genieacs

Create systemd unit files

Create a systemd unit file for each of the four GenieACS services. Note that we’re using EnvironmentFile directive to read the environment variables from the file we created earlier.

Each service has two streams of logs: access log and process log. Access logs are configured here to be dumped in a log file under /var/log/genieacs/ while process logs go to journald. Use journalctl command to view process logs.

Attention

If the command systemctl edit --force --full fails, you can create the unit file manually.

(注意:如果systemctl edit失败,需在/etc/systemd/system/中创建genieacs-nbi.service、genieacs-ui.service、genieacs-fs.service、genieacs-cwmp.service,并修改权限)

  1. Run the following command to create genieacs-cwmp service:

sudo systemctl edit --force --full genieacs-cwmp

Then paste the following in the editor and save:

[Unit]
Description=GenieACS CWMP
After=network.target
 
[Service]
User=genieacs
EnvironmentFile=/opt/genieacs/genieacs.env
ExecStart=/usr/bin/genieacs-cwmp
 
[Install]
WantedBy=default.target

(注意: ExecStart需修改为对应genieacs-cwmp路径,可通过命令which genieacs-cwmp查看)

  1. Run the following command to create genieacs-nbi service:

sudo systemctl edit --force --full genieacs-nbi

Then paste the following in the editor and save:

[Unit]
Description=GenieACS NBI
After=network.target
 
[Service]
User=genieacs
EnvironmentFile=/opt/genieacs/genieacs.env
ExecStart=/usr/bin/genieacs-nbi
 
[Install]
WantedBy=default.target
  1. Run the following command to create genieacs-fs service:

sudo systemctl edit --force --full genieacs-fs

Then paste the following in the editor and save:

[Unit]
Description=GenieACS FS
After=network.target
 
[Service]
User=genieacs
EnvironmentFile=/opt/genieacs/genieacs.env
ExecStart=/usr/bin/genieacs-fs
 
[Install]
WantedBy=default.target
  1. Run the following command to create genieacs-ui service:

sudo systemctl edit --force --full genieacs-ui

Then paste the following in the editor and save:

[Unit]
Description=GenieACS UI
After=network.target
 
[Service]
User=genieacs
EnvironmentFile=/opt/genieacs/genieacs.env
ExecStart=/usr/bin/genieacs-ui
 
[Install]
WantedBy=default.target

Configure log file rotation using logrotate

Save the following as /etc/logrotate.d/genieacs

/var/log/genieacs/*.log /var/log/genieacs/*.yaml {
    daily
    rotate 30
    compress
    delaycompress
    dateext
}

Enable and start services

sudo systemctl enable genieacs-cwmp
sudo systemctl start genieacs-cwmp
sudo systemctl status genieacs-cwmp
 
sudo systemctl enable genieacs-nbi
sudo systemctl start genieacs-nbi
sudo systemctl status genieacs-nbi
 
sudo systemctl enable genieacs-fs
sudo systemctl start genieacs-fs
sudo systemctl status genieacs-fs
 
sudo systemctl enable genieacs-ui
sudo systemctl start genieacs-ui
sudo systemctl status genieacs-ui

Review the status message for each to verify that the services are running successfully.

genieacs配置

acs认证设置

Key:cwmp.auth

Value:AUTH("cwmp","cwmp")

cpe认证设置

Key:cwmp.connectionRequestAuth

Value:AUTH("cwmpd","cwmpd")

Online设置

可以设置配置cwmp.deviceOnlineThreshold来调整超时前等待的时间。默认为 4000(以毫秒为单位)

Key:cwmp.deviceOnlineThreshold

Value:10000

会话超时设置

可以配置cwmp.deviceOnlineThreshold来调整会话超时时间

Key:cwmp.seesionTimeout

Value:"10000"

其他:

可在论坛GenieACS Forum - GenieACS community中搜索对应ACS产生的异常

genieacs基本操作

1:任务队列数,需要调用操作2才会将队列中任务发送出去

2:Commit发送数据,将1中Queued全部整合成报文在一个session中发送出去

3:搜索栏,可通过节点名称过滤节点

4:部分PRC操作

  • reboot:重启

  • reset:恢复出厂设置

  • Push file 上传文件 如固件升级

  • Delete:删除当前设备

5:Log,能查看当前设备的错误返回情况

6:部分RPC操作,操作后将会放入Queued队列中

7、12:刷新节点,通过节点后带有数字的为object,详细可查看协议或规格

  • 7为param,刷新7时,会调用getParamValue刷新当前值

  • 12位object,刷新12时,会先调用getParamName获取PortMapping下所有的{i}节点名称,如PortMapping.1. PortMapping.2. ……PortMapping.n.等,当前仅存在PortMapping.1. 然后再调用getParamValue获取其子节点值

详细可通过wireshark抓包查看

8:当param中属性rw=1,可写入时,ACS会生成此图标,可通过调用setParamName设置CPE参数值

9:当object中属性rw=1,可写入时,ACS会生成此图标,可通过调用addObject添加CPE object实例值

10:当object中属性rw=1,可写入时,ACS会生成此图标,可通过调用delObject删除CPE object实例值

11:清空队列Queued

genieacs配置更改

配置为systemctl edit --force --full genieacs-*中

EnvironmentFile=/opt/genieacs/genieacs.env

配置中参数设置参考Environment Variables — GenieACS Documentation 1.2.8 documentation

服务开启 sudo systemctl enable genieacs-cwmp sudo systemctl enable genieacs-nbi sudo systemctl enable genieacs-fs sudo systemctl enable genieacs-ui

服务开始 sudo systemctl start genieacs-cwmp sudo systemctl start genieacs-nbi sudo systemctl start genieacs-fs sudo systemctl start genieacs-ui

服务停止 sudo systemctl stop genieacs-cwmp sudo systemctl stop genieacs-nbi sudo systemctl stop genieacs-fs sudo systemctl stop genieacs-ui

服务状态查询 sudo systemctl status genieacs-cwmp sudo systemctl status genieacs-nbi sudo systemctl status genieacs-fs sudo systemctl status genieacs-ui

安装过程遇到的问题:

由于安装使用的是genieacs账户,当在root时,nodejs的版本是最新的,但在genieacs账号中node指令可能仍然是低版本

解决方法1:

1.切换至genieacs查看node的路径

2.并将更新好的node14.17.1 软链接到node中

genieacs@ubuntu:/xx$ node --version
v8.17.0
genieacs@ubuntu:/xx$ which node
/usr/local/bin/node
genieacs@ubuntu:/xx$ su
root@ubuntu:/xx$
root@ubuntu:/xx$ cd /usr/local/bin/
root@ubuntu:/usr/local/bin$ find / -name "node"
……
/usr/bin/node
/usr/local/bin/node
/usr/local/share/doc/node
/usr/local/n/versions/node
/usr/local/n/versions/node/8.17.0/bin/node
/usr/local/n/versions/node/8.17.0/share/doc/node
/usr/local/n/versions/node/8.17.0/include/node
/home/ecos/.nvm/versions/node
/home/ecos/.nvm/versions/node/v14.17.1/bin/node
/home/ecos/.nvm/versions/node/v14.17.1/share/doc/node
/home/ecos/.nvm/versions/node/v14.17.1/include/node
/home/ecos/.nvm/.cache/src/node-v14.17.1/files/node
/home/ecos/.nvm/.cache/src/node-v14.17.1/files/deps/v8/tools/node
……

root@ubuntu:/usr/local/bin# sudo ln -s /home/ecos/.nvm/versions/node/v14.17.1/bin/node ./node

标签:指南,node,sudo,genieacs,cwmp,systemctl,GenieACS,安装
来源: https://blog.csdn.net/m0_37312808/article/details/122188169

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有