Difference between revisions of "Web Kiosk CentOS 7"
Michael.mast (talk | contribs) |
Michael.mast (talk | contribs) |
||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
Boot into Chrome Kiosk mode and display a web page for digital signage. | Boot into Chrome Kiosk mode and display a web page for digital signage. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Setup== | ==Setup== | ||
===Packages=== | ===Packages=== | ||
− | A fresh install of CentOS 7 | + | 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 | + | *x11 server did not install with the group install of Xfce, so it was installed separately. |
− | *<ref>https://bbs.archlinux.org/viewtopic.php?id=225780</ref>Keyboard and mouse did not work out the box, and I had to install the evdev drivers. | + | *<ref>https://bbs.archlinux.org/viewtopic.php?id=225780</ref>Keyboard and mouse did not work out the box, and I had to install the evdev drivers. |
<pre> | <pre> | ||
yum -y update | yum -y update | ||
yum -y install epel-release | yum -y install epel-release | ||
yum makecache | yum makecache | ||
− | yum -y install | + | yum -y install nano xorg-x11-server-Xorg smartmontools chromium xorg-x11-drv-evdev wget httpd mysql php mariadb-server php-mysql |
yum -y group install Xfce | yum -y group install Xfce | ||
</pre> | </pre> |
Revision as of 09:10, 1 July 2021
Contents
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.
yum -y update yum -y install epel-release yum makecache yum -y install nano xorg-x11-server-Xorg smartmontools chromium xorg-x11-drv-evdev wget httpd mysql php mariadb-server php-mysql yum -y group install Xfce
- Install unclutter[2][3], 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.[4]
- 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 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 "create database wordpress;" mysql -e "grant all privileges on wordpress.* to 'wordpress'@'%' identified by 'password';" mysql -e "FLUSH PRIVILEGES;"
- Loosen SELinux. Normall you don't do this, but for something as simple as this I am ok with it.
setsebool -P httpd_unified 1
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>>/home/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
- Make sure to have DNS entries for your site. I am using hosts entries on the computer since it is remote and will not have access to DNS, but will create a DNS entry for management purposes.
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
Configure Power Settings and Disable Mouse Pointer
We want to prevent the system from going to sleep, blanking the screen, loading the screen saver[7], 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[8] 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;
Setup WordPess
But first I download and extract the files needed over ssh.
wget https://wordpress.org/latest.zip unzip latest.zip mv wordpress /var/www/html/ find /var/www/html/wordpress/ -type d -exec chmod 755 {} \; find /var/www/html/wordpress/ -type f -exec chmod 644 {} \; mkdir /var/www/html/wordpress/logs chown -R apache:apache /var/www/html/wordpress
- Setup a vhost to load the site.
cat << EOF >>/etc/httpd/conf.d/vhost.conf <VirtualHost *:80> ServerName localhost DocumentRoot "/var/www/html/wordpress" </VirtualHost> EOF
- Up until now I have been setting this up remotely, however I will now need to start using the ol' keyboard and mouse so I can configure using localhost. Follow the standard wordpress setup[9].