Skip to content

Running on Raspberry Pi

Christian edited this page Dec 9, 2018 · 6 revisions

Wirehome.Core is able to run on a Raspberry Pi. At least a Raspberry Pi 2 Model B+ is required. A Raspberry Pi 3 Model B+ is recommended.

The following 3rd-Party applications are required to use all features of Wirehome:

  1. .NET Core 2.1 (including ASP.NET 2.1 workload)
  2. screen
  3. MariaDB (optional for History)

Autostart on Raspberry Pi (Raspbian)

To ensure that Wirehome.Core will start after the device has rebooted the following line must be added to the file /etc/rc.local.

/opt/wirehome/rund.sh

The script will start a new screen session with ID main and starts Wirehome.Core inside the screen session. It is possible to attach to the exising session via SSH (sudo screen -R).

Setup script

The following script contains all steps which are required to setup Raspbian for running Wirehome.Core.

# Install tool 'screen'.
sudo apt-get -y install screen

# Install MariaDB for Wirehome.History etc.
sudo apt-get -y install mariadb-server

# Configure MariaDB.
sudo mysql -e 'CREATE DATABASE WirehomeHistory'
sudo mysql -e 'CREATE USER "wirehome" IDENTIFIED BY "w1r3h0m3"'
sudo mysql -e 'GRANT ALL PRIVILEGES ON WirehomeHistory.* TO "wirehome"'

# Install SMB for file upload and editing.
sudo apt-get -y install samba

# Configure default Wirehome directories for SMB.
echo "" | sudo tee -a /etc/samba/smb.conf
echo "[wirehome-bin]" | sudo tee -a /etc/samba/smb.conf
echo "comment = Wirehome.Core binaries" | sudo tee -a /etc/samba/smb.conf
echo "path = /opt/wirehome" | sudo tee -a /etc/samba/smb.conf
echo "browsable = yes" | sudo tee -a /etc/samba/smb.conf
echo "writable = yes" | sudo tee -a /etc/samba/smb.conf
echo "create mask = 0777" | sudo tee -a /etc/samba/smb.conf
echo "directory mask = 0777" | sudo tee -a /etc/samba/smb.conf
echo "public = yes" | sudo tee -a /etc/samba/smb.conf
echo "guest ok = yes" | sudo tee -a /etc/samba/smb.conf
echo "force user = root" | sudo tee -a /etc/samba/smb.conf
echo "" | sudo tee -a /etc/samba/smb.conf
echo "[wirehome-data]" | sudo tee -a /etc/samba/smb.conf
echo "comment = Wirehome.Core data" | sudo tee -a /etc/samba/smb.conf
echo "path = /etc/wirehome" | sudo tee -a /etc/samba/smb.conf
echo "browsable = yes" | sudo tee -a /etc/samba/smb.conf
echo "writable = yes" | sudo tee -a /etc/samba/smb.conf
echo "create mask = 0777" | sudo tee -a /etc/samba/smb.conf
echo "directory mask = 0777" | sudo tee -a /etc/samba/smb.conf
echo "public = yes" | sudo tee -a /etc/samba/smb.conf
echo "guest ok = yes" | sudo tee -a /etc/samba/smb.conf
echo "force user = root" | sudo tee -a /etc/samba/smb.conf

# Install dependencies for .NET.
sudo apt-get -y install libunwind8 gettext

# Download .NET files.
wget -O runtime.tar.gz https://download.visualstudio.microsoft.com/download/pr/a3f3e38e-246a-4eab-8da3-63f9cd1b1c13/c2e795a9bb03bc75d3cfa767f3f77310/dotnet-runtime-2.2.0-linux-arm.tar.gz
wget -O asp.net.tar.gz https://download.visualstudio.microsoft.com/download/pr/860e937d-aa99-4047-b957-63b4cba047de/da5ed8a5e7c1ac3b4f3d59469789adac/aspnetcore-runtime-2.2.0-linux-arm.tar.gz

# Extract .NET files.
sudo rm -rf /opt/dotnet
sudo mkdir /opt/dotnet
sudo tar -xvf runtime.tar.gz -C /opt/dotnet/
sudo tar -xvf asp.net.tar.gz -C /opt/dotnet/

# Create symbolic link for .NET.
sudo ln -s /opt/dotnet/dotnet /usr/local/bin

# Create Wirehome directories.
sudo mkdir /opt/wirehome
sudo mkdir /etc/wirehome

# Register Wirehome.Core daemon for autostart.
sudo sed -i "20i # Start Wirehome.Core daemon" /etc/rc.local
sudo sed -i "21i /opt/wirehome/rund.sh" /etc/rc.local

# Set the hostname of the Pi to 'wirehome'
echo "wirehome" | sudo tee /etc/hostname

# Set IP of the Pi matching to LAN (if required).
sudo nano /etc/network/interfaces
# auto eth0
# allow-hotplug eth0
# iface eth0 inet static
# address 192.168.1.2
# netmask 255.255.255.0
# gateway 192.168.1.1
# dns-nameservers 192.168.1.1

# Restart the Pi
sudo shutdown -r now

Clone this wiki locally