树莓派Kiosk(展台模式)设置

 • 

安装Raspbian Buster lite

启用SSH

boot分区下新建名称为ssh的空文本

添加WiFi信息

boot分区下新建wpa_supplicant.conf

country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="NETWORK-NAME"
    psk="NETWORK-PASSWORD"
}

设置自动启动

sudo raspi-config

菜单中选择

Boot Options

    Desktop CLI

        Console Autologin

更换自动登录用户

nano /etc/systemd/system/getty@tty1.service.d/autologin.conf

替换 pi

设置local

sudo raspi-config

选择

安装最小GUI组件

sudo apt-get install --no-install-recommends xserver-xorg x11-xserver-utils xinit openbox -y

安装Chrome

sudo apt-get install --no-install-recommends chromium chromium-l10n -y

安装中文字体

sudo apt-get install fonts-wqy-zenhei

sudo apt-get install fonts-wqy-microhei

配置Openbox

sudo nano /etc/xdg/openbox/autostart

添加

xset -dpms			# turn off display power management system
xset s noblank		# turn off screen blanking
xset s off			# turn off screen saver

# Remove exit errors from the config files that could trigger a warning
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State'
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences

# wait for server startup
sleep 5

# Run Chromium in kiosk mode
chromium  --noerrdialogs --disable-infobars --lang=zh-CN --kiosk $KIOSK_URL --arc-play-store-auto-update=off

配置环境

sudo nano /etc/xdg/openbox/environment

添加

export KIOSK_URL=https://url.url

自动启动xserver

使用自动登录的用户
检查~/.bash_profile是不是存在

ls -la ~/.bash_profile

如果不存在创建~/.bash_profile

touch ~/.bash_profile

编辑~/.bash_profile

nano ~/.bash_profile

添加

[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx -- -nocursor

应用更新

source ~/.bash_profile

重启

sudo reboot