Difference between revisions of "Web Kiosk CentOS 7"

From Michael's Information Zone
Jump to navigation Jump to search
Line 31: Line 31:
 
mv usr/bin/unclutter /usr/bin/unclutter
 
mv usr/bin/unclutter /usr/bin/unclutter
 
rm -rf usr
 
rm -rf usr
 +
</pre>
 +
*Start the services and prep for config
 +
<pre>
 +
systemctl enable httpd
 +
systemctl enable mariadb
 +
systemctl start httpd
 +
systemctl start mariadb
 +
mysql -e "UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';"
 +
mysql -e "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
 +
mysql -e "DELETE FROM mysql.user WHERE User='';"
 +
mysql -e "DROP DATABASE test;"
 +
mysql -e "FLUSH PRIVILEGES;"
 
</pre>
 
</pre>
  

Revision as of 16:04, 12 July 2018

Purpose

Powers that be wanted a TV mounted in a lobby, with content playing on it for visitors to ignore. At first I was told to install a flash drive and play images with the flush mount TV. Instead I thought it would be a good idea to have a NUC installed behind the TV running a web browser in full screen mode, displaying a WordPress site that my boss could manage (He really likes wordpress).

Hardware

Intel BOXNUC6CAYH
-2GB DDR3 RAM (I had laying around, should be enough to display a single web page and run the background tasks)
-Intel(R) Celeron(R) CPU J3455 @ 1.50GHz (Came with the NUC. Just enough to display a web page and run WordPress)
-KingDian S100 16GB SSD (This was dirt cheap, and will probably die with the lack of RAM installed.)

This is connected to the wifi since there is no ethernet installed behind the TV. But since the site is on the unit I can live with broken connections. A simple script later on should take care of this.

Setup

Packages

A fresh install of CentOS 7, and the usual basics. Please note the following

  • x11 server did not install with the group install of Xfce, so it was installed seperately.
  • [1]Keyboard and mouse did not work out the box, and I had to install the evdev drivers. Granted no one should be using a keyboard and mouse with this system, but I will be running VNC as an extra method for managing the system (Windows weenies will be asking fewer questions this way.)
yum -y update
yum -y install epel-release
yum makecache
yum -y install htop nano xorg-x11-server-Xorg smartmontools chromium xorg-x11-drv-evdev wget httpd mysql php mariadb-server
yum -y group install Xfce
  • Install unclutter[2][3], this is useful for getting rid of the mouse pointer when not in use.
wget -O unclutter.tar https://www.archlinux.org/packages/community/x86_64/unclutter/download/
tar -xf unclutter.tar
mv usr/bin/unclutter /usr/bin/unclutter
rm -rf usr
  • Start the services and prep for config
systemctl enable httpd
systemctl enable mariadb
systemctl start httpd
systemctl start mariadb
mysql -e "UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';"
mysql -e "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
mysql -e "DELETE FROM mysql.user WHERE User='';"
mysql -e "DROP DATABASE test;"
mysql -e "FLUSH PRIVILEGES;"

TTY1 Autologin

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

cat << EOF>>/hom/publicuser/.xinitrc
exec startxfce4
EOF

reboot

After the reboot, you should see the desktop start up. If it does not troubleshoot.

Configure Chromium Auto-start

[4][5]

cat << EOF>>/etc/xdg/autostart/kiosk.desktop
[Desktop Entry]
Encoding=UTF-8
Name=Kiosk
GenericName=program
Comment=LobbyKiosk
Exec=chromium-browser --noerrdialogs --kiosk http://localhost
Icon=/usr/share/pixmaps/program.jpg
Terminal=false
Type=Application
Categories=
OnlyShowIn=XFCE;
EOF

Configure Power Settings and Disable Mouse Pointer

We want to prevent the system from going to sleep, blanking the screen, loading the screen saver[6], or showing the pointer on the screen.

  • Create the script
cat << EOF>>/home/publicuser/power.sh
#!/bin/sh
sleep 10
export DISPLAY=:0.0
xset s off
xset s noblank
xset -dpms
/usr/bin/unclutter -grab
EOF

chmod +x /home/publicuser/power.sh
  • 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;