How to install ZoneMinder on Raspberry PI 1 or 2 with Raspbian 8.1 (Jessy) 64 bit
Da preparare prima di iniziare:
-SD card created with raspbian Jessie 64bit
-SD card creata con raspbian Jessy 64bit
-filesystem is extended
-file system espanso
-the systems boots in console mode with autologin disabled (X is disabled)
-sistema avviato in modalità testuale con autologin disabilitato (X disabilitato)
Loggarsi come pi:
pi seguito dalla password di root
passare in modalità superuser
sudo su
configurare la rete con IP statico
vi /etc/network/interfaces
modificare in modo simile:
auto eth0 #allow-hotplug eth0 (assicurati che questa riga sia commentata o avrai 2 IP) iface eth0 inet static address 192.168.1.10 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 192.168.1.1
Update Raspbian Sources
Aggiorna i sorgenti di Raspbian
apt-get update
Check to be sure everything is up to date for the raspbian distribution
assicurati che tutto sia aggiornato per la distribuzione Raspbian
apt-get upgrade apt-get dist-upgrade
Add the Debian Jessie backports
Aggiungi i backports di Debian Jessy
vi /etc/apt/sources.list
add to the top of the list:
all'inizio della lista
deb http://http.debian.net/debian jessie-backports main
add priority to this repository
aggiungi la priorità a questo repository
vi /etc/apt/preferences.d/zoneminder
add to the file:
aggiungendo al file:
Package: * Pin: origin http.debian.net Pin-Priority: 1100
Update Sources
aggiorna i sorgenti
apt-get update
you will get a GPG error message like this:
avrai un messaggio di errore simile a questo:
W: GPG error: http://http.debian.net jessie-backports InRelease: The following signatures couldn't be verified because the public key is not available:
Fix this as following:
risolvi nel modo seguente:
gpg --keyserver pgpkeys.mit.edu --recv-key 8B48AD6246925553 gpg -a --export 8B48AD6246925553 | sudo apt-key add - gpg --keyserver pgpkeys.mit.edu --recv-key 7638D0442B90D010 gpg -a --export 7638D0442B90D010 | sudo apt-key add -
Update Sources again (now should go fine)
Aggiorna nuovamente i sorgenti (stavolta dovrebbe andare tutto bene)
apt-get update
Check to be sure everything is up to date for the raspbian distribution
Controlla per essere sicuro che tutto è aggiornato per la distribuzione raspbian
apt-get upgrade apt-get dist-upgrade
Install PHP, and MySQL server (This installs MySQL server 5.5. If you want to use MySQL 5.6 follow the instructions Install MySQL 5.6 on Debian Jessie (using mariadb also works fine, as tested on Debian 8.2, replacement package for mysql-server is then mariadb-server)
apt-get install php5 mysql-server php-pear php5-mysql
Install Zoneminder
apt-get install zoneminder
You may need to install “extra” VLC components (I will check this and edit as needed)
apt-get install libvlc-dev libvlccore-dev vlc
Create Zoneminder database in MySQL (Note: this also creates the default Zoneminder user and permissions in MySQL)
Crea il database per zoneminder in MYSQL (nota:questo crea anche l'utente di default e i permessi in MySQL)
This next step creates a file which contained the MySQL user and password. Otherwise you will have to enter the user and password on the command line which is not secure!
Il prossimo passaggio crea un file che contiene l'utente e la password per MySQL. Diversamente dovrai aggiungere l'utente e la password tramite riga di comando che non è sicuro.
Go to the root directory
vai alla directory di root
cd -
Create a hidden password file
crea un file di password nascosto
vi .my.cnf
Enter this content (but use your MySQL root password!)
Inserisci questo contenuto (ma usa la tua password di root per MySQL)
[client] user=root password=(mysqlpass)
Create database (press ENTER after each command)
Crea il database (premi ENTER dopo ogni comando)
mysql < /usr/share/zoneminder/db/zm_create.sql
crea l'utente zm con i relativi diritti sul database
mysql -e "grant select,insert,update,delete,create on zm.* to 'zmuser'@localhost identified by 'zmpass';"
Remove password file
Rimuovi il file delle password
rm .zm.cnf
Set permissions of /etc/zm/zm.conf to root:www-data 740
Imposta i permessi del file /etc/zm/zm.conf a root:www-data 740
chmod 740 /etc/zm/zm.conf chown root:www-data /etc/zm/zm.conf
Enable Zoneminder service to start at boot
Abilita il servizio Zoneminder che si avvii al boot
systemctl enable zoneminder.service
Add www-data to the sudo group (to enable use of local video devices)
Aggiungi l'utente www-data (apache) al gruppo sudo (per abilitare l'uso del dispositivo video locale)
adduser www-data video
Start Zoneminder
Avvia Zoneminder
systemctl start zoneminder.service
Check to see that Zoneminder is running
Controlla che Zoneminder stia funzionando
systemctl status zoneminder.service
Enable CGI and Zoneminder configuration in Apache.
Abilita la configurazione CGI e Zoneminder in Apache
a2enmod cgi a2enconf zoneminder
Restart Apache
riavvia apache
service apache2 restart
You may be tempted to try Zoneminder at this point but there is one setting you will need to change from the web gui. Read on!!! Optional: Install Cambozola (needed if you use Internet Explorer)
Sarai tentato di provare ZOneminder a questo punto ma c'è ancora un settaggio che dovrai effettuare tramite l'interfaccia WEB. Leggi!! Opzionale: Installa Cambozola (necessario se usi Internet Explorer)
cd /usr/src && wget http://www.andywilcock.com/code/cambozola/cambozola-latest.tar.gz tar -xzvf cambozola-latest.tar.gz
replace 936 with cambozola version downloaded
sostituisci la 936 con quella scaricata
cp cambozola-0.936/dist/cambozola.jar /usr/share/zoneminder
Kernel shared memory settings:
Set shared memory for 512MB RPi board: 1) 128MB shhmax shared:
Settaggio per la memoria condivisa del LKernel;
Imposta la memoria condivisa per la scheda RPia 512 MB:
1) 128MB shhmax shared:
sudo su - echo "kernel.shmmax = 134217728" >> /etc/sysctl.conf exit
2) 2MB shmall pages:
sudo su - echo "kernel.shmall = 2097152" >> /etc/sysctl.conf exit
You should now be able to access the web server using http://servername
Open Zoneminder in web browser
Dovresti ora poter accedere al server web usando http://nomeserver
Apri Zoneminder nel browser web
http://serverip/zm
Click Options
Uncheck: Check with zoneminder.com for updated versions (?) click Save
Click Images tab
Check Is the (optional) cambozola java streaming client installed (?) Click Save
Click Paths
Change PATH_ZMS from /cgi-bin/nph-zms to /zm/cgi-bin/nph-zms Click Save
Optional: under Paths change PATH_SWAP to /dev/shm (puts this process in RAM drive) Click Save
Restart Zoneminder
Your Zoneminder install is now ready to add cameras!
- - - -
Allora, rivediamo il tutto specificando che il problema sta nei diritti di accesso all directory cgi-bin che di default non è accessibile non so bene per chi: apache o zoneminder. sarà da appurare. pertanto alla soluzione sono arrivato in seguito ai seguenti comandi:
usermod -aG video www-data
chown -R root:www-data /var/cache/zoneminder/*
find /var/cache/zoneminder/ -type d -exec chmod 775 {} +
chown -R root:www-data /usr/share/zoneminder/*
poi modificare il file /etc/apache2/sites-enabled/zm.conf da:
Alias /zm /usr/share/zoneminder
<Directory /usr/share/zoneminder>
php_flag register_globals off
Options Indexes FollowSymLinks
<IfModule mod_dir.c>
DirectoryIndex index.php
</IfModule>
</Directory>
a
Alias /zm /usr/share/zoneminder
ScriptAlias /cgi-bin /usr/share/zoneminder/cgi-bin
<Directory /usr/share/zoneminder>
php_flag register_globals off
Options Indexes FollowSymLinks
<IfModule mod_dir.c>
DirectoryIndex index.php
</IfModule>
</Directory>