Fluitend door het leven

Narrowcasting Part01 2017 Update
This is an update of the 2013 version

This setup is tested on a Raspberry Pi 3.
I have no idea what the performance on a Pi 0, 1 or 2 is.
  • changed URL for buying to raspberrypi.org
  • step 2 systemd instead of inittab
  • step 3 Chromium instead of Midori
  • some major and minor reformatting

I have made a narrowcasting-system based on LAMP (Linux/Apache/PHP/MySQL) on the small and mighty Raspberry Pi. accessible via a browser.

In this post I will write what I've done to get a minimal desktop with a browser running showing the messages.

To get the Pi working as a narrowcasting system, some adjustments are necessary.
I have tried to adjust the machine for the user (pi) as much as possible and leave the system itself alone.
At this point, there is just one system-file that has to be adjusted (step 2).
Please mind that there are more ways to achieve what I've done below.

The following steps will be addressed:
  1. Get the system up and running
  2. autologin
  3. the desktop

1. Get the system up and running

First of all, buy a Pi!
Select a store from the raspberry pi products page.

After receiving your Pi, it's time to download an operating system. Since I like Debian, I chose Raspbian.
There are excellent guides on the downloadpage on how to install to an SD-card, I have nothing to add to those.
On first boot, you get a few choices.
You should read about them elsewhere, I only mention two here:

At 1, I expanded to use my entire SD-card.
Attention: There is no "Are you sure?", it will expand and tell you to reboot.
Raspberry Pi: extend filesystem
Raspberry Pi: extend filesystem

At 3, I chose to boot to Console and entered Ok.
This is getting complete control over the boot options.
raspi-config: Boot
raspi-config: Boot

2. Autologin

If everything went okay, you should be able to log on to your machine now.
Now it's time to get some autologin going. This is were the power of GNU/Linux comes to light. Adjusting the system to ones wishes is as easy as editing a few text files!

Edit /etc/inittab

This file sets up login options for the users.
$ cd /etc/systemd/system/getty@tty1.service.d
If there is no override.conf in this directory (check with ls)
$ sudo touch override.conf
Add the following content to override.conf
$ sudo nano override.conf (or use Vim)
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin pi --noclear %I $TERM
Once that's done, save your file: ctrl + o to save and ctrl + x to exit (for Vim, use :wq) Now reboot to see if it works
$ sudo reboot

3. the desktop

Install packages

I have chosen to use Chromium and matchbox-window-manager. I also installed unclutter, which hides the mouse cursor from the display.

Set up .bash_profile

You set it up so that X starts locally on logon and if you log on via SSH, there will be no problem.
if [ "$SSH_CONNECTION" != "" ]; then
  echo Logging in with ssh
  return
else
  startx
fi

# rest of your profile goes here

Set up .xsession

This is the file where all the programs that have to run are started.
Please note:
- all programs except the window manager should end in &
- the window manager should be on the last line.
################################################################################
# This is the file where all the programs that have to run are started.
# Please note:
# - all programs except the window manager should end in &
# - the window manager should be on the last line.
# from package: x11-xserver-utils, sets some video settings
xset s off
xset dpms 0 0 0
# hide mouse cursor
exec unclutter -idle 2 &
# start browser
exec chromium-browser --start-fullscreen --disable-gpu --disable-translate --noerrdialogs --incognito --disable-session-crashed-bubble --disable-infobars http://localhost/ &
# start window manager
exec matchbox-window-manager -use_titlebar no
Now reboot and see if it works! If you are now able to see the midori startpage, you have succeeded in creating an autologin on the Raspberry Pi.

Next Time

Part 2 will describe how to set up LAMP on Raspbian, how to configure a schema for the data needed in our narrowcasting system and where to put the files to show the narrowcasting in the browser.
Menno    Werk ^^