转自维基百科:http://www.zoneminder.com/wiki/index.php/Ubuntu_10.04_%28Lucid_Lynx%29_Desktop

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.

  1. open a terminal window (Applications > Accessories > Terminal)
  2. sudo apt-get install zoneminder
  3. sudo apt-get install libjson-any-perl
  4. sudo ln -s /etc/zm/apache.conf /etc/apache2/conf.d/zoneminder.conf
  5. sudo /etc/init.d/apache2 force-reload (restarts Apache)
  6. sudo mysql -u root -p < /usr/share/zoneminder/db/zm_create.sql
  7. mysql -u root -p (this brings you into a mysql shell)
  8. grant select,insert,update,delete on zm.* to 'zmuser'@localhost identified by 'zmpass';
  9. flush privileges;
  10. quit (this exits the mysql shell)
  11. sudo chmod 4755 /usr/bin/zmfix
  12. zmfix -a
  13. sudo adduser www-data video
  14. sudo gedit /etc/sysctl.conf (this launches gedit)
  15. 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

  1. To increase the shared memory on a live system;
  2. $ echo 134217728 >/proc/sys/kernel/shmall
  3. $ echo 134217728 >/proc/sys/kernel/shmmax
  4. save the file (File > Save or CTRL+S)
  5. 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

  1. open a terminal window (Applications > Accessories > Terminal)
  2. sudo apt-get install openssh-server openssh-client
  3. 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.