Skip to content

Install Nodel as a serviced process on Armbian Buster

Mic edited this page Feb 3, 2022 · 5 revisions

Copy Nodel files into place. Replace with your nodel version.

sudo mkdir /opt/nodel
sudo cp nodelHost-<nodelversion>.jar /opt/nodel/nodel.jar

Install Java.

sudo apt install -y apt-transport-https ca-certificates wget dirmngr gnupg software-properties-common
wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
sudo apt update -y
sudo apt install -y adoptopenjdk-8-hotspot-jre

Install JSVC

sudo apt-get install -y jsvc

Verify installation.

java -version

If required, change the default Java version to 8.

sudo update-alternatives --config java

Set user permissions for Nodel directory

sudo chown -R nodel.nodel /opt/nodel

Run on the console (for testing):

cd /opt/nodel
sudo java -jar nodel.jar

After running this test, you should be able to view Nodel in a browser.

Create daemon startup script:

sudo nano /lib/systemd/system/nodel.service 

Copy and paste the following code into the editor. You may want to modify the 'user' parameter to run Nodel as a different user ('nodel' by default).

[Unit]
Description=Nodel
After=network-online.target

[Service]
Type=forking
Environment=JAVA_HOME=/usr/lib/jvm/adoptopenjdk-8-hotspot-jre-arm64
RestartSec=30
Restart=on-failure
User=nodel
ExecStart=/usr/bin/jsvc \
            -cp /usr/share/java/commons-daemon.jar:/opt/nodel/nodel.jar \
            -cwd /opt/nodel \
            -user nodel \
            -java-home ${JAVA_HOME} \
            -pidfile /var/run/nodel/nodel.pid \
            -errfile SYSLOG \
            -outfile SYSLOG \
            org.nodel.nodelhost.Service

ExecStop=/usr/bin/jsvc \
            -pidfile /var/run/nodel/nodel.pid \
            -stop \
            org.nodel.nodelhost.Service

[Install]
WantedBy=multi-user.target

Press ctrl-x to exit and save the file

Configure Armbian to automatically create the folder for .pid on startup

sudo sh -c "echo 'd /var/run/nodel 0755 nodel nodel' > /usr/lib/tmpfiles.d/nodel.conf"

Add to startup

sudo systemctl enable nodel.service

Reboot and Nodel should start automatically

sudo shutdown -r now

Tidy

Disable some headers by editing this file:

sudo nano /etc/default/armbian-motd

Edit this line:

MOTD_DISABLE="header config sysinfo tips"