Ubuntu 9.04 (Jaunty) desktop with graphical interface

From ZoneMinder Wiki

Jump to: navigation, search

This guide is intended for users of Ubuntu desktop installations. No previous knowledge of configuring Ubuntu is assumed. If you have any questions, please ask them on this tutorial's forum thread. Likewise, if you manage to successfully follow the tutorial, it would be really good to hear how it went on the same forum thread!



  • Desktop installation of Ubuntu 9.04 (Jaunty)
  • Internet connection
  • Video capture card and camera

Install the "zoneminder" package

  • Go to System > Administration > Synaptic.
  • Search for "zoneminder", click the package name and mark it for installation.
  • Press "Apply" to install the package. You will be asked if you want to "Mark additional required changes?"; press "Mark" to agree that you want to install other packages that ZoneMinder depends on.
  • MySQL is the database system in which ZoneMinder stores its settings. If you haven't previously installed MySQL you will be asked to define a new MySQL root user password. Do not make this password the same as your Ubuntu user password as this could potentially commpromise your computer's security. You won't need to enter this password from day-to-day so you don't need it to be easy to remember. A good password would be about ten characters long and include a mix of uppercase and lowercase letters and numbers. Make a note of the password in case you need it in the future.
  • You will be asked for a "mail name" and "smart hosts". You can leave them both on the defaults. These settings are needed if you want ZoneMinder to be able to send out notification emails, and can be easily changed at a later time if you decided to enable that feature.
  • Once the new packages have been installed, close Synaptic.

Zm ubuntu graphical 01 synaptic.png

Start gedit as root

Several of the following steps require files to be created and edited in the "/etc" directory, where most configuration files are found. In order to be able to save in the "/etc" directory the text editor needs to be running as the root user. You can't start gedit by going to Applications > Accessories > Text editor, because it would be running as your normal user name, not as root. Instead do the following:

  • Press Alt-F2 to bring up the "Run Application" window.
  • Type "gksudo gedit" and click "Run" (gksudo is the graphical version of sudo).

Zm ubuntu graphical 02 gedit.png

Define the web address of the ZoneMinder interface

By default the ZoneMinder web interface is accessible at http://localhost/zm from the computer it is installed on, or from another computer on your network (where is replaced by the IP address of the computer on which ZoneMinder is installed). If you are not using the ZoneMinder computer as a web server for anything else, you'll probably not want to have to put the "/zm" at the end of the address. To do this you can define ZoneMinder as the main Apache Site:

  • Start gedit as root, as shown above.
  • Open the file "/etc/apache2/sites-enabled/000-default".
  • Find the line:
DocumentRoot /var/www

and change it to read

DocumentRoot /usr/share/zoneminder
  • Similarly change the line:
<Directory /var/www/>

to read

<Directory /usr/share/zoneminder/>
  • Reboot the computer. The ZoneMinder web interface will now be available at http://localhost and, where is the IP address of your ZoneMinder computer.

Zm ubuntu graphical 03 apache sites.png

Set up a username and password

  • Start a web browser and go to http://localhost to see the main ZoneMinder window.
  • You probably don't want other people on your network to be able to access ZoneMinder, so now is a good time to set up a login password. Click "Options" near the top right of the window and you will see the page below:

Zm ubuntu graphical 07 auth.png

  • Tick the box to "Authenticate user logins to ZoneMinder".
  • Accept the default of "built in" authentication, because you aren't using a separate password server.
  • Accept the default of "hashed" information relaying, which will encrypt your password when it is sent accross the network.
  • Enter a random string of characters in the "hash secret" box. A good sercret key would be about ten characters long and include a mix of uppercase and lowercase letters and numbers. There is no need to make a note of it, as you won't need it again. Ensuring you have your own unique secret hash key will make the hashed information relaying much more secure.
  • Save and close the "Options" window.
  • Restart ZoneMinder by clicking "Running" on the top line of the main screen; choose "Restart" from the drop-down.
  • Log in as username "admin" with password "admin"
  • Go to the "Options" screen again, where you will now see a new "Users" tab on the right. Click the tab then click "admin" where you can change the password to something a bit more difficult to guess!
  • If you decide to change the username as well, it is important to log out and then back in with the new username. Do this by clicking "admin" where it says "Logged in as admin" at the top of the main screen. If you fail to do this after a username change, you may not see a picture in your camera monitor window.

Define a new monitor

ZoneMinder viewing screens are called "monitors". You need to define at least one monitor for each of your cameras.

  • Click "Add new monitor" to bring up the new monitor window:

Zm ubuntu graphical 08 monitor.png

  • Give your camera a name, perhaps "Camera1" or "Front driveway".
  • Accept the default of "Local" source, because the camera is physically connected to your computer.
  • Choose "Monitor" as the function for this monitor. In the future you may want to choose a different option on this list, to enable motion-detected recording and other features.
  • Click the "Source" tab to define which camera will be shown on this monitor. In the "Source" box enter "/dev/video0" (note that the trailing zero isn't there by default) to identify your video capture card. The first input (or only input on a single-input capture card) is channel "0". If you have your camera plugged into a different input on your capture card you will need to change the channel number.
  • Click "Save" and then close the new monitor window.
  • Once the main window has refreshed you will see an entry for your new monitor. If the "Function" and "Source" text is orange then congratulations, it works! Click the name of your camera to view a picture.
  • If the picture is in black and white when it should be colour, or if it has lines across it, or if it's missing completely, you will probably need to change the bttv kernel module settings in the section below and set appropriate permissions for user who running zm processes.
  • If the "Function" and "Source" text is red then there is a problem. It is quite likely that it is a problem with shared memory allocation, so proceed to the shared memory section further down this page.

Zm ubuntu graphical 10 watch.png

Configure the bttv kernel module

The bttv kernel module is the driver for the video capture card. By default it is set to try to autodetect your card. However, if you have picture problems or if the picture is missing completely, it is likely that the autodetect has failed. To manually define a card type the bttv configuration file needs to be created manually in the "/etc/modprobe.d" directory. Modprobe is the program Linux uses to load kernel modules; "/etc/modprobe.d" is where its configuration files are kept.

  • Start gedit as root, as shown above.
  • Paste in the following:
options bttv gbuffers=32 card=77 tuner=4 radio=0 coring=1 full_luma_range=1 chroma_agc=1 combfilter=1 autoload=0 triton1=0 vsfx=0
  • Change "card=77" to the card number of your card. 77 works for the Pico 2000 type four-input cards, but if you have a different card you will need to look at the list of card types and try any that might match your card. There is more information about which cards should be set on which type numbers on the list of supported hardware.
  • Save the file as "/etc/modprobe.d/bttv.conf". The options will be applied next time you reboot. You will need to reboot each time you try a different card type.

Zm ubuntu graphical 04 bttv.png

Setting permissions

All you have to do is put user who running zm processes to group owner of the device file. If zm is running by www-data and group owner of /dev/video0 is video


sudo usermod -aG video www-data 

and zoneminder will always has permissions to use video* device files

Increase shared memory maximum block size

  • If the "Function" and "Source" text of your monitor is red then you should try increasing the shared memory available to ZoneMinder processes. Each monitor runs as a separate system process. To increase the maximum amount of shared memory each process can access, do the following:
  • Start gedit as root, as shown above.
  • Open the file "/etc/sysctl.conf".
  • Paste the following lines at the bottom of the file:
# Increase the shared memory available to ZoneMinder
kernel.shmmax = 167772160

Zm ubuntu graphical 05 shmmax.png

  • Reboot the computer and check to see if the "Function" and "Source" labels are now orange. If they are still red it is worth trying a larger kernel.shmmax value, perhaps half as large again or even twice as large.

Using a controllable camera

If you are using a Pan/Tilt/Zoom camera connected to the serial port you will need to allow ZoneMinder to change the permissions of the serial port, so it can access the port. Zmfix is a utility run each time ZoneMinder is started to accomplish this. However, zmfix itself needs to be run as root for it to be able to change the permissions on the serial port. To make zmfix always run as root:

  • Open a terminal (Applications > Accessories > Terminal).
  • Enter the following command:
sudo chmod 4755 /usr/bin/zmfix
  • If you now list the permissions of zmfix by entering:
ls -l /usr/bin/zmfix

you can see the "s" bit is now set, and the filename is shown with a red background. This indicates that the "setuid" bit is set, and zmfix will now always run as root. Zm ubuntu graphical 06 zmfix.png

  • Restart ZoneMinder to apply the changes. ZoneMinder should now be able to access the serial port.