Skip to content

Install

Paul Cowan edited this page Dec 14, 2013 · 35 revisions

KegNet Install Instructions

This will change once we have a make/make install script.

** Based on Arch Linux ARM (archlinux-hf-2013-11-14) **

http://archlinuxarm.org/platforms/armv6/raspberry-pi

This will not work on Raspbian or any distro other than Arch Linux!

#!sh

# set the hostname
hostnamectl set-hostname kegnet

# change the root password (TODO: set different password for each install)
passwd

# initialize pacman and update the system
#pacman-key --init
# key init takes a long time and seems to be unecessary
pacman -Syu

# there's no real need to adjust the timezone or locale, the KegNet server will 
# present the data appropriately

# install the following packages
pacman -S python2 python2-pip sudo gcc make automake glib2 pkg-config swig git iw wireless_tools syslog-ng sysstat apache php php-apache

# enable syslog
systemctl enable syslog-ng
systemctl start syslog-ng

# setup Apache and PHP
echo "LoadModule php5_module modules/libphp5.so" >> /etc/httpd/conf/httpd.conf
echo "Include conf/extra/php5_module.conf" >> /etc/httpd/conf/httpd.conf
echo "application/x-httpd-php php php5" >> /etc/httpd/conf/mime.types
rmdir /srv/http
ln -s /usr/share/kegnet-client/http /srv/http

# setup sudo access
echo "http ALL=(root) NOPASSWD: /usr/bin/ip" >> /etc/sudoers
echo "http ALL=(root) NOPASSWD: /usr/bin/iwlist" >> /etc/sudoers
echo "http ALL=(root) NOPASSWD: /usr/share/kegnet-client/scripts/wificonfig" >> /etc/sudoers

# enable apache
systemctl enable httpd

# setup wifi
systemctl disable dhcpcd@eth0
systemctl enable dhcpcd
systemctl enable wpa_supplicant

vi /etc/systemd/system/multi-user.target.wants/wpa_supplicant.service
# edit the ExecStart line to this:
ExecStart=/usr/bin/wpa_supplicant -u -D wext -i wlan0 -c /etc/wpa_supplicant.conf -d

# make sure time get synched (no clock on a RasPi!)
vi /usr/lib/dhcpcd/dhcpcd-hooks/40-ntpd
# paste in the following between the ---
---
# Set time

set_time()
{
 	/usr/bin/ntpd -gq
}

if $if_up; then
 	set_time
fi
---

vi /etc/cron.daily/ntpd
# paste in the following between the ---
---
#!/bin/sh
/usr/bin/ntpd -gq
---

# configure the kernel modules for the w1 temperature sensor
echo 'w1-gpio' >> /etc/modules-load.d/w1-therm.conf
echo 'w1_therm' >> /etc/modules-load.d/w1-therm.conf

# install the following python libraries
pip2 install M2Crypto requests pyinotify

# download and build WiringPi
git clone git://git.drogon.net/wiringPi /usr/src/wiringPi
cd /usr/src/wiringPi
./build

# download and build the KegNet client
git clone https://github.com/kegnet/kegnet-client.git /usr/share/kegnet-client
cd /usr/share/kegnet-client
./make-pourd

# install kegnet-client service to startup on boot
ln -s /usr/share/kegnet-client/service/kegnet-client.service /etc/systemd/system/multi-user.target.wants/

# install pourd service to startup on boot - this creates a daemon for pins 0 and 3, although they will
# only startup if a config file for the pin exists in /usr/local/share/kegnet/conf
ln -s /usr/share/kegnet-client/service/pourd\@.service /etc/systemd/system/multi-user.target.wants/pourd@0.service
ln -s /usr/share/kegnet-client/service/pourd\@.service /etc/systemd/system/multi-user.target.wants/pourd@3.service

# configure kegnet-client
vi /usr/share/kegnet-client/conf/client.conf
uuid=<device uuid>

vi /usr/share/kegnet-client/conf/privkey.pem
<paste in device private key>

# finished, reboot, KegNet client should startup
reboot

#
# green indicator light on the daughter board should turn on after reboot, indicating successful connection to KegNet server
#
Clone this wiki locally