I was tasked with creating a simple dashboard for a client of ours that auto runs on boot of the computer. This weekend I sat down to work on this and here’s what I found.
First, make sure you go with Rasbian Server edition of the OS. I tried with various other flavours and it was a convoluted process to remove GDM or install LXDE and actually have this run with minimal effort. This method takes around 15 minutes to setup and test, and I’m on a low speed satellite internet link – should be much faster if you have real Internet access!
Here’s how to do it;
The rest assumes you’ve already installed Vanilla Raspbian Server OS, connected to wifi if needed, and are at a shell prompt. Then you can begin by running the following commands
sudo apt-get update sudo apt-get upgrade
That will get the system upgraded to the latest editions of everything you’re going to need next. Now let’s install the apps we need
# sudo apt-get install --no-install-recommends chromium-browser # sudo apt-get install --no-install-recommends xserver-xorg # sudo apt-get install --no-install-recommends x11-xserver-utils # sudo apt-get install --no-install-recommends xinit # sudo apt-get install --no-install-recommends lxde # sudo apt-get install lightdm screen aptitude rpd-plym-splash
Now you can go ahead and run raspi-config to edit some settings
# sudo raspi-config
Here you’re going to want to do the following;
- setup the localization and timezone - setup splashscreen if desired - setup automatic login to x11 as the user 'pi'
Then exit and save the settings.
Now you’re going to want to edit the xsession file so you can include the auto start of the browser
# sudo nano /etc/xdg/lxsession/LXDE/autostart
Then you’re going to want to make sure it looks like this (usually the top three lines will already be there on a typical install)
@lxpanel --profile LXDE-pi @pcmanfm --desktop --profile LXDE-pi @xscreensaver -no-splash /usr/bin/chromium-browser --kiosk --disable-restore-session-state https://google.ca
Then exit, and save the file (ctrl+x, enter to save).
Now we’ll go ahead and install unclutter, this will make sure the mouse pointer doesn’t display after a few minutes of inactivity.
# sudo apt-get install unclutter
Now we’ll remove anything we don’t need, just for good measure!
# sudo apt autoremove
And now you can reboot and wait a few seconds for it to boot into X11 and then start Chromium and display the site you listed above.
# sudo reboot
If you want to change the url to something else, just edit the autostart file again and change the url at the end of the line, exit, save, and reboot again to see the changes.