Akkadius / glass-isc-dhcp

Glass - ISC DHCP Server Interface
MIT License
707 stars 144 forks source link

Glass on Centos 8 #62

Open moelfus opened 4 years ago

moelfus commented 4 years ago

Hi, nice project. I set it up on a clean Centos 8 system and wanted to share how I got it running. In case someone is interested:

As root install nodejs $ yum -y install nodejs

do as in the original recipe:

$ cd /opt
$ git clone https://github.com/Akkadius/glass-isc-dhcp.git
$ cd glass-isc-dhcp
$ mkdir logs
$ chmod u+x ./bin/ -R
$ chmod u+x *.sh
$ npm install
$ npm install forever -g

You can ignore the npm warning about fsevent since you are not using MacOs:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/forever/node_modules/chokidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

Beforer testing you have to change a path in /opt/glass-isc-dhcp/config/glass_config.json:

 "leases_file": "/var/lib/dhcpd/dhcpd.leases",
  "log_file": "/var/log/dhcpd/dhcpd.log",

Then let the firewall know about glass, you may have to adjust the zone. We have an internal and external zone. Otherwise public would also be an option:

$ firewall-cmd --zone=internal --add-port=3000/tcp --permanent
$ firewall-cmd --reload

In a final step you may register glass as system service. Therefore create: vim /etc/systemd/system/dhcpd_glass.service with the content:

[Unit]
Description=Glass ISC DHCP Server Gui Service

[Service]
ExecStart=/usr/bin/node  /opt/glass-isc-dhcp/bin/www
# Required on some systems
WorkingDirectory=/opt/glass-isc-dhcp
Restart=always
# Restart service after 10 seconds if node service crashes
RestartSec=10
# Output to syslog
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=glass-dhcp

[Install]
WantedBy=multi-user.target

Enable the service: systemctl enable dhcpd_glass.service and start it: systemctl start dhcpd_glass.service

Have fun!