282
edits
(Updated article, renamed Simple Display 1 to Display 1. Added Display 2 section that gives NOVNC section for remote management.) |
m (→Prerequisites) |
||
(15 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
= Prerequisites = | = Prerequisites = | ||
You will need a few prerequisites before this will work: | You will need a few prerequisites before this will work: | ||
* A TV/Monitor ( | * A TV/Monitor (preferably mounted) to display content | ||
* A RaspberryPi or similar SBC (I've also used LibreComputer LePotato SBC running Armbian) | * A RaspberryPi or similar SBC (I've also used LibreComputer LePotato SBC running Armbian) | ||
* A webserver to serve up the content you want to show (preferably external to the SBC) | * A webserver to serve up the content you want to show (preferably external to the SBC) | ||
=== Display | === Basic Display=== | ||
This is the most basic configuration you can use to turn a RaspberryPi/SBC into a digital sign/display that serves up a web page when started. | This is the most basic configuration you can use to turn a RaspberryPi/SBC into a digital sign/display that serves up a web page when started. | ||
==== Software ==== | ==== Software ==== | ||
Line 62: | Line 62: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===== Turn on autologin ===== | ===== Turn on autologin ===== | ||
1. Create the required directory with | 1. Create the required directory with: | ||
<syntaxhighlight lang="bash"> | |||
mkdir /etc/systemd/system/getty@tty1.service.d | |||
</syntaxhighlight> | |||
2. Create the '''''autologin.conf''''' file in /etc/systemd/system/getty@tty1.service.d and add the contents below. | 2. Create the '''''autologin.conf''''' file in the newly created '''''/etc/systemd/system/getty@tty1.service.d''''' directory and add the contents below. | ||
Note: Change '''''kiosk''''' below to the username that will be used for autologin if you are using something different (root is not recommended) | Note: Change '''''kiosk''''' below to the username that will be used for autologin if you are using something different (root is not recommended) | ||
Line 79: | Line 82: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Ensure this is enabled with | Ensure this is enabled with: | ||
<syntaxhighlight lang="bash"> | |||
systemctl status getty@tty1 | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="text"> | <syntaxhighlight lang="text"> | ||
Line 95: | Line 101: | ||
└─776 /sbin/agetty -o "-p -- \\u" --noclear - linux | └─776 /sbin/agetty -o "-p -- \\u" --noclear - linux | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Run the following command if the service isn't enabled: | |||
<syntaxhighlight lang="bash"> | |||
systemctl enable getty@tty1 | |||
</syntaxhighlight> | |||
===== Set kiosk user .profile ===== | ===== Set kiosk user .profile ===== | ||
Change /home/kiosk/.profile to the contents below: | Change '''''/home/kiosk/.profile''''' to the contents below: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Line 146: | Line 158: | ||
#[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx -- -nocursor | #[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx -- -nocursor | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==== First Time Startup ==== | ==== First Time Startup ==== | ||
Now restart the SBC and it should automatically login as your kiosk user and stop at the command prompt. | Now restart the SBC and it should automatically login as your kiosk user and stop at the command prompt. | ||
===== Additional Configuration ===== | ===== Additional Configuration ===== | ||
If you need to do additional configuration for Chromium (install an autorefresh or other extension(s), change screen size, etc). then start the browser with | If you need to do additional configuration for Chromium (install an autorefresh or other extension(s), change screen size, etc). then start the browser with: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
startx | startx | ||
Line 161: | Line 174: | ||
The SBC will boot up and launch Chromium to show the web page you specified. | The SBC will boot up and launch Chromium to show the web page you specified. | ||
=== Display | |||
=== Display with Remote Management=== | |||
This builds off the Display 1 setup with some additional features: | This builds off the Display 1 setup with some additional features: | ||
* VNC using NOVNC. This allows remote control of the display via a web browser. | * VNC using NOVNC. This allows remote control of the display via a web browser. | ||
Line 180: | Line 194: | ||
===== /etc/xdg/openbox/autostart ===== | ===== /etc/xdg/openbox/autostart ===== | ||
Replace the contents of this file with the following: | Replace the contents of this file with the following: | ||
Note: change '''''<URL TO VISIT>''''' to webserver URL you want to display. | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
# | # | ||
Line 200: | Line 217: | ||
#Start x0vncserver and serve up VNC on port localhost:5900 | #Start x0vncserver and serve up VNC on port localhost:5900 | ||
/usr/bin/x0vncserver -passwordfile /home/ | /usr/bin/x0vncserver -passwordfile /home/kiosk/.vnc/passwd -display :0 | ||
# If you want to use XFCE config tools... | # If you want to use XFCE config tools... | ||
Line 214: | Line 231: | ||
#Start websockify to proxy novnc to port 6080 using self-signed SSL cert and vnc on localhost:5900 | #Start websockify to proxy novnc to port 6080 using self-signed SSL cert and vnc on localhost:5900 | ||
/usr/bin/websockify -D --web=/usr/share/novnc/ --cert=/home/ | /usr/bin/websockify -D --web=/usr/share/novnc/ --cert=/home/kiosk/novnc.pem --ssl-only 6080 localhost:5900 | ||
#Start OSDSH | #Start OSDSH | ||
Line 264: | Line 281: | ||
done | done | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===== Generate SSL certificate ===== | ===== Generate SSL certificate ===== | ||
* Navigate to the /home/kiosk user directory | * Navigate to the '''''/home/kiosk''''' user directory | ||
* Run the following command to generate a self-signed SSL certificate with a 10 year life span: | * Run the following command to generate a self-signed SSL certificate with a 10 year life span: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
openssl req -x509 -nodes -newkey rsa:3072 -keyout novnc.pem -out novnc.pem -days 3650 | openssl req -x509 -nodes -newkey rsa:3072 -keyout novnc.pem -out novnc.pem -days 3650 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===== Generate VNC Password File ===== | ===== Generate VNC Password File ===== | ||
Run the following command to create the vnc password file (make note of this for later): | Run the following command to create the vnc password file (make note of this for later): | ||
Line 276: | Line 295: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===== Firewall ===== | ===== Firewall ===== | ||
Edit (or create) the /etc/rc.local file and add/replace the contents with the following: | Edit (or create) the '''''/etc/rc.local''''' file and add/replace the contents with the following: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
#!/bin/bash | #!/bin/bash | ||
Line 297: | Line 316: | ||
systemctl enable rc-local | systemctl enable rc-local | ||
</syntaxhighlight> | </syntaxhighlight> | ||
* Make script executable | |||
<syntaxhighlight lang="bash"> | |||
chmod a+x /etc/rc.local | |||
</syntaxhighlight> | |||
==== First Time Startup ==== | ==== First Time Startup ==== | ||
Restart the SBC to make sure it will boot up and start Chromium. | Restart the SBC to make sure it will boot up and start Chromium. | ||
==== Remote Access via NOVNC ==== | ==== Remote Access via NOVNC ==== | ||
You can manage the device by pointing a web browser at https://<device IP>:6080 | You can manage the device by pointing a web browser at '''''https://<device IP>:6080''''' | ||
* When prompted accept the invalid certificate | * When prompted accept the invalid certificate | ||
* Login to NOVNC using the password you | * Login to NOVNC using the password you created using vncpasswd | ||
= Miscellaneous = | |||
Sometimes things happen and the display will "get stuck" or lose internet connectivity. When this happens you have a few options: | |||
# Setup a nightly reboot event via crontab or systemd timers | |||
# Setup a watchdog to look for lost network connectivity and restart the system |