DEV Community

chenchih
chenchih

Posted on • Edited on

Setup GenieACS under Ubuntu24.04

Setup GenieACS

There are many setup tutorials on setup genieacs on internet; however, some of them use the 20.04 Ubuntu version. I like to show using 22.04 on some settings, some of the configure are different, especially with the MongoDB and genieacs configure.

I have write an automation script to run it without setting it, which support ubuntu 20.04, 22.04, and 24.04. The biggest difference between different versions of Ubuntu is libssl and mogodb version. Please referto this link for the script.

Environment

HW: Raspberry Pi 5
OS: Ubuntu 24.04 ARM

Check Ubuntu Version

lsb_release -a
Enter fullscreen mode Exit fullscreen mode

  • Check Kernel
uname -ar
Enter fullscreen mode Exit fullscreen mode

Check HW

  • check model
cat /proc/device-tree/model
#or
cat /proc/cpuinfo | grep 'Model'
Enter fullscreen mode Exit fullscreen mode
  • Check CPU type
lscpu
Enter fullscreen mode Exit fullscreen mode

Setup

1. Install node.js

curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt install nodejs
node -v
Enter fullscreen mode Exit fullscreen mode

2. Install MongoDB

Note: In Ubuntu 24.04 the SSL default uses libssl3, so you don't need to install. I mention it here because many tutorials mention installing libssl, if you install will encounter an error.

Check your SSL:

dpkg -l | grep libssl3
Enter fullscreen mode Exit fullscreen mode

2.1 Import the MongoDB GPG Key

#update
sudo apt update 
#install curl
sudo apt install gnupg curl -y 
#use curl to download MongoDB
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \ sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \ --dearmor
Enter fullscreen mode Exit fullscreen mode

2.2 Add the MongoDB Repository

echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list

sudo apt update
Enter fullscreen mode Exit fullscreen mode

2.3 Install MongoDB

sudo apt install -y mongodb-org
Enter fullscreen mode Exit fullscreen mode

2.4 Start and Enable the MongoDB Service

sudo systemctl start mongod 
sudo systemctl enable mongod 
sudo systemctl status mongod
Enter fullscreen mode Exit fullscreen mode

3. Install GenieACS

You can refer genieacs official site for more details

sudo apt update
sudo apt install nodejs npm

sudo npm install -g genieacs@1.2.13
sudo useradd --system --no-create-home --user-group genieacs

mkdir /opt/genieacs
mkdir /opt/genieacs/ext
chown genieacs:genieacs /opt/genieacs/ext
Enter fullscreen mode Exit fullscreen mode

4. genieacs setting

4.1 modify genieacs.env

vi /opt/genieacs/genieacs.env

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
Enter fullscreen mode Exit fullscreen mode

4.2 Set file ownership and permissions

sudo chown genieacs:genieacs /opt/genieacs/genieacs.env
sudo chmod 600 /opt/genieacs/genieacs.env
Enter fullscreen mode Exit fullscreen mode

4.3 adding jwt secret

node -e "console.log(\"GENIEACS_UI_JWT_SECRET=\" + require('crypto').randomBytes(128).toString('hex'))" >> /opt/genieacs/genieacs.env
Enter fullscreen mode Exit fullscreen mode

If you don't add this one will occur error when accessing genieacs url like below:

4.4 Create logs directory

mkdir /var/log/genieacs
chown genieacs:genieacs /var/log/genieacs
Enter fullscreen mode Exit fullscreen mode

4.5 Create systemd unit files

4.5.1 Run the following command to create genieacs-cwmp service

you can use the which genieacs-cwmp to check the location and paste in below ExecStart option.

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

[Unit]
Description=GenieACS CWMP
After=network.target

[Service]
User=genieacs
EnvironmentFile=/opt/genieacs/genieacs.env
ExecStart=/usr/bin/genieacs-cwmp

[Install]
WantedBy=default.target
Enter fullscreen mode Exit fullscreen mode

4.5.2 Create genieacs-nbi service

you can use the which genieacs-nbi to check the location and paste in below ExecStart option.

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

[Unit]
Description=GenieACS NBI
After=network.target

[Service]
User=genieacs
EnvironmentFile=/opt/genieacs/genieacs.env
ExecStart=/usr/bin/genieacs-nbi
ExecStart=/usr/local/bin/genieacs-nbi

[Install]
WantedBy=default.target
Enter fullscreen mode Exit fullscreen mode

4.5.3 Create genieacs-fs service
you can use the which genieacs-fs to check the location and paste in below ExecStart option.

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

[Unit]
Description=GenieACS FS
After=network.target

[Service]
User=genieacs
EnvironmentFile=/opt/genieacs/genieacs.env
ExecStart =/usr/local/bin/genieacs-fs

[Install]
WantedBy=default.target
Enter fullscreen mode Exit fullscreen mode

4.5.4 Create genieacs-ui service:

you can use the which genieacs-ui to check the location and paste ExecStart

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

[Unit]
Description=GenieACS UI
After=network.target

[Service]
User=genieacs
EnvironmentFile=/opt/genieacs/genieacs.env
ExecStart=/usr/local/bin/genieacs-ui 

[Install]
WantedBy=default.target
Enter fullscreen mode Exit fullscreen mode

4.5.5 configure log file rotation using logrotate

nano /etc/logrotate.d/genieacs

/var/log/genieacs/*.log /var/log/genieacs/*.yaml {
    daily
    rotate 30
    compress
    delaycompress
    dateext
}
Enter fullscreen mode Exit fullscreen mode

4.5.6 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
Enter fullscreen mode Exit fullscreen mode

It should be running all 4 services.

4.5.7 access to the geniacs http://IPaddress:3000

You can use this command to check host or IP: hostname -I or ip a

If you want your cpe to connect to genieacs your url must add port 7547

http://genieIPADD:7547

It should work now, and look like below

Summary

It should have a great understand on how to setup geniacs server, an easy way. I have been encouter many issue especially with libssl and mogobdb on differeent Ubuntu version. I literally have figure out what causes the problem, the version not support.

Lastly thanks for reading my post, any question please free to leave comment.

Reference:

Top comments (0)