tisdag 15 augusti 2017

Install Apache, MySQL & PHP (LAMP) on Raspberry Pi

#Install apache
sudo apt-get install -y apache2

#Install mysql-server (replace with mariadb-server?)
sudo apt-get install -y mysql-server


 
#Install PHP
sudo apt-get install -y php5 php5-cli php5-mysql
sudo apt-get install  -f php-pear
#-f forces late version, fixes dependency problem with Net_SMTP

sudo pear install Mail
sudo pear install Net_SMTP

Prepare new Raspberry Pi

#Burn latest Raspbian Light with Etcher

#Create file with name "ssh" in boot partition

##http://downloads.raspberrypi.org/raspbian/release_notes.txt

#Boot and sign in with pi:raspberry


sudo nano /etc/fstab

#Add following lines:
tmpfs    /tmp    tmpfs    defaults,noatime,nosuid,size=100m    0 0
tmpfs    /var/tmp    tmpfs    defaults,noatime,nosuid,size=30m    0 0
tmpfs    /var/log    tmpfs    defaults,noatime,nosuid,mode=0755,size=100m    0 0
tmpfs    /var/run    tmpfs    defaults,noatime,nosuid,mode=0755,size=2m    0 0
tmpfs    /var/spool/mqueue    tmpfs    defaults,noatime,nosuid,mode=0700,gid=12,size=30m    0 0
##http://www.zdnet.com/article/raspberry-pi-extending-the-life-of-the-sd-card/
tmpfs    /var/log/apache2 tmpfs defaults,noatime,nosuid,mode=0755,size=50m 0 0
tmpfs    /var/log/mosquitto    tmpfs    defaults,noatime,nosuid,mode=0777,size=100m    0 0




sudo raspi-config
#1 - Change password
#2 - Hostname
#4 - Localization (x3)
#7 - Advanced - Expand filesystem

sudo nano /etc/dhcpcd.conf

interface eth0
static ip_address=192.168.1.2/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1


sudo reboot

#Log in again


sudo apt-get update && sudo apt-get upgrade -y





#https://www.raspberrypi.org/learning/networking-lessons/rpi-static-ip-address/

torsdag 16 februari 2017

Influxdb

#***************************************************
#**********            INSTALL            **********
#***************************************************
#Default repo contains old InfuxDB!!


#Upgrade your system
sudo apt-get update && sudo apt-get -y upgrade


#Download key
curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -

#Add repository
echo "deb https://repos.influxdata.com/debian stretch stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

#Install
sudo apt-get update
sudo apt-get install influxdb
sudo apt-get install chronograf

#Manually edit config file

sudo nano /etc/influxdb/influxdb.conf

[meta]
  dir = "/usbdisc/influxdb/meta"

[data]
  dir = "/usbdisc/influxdb/data"

[http]
  enabled = true

#Start service
sudo service influxd start

#Create admin user
sudo influx
>CREATE USER <username> WITH PASSWORD '<password>' WITH ALL PRIVILEGES
>exit

#Restart service
sudo service influxd restart


#***************************************************
#**********     Sample Reverse Proxy      **********
#***************************************************

<VirtualHost *:443>
        ServerName influxdb.mydomain.com

        ProxyPreserveHost On
        ProxyRequests Off

        ProxyPass / http://192.168.1.92:8086/
        ProxyPassReverse / http://192.168.1.92:8086/

        SSLEngine on
        SSLCertificateFile /etc/letsencrypt/live/influxdb.mydomain.com/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/influxdb.mydomain.com/privkey.pem
</VirtualHost>

#***************************************************
#**********            Misc               **********
#***************************************************
#Start
sudo service influxdb start

#Service port
http://[SERVER_IP]:8086

#Config file
/etc/influxdb/influxdb.conf


#Uninstall
sudo apt-get remove --purge influxdb
#http://www.automatiserar.se/guide-raspberry-pi/#InstallationInflux
#https://www.influxdata.com/blog/running-the-tick-stack-on-a-raspberry-pi/

fredag 27 januari 2017

Z-Wave Devices



1 - Razberry
http://razberry.z-wave.me/

2 - Fibaro Wall Plug -  FGWPE/F-102
http://manuals.fibaro.com/wall-plug/
Alias: FibaroPlug


3 - Fibaro Double Relay Switch - FGS-222
http://manuals.fibaro.com/double-relay-switch/
Alias: LaundryAndOutdoorLightsSwitch



4 Fibaro Smoke Sensor - FGSD-002
http://manuals.fibaro.com/smoke-sensor/
Alias: KithenFireAlarm