Web Kiosk CentOS 7
Purpose
Boot into Chrome Kiosk mode and display a web page for digital signage.
Setup
Packages
A fresh install of CentOS 7 minimal. Please note the following
- x11 server did not install with the group install of Xfce, so it was installed separately.
- [1]Keyboard and mouse did not work out the box, and I had to install the evdev drivers.
Base Packages
yum -y update yum -y install epel-release yum makecache yum -y install chromium wget zstd xorg-x11-xinit
XFCE
yum -y group install Xfce yum -y install xorg-x11-drv-evdev xorg-x11-server-Xorg
OpenBox
yum install -y openbox xorg-x11-drv-libinput xorg-x11-server-utils xorg-x11-xinit libev
Unclutter
- Install unclutter[3][4], this is useful for getting rid of the mouse pointer when not in use.
- NOTE: I ran into issues downloading from archlinux, quick and dirty google search had me run across a git repo.[5]
Repo method
This has not been fully tested and may contain bad code.
yum install -y git libev-devel libX11-devel libXt-devel libXi-devel asciidoc yum groupinstall "Development Tools" git clone https://github.com/Airblader/unclutter-xfixes && cd unclutter-xfixes mkdir /usr/share/licenses/unclutter/ make make install
Arch method
wget -O unclutter.tar.zst --content-disposition --max-redirect=5 https://www.archlinux.org/packages/community/x86_64/unclutter/download/ zstd -d unclutter.tar.zst -o unclutter.tar tar -xf unclutter.tar mv usr/bin/unclutter /usr/bin/unclutter rm -rf usr
TTY1 Autologin
TTY Config
Now create the auto-login process.
useradd publicuser rm /etc/systemd/system/getty.target.wants/getty@tty1.service cp /lib/systemd/system/getty@.service /etc/systemd/system/getty@tty1.service sed -i -e "s/\/sbin\/agetty/\0 --autologin publicuser/" /etc/systemd/system/getty@tty1.service ln -s /etc/systemd/system/getty@tty1.service /etc/systemd/system/getty.target.wants/getty@tty1.service cat << EOF >>/home/publicuser/.bash_profile if [[ -z \$DISPLAY ]] && [[ \$(tty) = /dev/tty1 ]]; then # Check if we have a display and we're on TTY1 startx else echo "Please contact the help desk and provide the following" echo "IP : " echo "Hostname : $hostname" fi EOF
Auto Start Window Manager
- Choose which one you want, startxfce4 or openbox.
cat << EOF>>/home/publicuser/.xinitrc exec openbox-session EOF
Reboot and you should see the desktop start up. If it does not troubleshoot.
Configure Chromium Auto-Start
XFCE
cat << EOF>>/etc/xdg/autostart/kiosk.desktop [Desktop Entry] Encoding=UTF-8 Name=Kiosk GenericName=program Comment=LobbyKiosk Exec=chromium-browser --noerrdialogs --kiosk http://siteurl.tld Icon=/usr/share/pixmaps/program.jpg Terminal=false Type=Application Categories= OnlyShowIn=XFCE; EOF
OpenBox
mkdir -p /home/publicuser/.config/openbox cat << EOF > /home/publicuser/.config/openbox/autostart unclutter & chromium-browser --noerrdialogs --kiosk http://siteurl.tld EOF
Configure Power Settings and Disable Mouse Pointer
- NOTE : This is configured for xfce. Another set of instructions will follow for openbox.
We want to prevent the system from going to sleep, blanking the screen, loading the screen saver[8], or showing the pointer on the screen.
One issue I am having is understanding the best method for exporting the display. I am too used to working in bash and not with a gui. The following export does not work, but the display settings appear to still work.
Initially the xset commands were getting ignored by xfce power management. In order to get around this I had to use xfconf-query[9] to make things stick
- Create the script
cat << EOF>>/home/publicuser/power.sh #!/bin/sh sleep 10 export DISPLAY=$(who | grep -E "publicuser pts\/[0-9]" | grep -Eo "\(:[0-9][.]?[0-9]?\)" | sed 's/(//; s/)//') xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/dpms-enabled -s false /usr/bin/unclutter -grab EOF chmod +x /home/publicuser/power.sh sed -i 's/<\/property>/\ \ <property\ name=\"blank-on-ac\"\ type=\"int\"\ value=\"0\"\/>\n&/g' /home/publicuser/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-power-manager.xml
- Create the auto-launch of the script.
cat << EOF>>/etc/xdg/autostart/power.desktop [Desktop Entry] Encoding=UTF-8 Name=powersettings GenericName=program3 Comment=DisablePower Exec=/home/publicuser/power.sh Icon=/usr/share/pixmaps/program.jpg Terminal=false Type=Application Categories= OnlyShowIn=XFCE; EOF
- ↑ https://bbs.archlinux.org/viewtopic.php?id=225780
- ↑ http://xinerama.blogspot.com/2018/09/installing-openbox-on-centos-75.html
- ↑ https://www.archlinux.org/packages/community/x86_64/unclutter/
- ↑ https://stackoverflow.com/questions/660613/how-do-you-hide-the-mouse-pointer-under-linux-x11
- ↑ https://ostechnix.com/auto-hide-mouse-pointer-using-unclutter-after-a-certain-time/#:~:text=Auto%20Hide%20Mouse%20Pointer%20Using%20Unclutter%20After%20A%20Certain%20Time%20In%20Linux&text=If%20the%20mouse%20cursor%20has,after%205%20seconds%20by%20default.
- ↑ https://www.danpurdy.co.uk/web-development/raspberry-pi-kiosk-screen-tutorial/
- ↑ https://superuser.com/questions/461035/disable-google-chrome-session-restore-functionality
- ↑ https://superuser.com/questions/644804/disable-screensaver-screen-blank-via-command-line
- ↑ https://askubuntu.com/questions/407287/change-xfce4-power-manager-option-from-terminal