Prerequisites
You should have a vanilla install of Ubuntu 32- or 64-bit up and running. Run updates before proceeding (System > Administration > Update Manager).
Do
not install XAMPP, LAMPP, Apache, MySQL, etc. I thought I was going to be smart and bypass a bunch of installation steps by doing this, but it's just not necessary. If you do have LAMPP on your system and you still plan to use it, you better
go read some docs on how to get it to start on another port, because the ZM installation is going to overtake all the default ports. If you have LAMPP and anything is running, stop all the services now with
sudo /opt/lampp/lampp stop
If you have existing Apache or MySQL running, you're on your own.
This guide is meant for installing ZM on a dedicated box. Feel free to edit this page to include information on how to integrate zoneminder with a functioning Apache/PHP/MySQL
setup.
Installing Zoneminder
This is dead easy. I'll post a shell script to do this soon. Stuff in
bold means enter it at the command line and then press ENTER.
- open a terminal window (Applications > Accessories > Terminal)
- $ sudo apt-get install zoneminder
- $ sudo apt-get install libjson-any-perl
- $ sudo ln -s /etc/zm/apache.conf /etc/apache2/conf.d/zoneminder.conf
- $ sudo /etc/init.d/apache2 force-reload (restarts Apache)
- $ sudo mysql -u root -p < /usr/share/zoneminder/db/zm_create.sql
- mysql -u root -p (this brings you into a mysql shell)
- > grant select,insert,update,delete on zm.* to 'zmuser'@localhost identified by 'zmpass';
- > flush privileges;
- > quit (this exits the mysql shell)
- $ sudo chmod 4755 /usr/bin/zmfix
- $ zmfix -a
- $ sudo adduser www-data video
- $ sudo gedit /etc/sysctl.conf (this launches gedit)
- scroll to the bottom of the file and paste in the following: (Note: This only takes effect after you execute: 'sysctl -p' or reboot)
kernel.shmall = 134217728
kernel.shmmax = 134217728
- To increase the shared memory on a live system;
- $ echo 134217728 >/proc/sys/kernel/shmall
- $ echo 134217728 >/proc/sys/kernel/shmmax
- save the file (File > Save or CTRL+S)
- exit gedit
Testing
Visit this URL in your browser to check that Zoneminder is running:
http://localhost/zm
Via mobile, access:
http://{IP.ADDRESS.OF.MACHINE}/zm/?skin=mobile You can find
the local IP address of the machine by entering
ifconfig at the terminal and looking for the address printed after 'inet addr:'. It probably starts with 192.168.
Troubleshooting
- if installation of zoneminder failed due to broken dependencies, run sudo apt-get -f install, then start over.
- are you using Ubuntu Server? this was written for Ubuntu Desktop 32- or 64-bit.
- If Zoneminder does not start on boot, it may be trying to start before mySQL is running. To fix:
$ sudo update-rc.d -f zoneminder remove
$ sudo update-rc.d zoneminder defaults 92
Optional Configurations/Features
Enable Remote Shell Access
- open a terminal window (Applications > Accessories > Terminal)
- $ sudo apt-get install openssh-server openssh-client
- $ sudo /etc/init.d/apache2 force-reload (restarts Apache)
注意:如果看不到视频或者现实的是花屏,很可能是你设置的格式不对,我是用的是ZC0301PL摄像头(输出时JPEG格式的),刚开始使用JPEG的是花屏,看不清,后来我改成了YUV420就好了,反正多尝试吧。
Credits
Many steps of this article were copied from the
Ubuntu 9.10 Desktop installation procedure. Credit is hereby
given to those authors for forging the way; in particular,
User:Monotical was
instrumental in writing those instructions.