domenica 14 maggio 2017

SmartHome con Raspberry PI 3

A quasi 5 anni dal giugno 2012, quando ho comprato la mia prima Raspberry PI, eccomi nuovamente a testare, in ambito domestico e scolastico, il piccolo minicomputer rinnovato e potenziato nella versione 3.
L'obiettivo è quello testare le esercitazioni che verranno poi proposte agli studenti. Userò poi la RaspberryPI 3 contemporaneamente come un media center collegato alla tv, un server fornitore di servizi vari, una console per giochi, controller per una rete domotica e altro ancora.

 


Appunti sulle operazioni eseguite durante la configurazione
- Download dell'ultima immagine Raspbian Jessie (10/04/2017)
- Scrittura dell'immagine scaricata su una sdcard classe 10 con il software portable Etcher

# Avvio di PIXEL 
Configurazione della password wifi
Disabilitazione dell'avvio automatico del desktop (menu->preferences->Raspberry PI Configuration)

# Avvio di raspi-config dalla console di PIXEL
sudo raspi-config
# 2 Hostname -> SmartHome
# 2 Boot options -> B1,B2 -> console autologin
# 4 Localization ... -> I1,I2
# 5 Interface options -> P1 Camera -> yes
#                 -> P2 SSH -> yes
#                 -> P3 VNC -> yes
#                 -> P6 Serial-> yes
#                 -> P8 Remote GPIO -> yes
# 7 Advanced ...  -> 1 Expand Filesystems

# Accesso remoto
- Configurazione di MobaXterm portable per la connessione remota alla RaspberryPI

#Aggiornamento del S.O. 
sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt-get dist-upgrade
sudo apt-get autoremove
sudo reboot
uname -a
# Linux raspberrypi 4.4.50-v7+ #970 SMP Mon Feb 20 19:18:29 GMT 2017 armv7l GNU/Linux

# Cambio delle password e aggiunta account personale
sudo passwd pi
sudo passwd root
adduser <newaccount>
sudo visudo

#Installazione di OpenCV

# Abilitazione momentanea (Attenzione!!!!) del login di root su ssh
sudo nano /etc/ssh/sshd_config
#PermitRootLogin without-password
PermitRootLogin yes

sudo apt-get install kodi

# Montaggio automatico dell'hd esterno ed esecuzione di Kodi all'avvio del sistema
#Attenzione! Non funziona se si avvia PIXEL, perchè il disco viene montato automaticamente su /media/pi
#andrebbe quindi prima smontato $umount /media/pi/<disco>
chmod +x Raspberry-PI-scripts/SmartHome/mount_hd.sh
chmod +x Raspberry-PI-scripts/SmartHome/launch_kodi.sh
sudo echo " " >> .bashrc
sudo echo "###########################" >> .bashrc
sudo echo "sudo Raspberry-PI-scripts/SmartHome/mount_hd.sh" >> .bashrc
sudo echo "sudo Raspberry-PI-scripts/SmartHome/launch_kodi.sh" >> .bashrc
bugfix: sostituire 3 nel controllo processi in esecuzione

# Installazione di samba
# installazione del supporto al filesystem ntfs
sudo apt-get install ntfs-3g
sudo apt-get install samba
# Copia del file di configurazione
sudo cp smb.conf smb.conf.original
# Modifica del file di configurazione
sudo nano /etc/samba/smb.conf
# aggiunta delle seguenti righe [global] è già presente
[global]
workgroup = galassia
netbios name = SmartHome
[family_hd]
   comment = familyhd
   directory mask = 0777
   force group = root
   force user = root
   create mask = 0777
   path = /media/MYHD
   browseable = yes
   read only = no
   guest ok = yes
   nt acl support = yes
   inherit acls = yes
   map archive = no
   map hidden = no
# Riavvio del servizio
sudo /etc/init.d/samba restart
# link

--------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------
Da testare nei prossimi giorni
--------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------

# installazione di RetroPie
git clone git://github.com/petrockblog/RetroPie-Setup.git
sudo ./retropie_setup.sh
#per avviare la console dei giochi
emulationstation

#installazione della libreria "C library for Broadcom BCM 2835 as used in Raspberry Pi"
wget http://www.open.com.au/mikem/bcm2835/bcm2835-1.49.tar.gz
tar zxvf bcm2835-1.49.tar.gz
cd bcm2835-1.49
./configure
make
sudo make check
sudo make install
git clone https://github.com/filippo-bilardo/C_Raspi_Projects.git
#link
http://codeandlife.com/2012/07/03/benchmarking-raspberry-pi-gpio-speed/
http://www.airspayce.com/mikem/bcm2835/index.html
http://wiringpi.com/

# DNS dinamico
registrazione host su noip.com
download noip-2.1.9-1.tar
tar zxvf noip-2.1.9-1.tar
# Abilitazione dei servizi SSH, HTTP, HTTPS sul router
http://www.hwupgrade.it/forum/archive/index.php/t-2583627.html
https://www.noip.com/remote-access
http://www.opengeek.it/linux/configurare-no-ip-su-raspbian-per-raggiungere-il-raspberry-da-remoto/
https://pentest-tools.com/network-vulnerability-scanning/tcp-port-scanner-online-nmap

# Installazione del server Nas OwnCloud
https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=96478
https://www.reddit.com/r/linux/comments/3hyx2x/pydio_vs_seafile_vs_owncloud/
http://www.qoncious.com/questions/pydio-vs-owncloud-comparison-and-review
TODO

default_charset = "UTF-8"
upload_max_filesize = 10G
post_max_size = 10G
upload_tmp_dir = /mnt/usbstorage/owncloud/tmp
max_input_time = 360000
#The maximum time in seconds a script is allowed to parse input data.
max_execution_time = 360000
memory_limit = 512M
extension=memcached.so

extension=memcache.so
sudo mkdir -p /mnt/usbstorage/owncloud/tmp

sudo chown -R www-data /mnt/usbstorage/owncloud/tmp

# Comunicazione tramite uart con la scheda launchpad per il controllo domotico di dispositivi hw
https://volumio.org
- youtube-dl
- installazione webserver
- installazione ip pubbilco
- avvio kodi da webserver
- Comandare hardware esterno tramite il connettore GPio
- Android Transporter
- collegamento di una webcam
- Domotica
- streaming radio
- streaming video

#Change hostname
sudo nano /etc/hosts
#Replace all instances of “raspberrypi” with the new hostname that you entered above.
sudo nano /etc/hostname
#Type the hostname you require, save the file and exit.
sudo /etc/init.d/hostname.sh start

Link utili
http://www.raspberrypi.org/
The MagPi
- http://elinux.org/RPi Philosophy
- http://www.netbooknews.it/video-recensione-raspberry-pi/
- http://raspberrypi.stackexchange.com/
- Raspberry Pi Tracker
- http://mitchtech.net/category/tutorials/raspberry-pi/
- http://elinux.org/R-Pi_Hub
- http://elinux.org/RPi_config_for_your_TV
- http://elinux.org/RPi_Education/Manual
- http://elinux.org/RPi_Documentation

Tools
- MobaXTerm
- Win32DiskImager / Etcher
- http://winscp.net/

Nessun commento:

Posta un commento