installation guide for fyrelab sentri

disclaimer

The usage of fyrelab sentri and this installation guide is on your own risk.

express installation (for Raspberry Pi 2)

installation for windows

To copy the system image on your SD card you can use one of many tools available for Windows. We suggest to use Rufus. A USB card reader is required for the process.

  1. Download and install Rufus from this website. You will see the downloadable file when you scroll down. It should be called "Rufus 2.9".
  2. Run the executable file from your download folder.
    You will see something similar to this:a picture of the rufus UI
  3. Insert your SD card into your computer
    • Choose your SD card/card reader as device
    • Choose DD Image for Create a Bootable Disk Image
    • Now click on the file selection button and select the image file.
    • Press the start button to make your SD card runnable. This will take several minutes.

When the program is done you can insert the SD card into your Raspberry Pi. fyrelab sentri will then start automatically.

Installation for Linux

To make your SD card runnable using Linux you need to enter a few commands to the terminal. Insert your USB card reader with your SD card and open a terminal.

  1. Enter the command

    lsblk

    if the command lsblk does not work you need to install the util-linux package.

    The output should look similar to this:

    NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
    sda      8:0    0 465,8G  0 disk
    ├─sda1   8:1    0   255M  0 part /boot
    ├─sda2   8:2    0 461,7G  0 part /
    ├─sda3   8:3    0     1K  0 part
    └─sda5   8:5    0   3,8G  0 part [SWAP]
    sdb      8:16   1  29,8G  0 disk
    └─sdb1   8:17   1  29,8G  0 part /run/media/user/USB
  2. To copy the image to the SD card use following command and replace XXX with the target device:

    dd if=/path/to/sentri.img of=/dev/XXX

The image is now on your SD card. If you insert it into the Raspberry Pi fyrelab sentri will start automatically.

advanced installation (for ARM)

Installation of ARM Arch on the SD card

Replace XXX in the following instructions with the device name for the SD card as it appears on your computer.

  1. Start fdisk to partition the SD card and replace XXX with the target device.

    (You can check your target device by searching for your SD card with lsblk)

    fdisk /dev/XXX

  2. At the fdisk prompt, delete old partitions and create a new one.
    • Type o. This will clear out any partitions on the drive.
    • Type p to list partitions. There should be no partitions left.
    • Type n, then p for primary, 1 for the first partition on the drive, press ENTER to accept default first sector, then type +100M for the last sector.
    • Type t, then c to set the first partition to type W95 FAT32 (LBA).
    • Type n, then p for primary, 2 for the second partition on the drive, and then press ENTER twice to accept the default first and last sector.
    • Write the partition table and exit by writing w.
  3. Create and mount the FAT filesystem:

    mkfs.vfat /dev/XXX1

    mkdir boot

    mount /dev/XXX1 boot

  4. Create and mount the ext4 filesystem:

    mkfs.ext4 /dev/XXX2

    mkdir root

    mount /dev/XXX2/root

  5. Download and extract the root filesystem (as root, not via sudo):

    wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz

    bsdtar -xpf ArchLinuxARM-rpi-2-latest.tar.gz -C root

    sync

  6. Move boot files to the first partition:

    mv root/boot/* boot

  7. Unmount the two partitions

    umount boot root

  8. Insert the SD card into the Raspberry Pi, connect ethernet and apply 5V power.
  9. Use the serial console or SSH to the IP address to the board by router
    • Login as the default user alarm with the password alarm.
    • The default root password is root.
    We highly recommend you to change the user and root password.

Installation of basic programs and libraries

To run fyrelab sentri we need a few basic programs and libraries.

  1. Switch the user to root

    su

  2. Rebuild your local database and update it

    pacman -Syy

  3. Update all installed packages and you database

    pacman -Syu

  4. Install sudo

    pacman -S sudo

  5. It is necessary to edit the sudoers file. To edit the sudoers file enter vi /etc/sudoers. You can change to the insert mode pressing i and save the file with ESC, :wq, ENTER.

    Uncomment the following line by removing the "%" at the start of the line to allow members of the group wheel to execute any command
    %wheel ALL=(ALL) ALL

  6. Exit root user

    exit

  7. Install base-devel, git, python and python2:

    sudo pacman -S base-devel git python python2

  8. Install dependencies

    sudo pacman -S networkmanager curl boost boost-libs ffmpeg npm pulseaudio-alsa alsa-utils linux-raspberrypi-headers pkg-config opencv nodejs

  9. If you want a desktop environment you can install X-Org and LXDE (this step is optional):

    sudo pacman -S xf86-video-fbdev lcde corg-cinit dbus

  10. Now we need to install portaudio. We need to download it from the official website to install it. Follow the following commands

    curl -O http://www.portaudio.com/archives/pa_stable_v19_20140130.tgz

    tar -xf pa_stable_v19_20140130.tgz

    rm pa_stable_v19_20140130.tgz

    cd portaudio

    ./configure --without-jack --prefix=/usr

    make -j6

    make install

  11. We will now stop and disable the netctl tool by using the following commands

    systemctl stop netctl

    systemctl disable netctl

  12. And set our local time zone

    (You can list all available time zones by entering ls -R /usr/share/zoneinfo/ and replace Europe/Berlin with your time zone)

    ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime

  13. Now we will create a swap file of 1 Gigabyte size and make it read and write only for the owner (root)

    fallocate -l 1G /swapfile

    chmod 600 /swapfile

    mkswap /swapfile

    swapon /swapfile

    echo "/swapfile none swap defaults 0 0" >> /etc/fstab

  14. Now we will write necessary configuration data into a configuration file to overclock the raspberry.

    Note: Make sure to properly cool your Raspberry Pi, e.g. with an additional passive cooling unit.

    We will build the file by the following command

    cat << EOF > /boot/config.txt
    gpu_mem=128
    start_file=start_x.elf
    fixup_file=fixup_x.dat
    arm_freq=1000
    sdram_freq=500
    core_freq=500
    over_voltage=2
    dtoverlay=w1-gpio,gpiopin=4,pullup=on
    EOF

  15. Now we will write the configuration file for our temperature sensor

    cat << EOF > /etc/modules-load.d/tmp-sensor.conf
    w1-gpio
    w1-therm
    EOF

  16. We will use logintctl to enable user lingering for the user "alarm". A user manager will be spawned at boot and kept around after logouts. This allows users who are not logged in to run long-running services.

    loginctl enable-linger alarm

  17. Now we will add our camera to the camera device list

    echo bcm2835-v4l2 > /etc/modules-load.d/rpi-camera.conf

  18. We will add the user alarm to the groups video and audio by entering the following commands into the command line

    usermod -a -G audio alarm

  19. We will configure a few more services to start at boot

    systemctl --user enable pulseaudio.service

    systemctl enable NetworkManager.service

    systemctl enable iptables

  20. Configure the firewall for the linux kernel

    iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 3000

    iptables-save > /etc/iptables/iptables.rules

Now we have all necessary programs and libraries we need to run fyrelab sentri.

Clone the git repository and install fyrelab sentri

To clone the program use the following command

git clone https://github.com/fyrelab/sentri

To install the program on the Raspberry Pi enter:

cd sentri

./configure

make -j4

make install

After installing the program you are able to configure fyrelab sentri via webtool.