The Zoneminder system setup using this
link has had a hard disk crash. Not much of the system could be saved. So we chose to rebuild from scratch.
This time we installed a 160GB disk for the system itself and swap, and a seperate 500GB disk for events and backups of the system.
The start of the guide still applies, but we also did the following:
using fdisk created a 6GB for backups and a 482GB partition for events
Formated both as EXT3 and added the following to /etc/fstab:/dev/sda1 /backups ext3 defaults,errors=remount-ro 0 1/dev/sda2 /var/cache/zoneminder/events ext3 defaults,errors=remount-ro 0 1Set correct permissions for the events dir:
sudo chown www-data:www-data /var/cache/zoneminder/events/Added a time sync script:sudo nano /etc/cron.daily/timesyncAnd added:
#!/bin/shntpdate 0.nl.pool.ntp.orgThen:
sudo chmod 755 /etc/cron.daily/timesync Fix Video permissions:chmod 4755 /usr/bin/zmfixAdded a MySQL backup script I also use on our main Linux server:sudo nano /etc/cron.daily/DB_backupAdded:
#!/bin/shmv /backups/MySQL_Backup/Daily6.sql /backups/MySQL_Backup/Daily7.sqlmv /backups/MySQL_Backup/Daily5.sql /backups/MySQL_Backup/Daily6.sqlmv /backups/MySQL_Backup/Daily4.sql /backups/MySQL_Backup/Daily5.sqlmv /backups/MySQL_Backup/Daily3.sql /backups/MySQL_Backup/Daily4.sqlmv /backups/MySQL_Backup/Daily2.sql /backups/MySQL_Backup/Daily3.sqlmv /backups/MySQL_Backup/Daily1.sql /backups/MySQL_Backup/Daily2.sqlmv /backups/MySQL_Backup/Daily.sql /backups/MySQL_Backup/Daily1.sqlmysqldump -r /backups/MySQL_Backup/Daily.sql --all-databasesThen ran:
sudo chmod 755 /etc/cron.daily/DB_backup sudo mkdir /backups/MySQL_BackupSet up main backup system using Rsnapshot:sudo apt-get install rsnapshotsudo nano /etc/rsnapshot.conf (Watch for tabs instead of spaces!!!)
Contents of config file: (used
cat /etc/rsnapshot.conf | grep -v -e ^# to get this output btw)
(ALL SPACES MUST BE TABS!!)
config_version 1.2snapshot_root /backups/cmd_cp /bin/cpcmd_rm /bin/rmcmd_rsync /usr/bin/rsynccmd_ssh /usr/bin/sshcmd_logger /usr/bin/loggercmd_du /usr/bin/ducmd_rsnapshot_diff /usr/bin/rsnapshot-diffinterval hourly 6interval daily 7
interval weekly 4
interval monthly 6
verbose 2loglevel 3logfile /var/log/rsnapshot.loglockfile /var/run/rsnapshot.pidrsync_short_args -arsync_long_args --delete --numeric-ids --relative --delete-excludedexclude /backupsexclude /devexclude /mediaexclude /procexclude /tmpexclude /mntexclude /sysexclude /procexclude /var/cache/zoneminder/eventsbackup / localhost/
Then add this to /etc/crontab:
0 */4 * * * root /usr/bin/rsnapshot hourly
50 23 * * * root /usr/bin/rsnapshot daily
40 23 1,8,15,22 * * root /usr/bin/rsnapshot weekly
30 23 1 * * root /usr/bin/rsnapshot monthly
Installed X and setup autologin and auto script run:
sudo apt-get install gdm
sudo apt-get install xorg
On the machine itself (not SSH) ran:sudo startx
sudo gdmsetup
In gdmsetup I set the user 'zoneminder' as autologin, and set the default session to run the Xclient script.
Create the Xscript:
nano /home/zoneminder/.xsession
And insert:
#!/bin/sh
while ( true )
do
/usr/sbin/xlib_shm-script
sleep 1
done
Then run:
chmod 755 /home/zoneminder/.xsession
Set the correct screen resolution:
sudo apt-get install displayconfig-gtksudo displayconfig-gtkI set this to 800x600, this suits the cameras best
Stop screen blanking by adding this to the /etc/X11/xorg.conf file:
Section "ServerFlags" Option "blank time" "0" Option "standby time" "0" Option "suspend time" "0" Option "off time" "0" EndSection
Create, setup & install the Xlib_shm Zoneminder raw viewing script:
Check the version numbers! not all Xlib_shm version is compatible with each version of Zonderminder!
sudo wget http://dig.hopto.org/xlib_shm/xlib_shm-0.6.3.tgz
sudo tar xfz xlib_shm-0.6.3.tgz
sudo apt-get install libxv-dev
sudo apt-get install build-essentials
sudo apt-get install libmysqlclient15-dev
sudo nano xlib_shm.c And changed /usr/local/etc/zm.conf into /etc/zm/zm.conf
sudo make allPlace the binary xlib_shm in /usr/sbin/
sudo chown root.root /usr/sbin/xlib_shm
sudo chmod +s /usr/sbin/xlib_shm
For the actual auto starting of xlib_shm I first created a new shell script:
sudo nano /usr/sbin/xlib_shm-scriptAnd added this:
#!/bin/sh
xlib_shm -m 1 -m 23 -m 11 -m 12 -k 0x07a6d0000 -d 40000
Then:
sudo chmod 755 /usr/sbin/xlib_shm-script