Ubuntu Server 14.10 64-bit server with Zoneminder to use systemd

From ZoneMinder Wiki
Jump to: navigation, search

This is a how-to for setting up Ubuntu 14.10 server with Zoneminder to use systemd.

Note (25APR15): It has been reported that this procedure will work to get ZM 1.28.1 running on Ubuntu 15.04

By default, init is enabled in Ubuntu 14.10. You may install and run Zoneminder without making any changes to how programs are started. However,

Ubuntu will, in time, move to systemd. So it is a good idea to know how to make Zoneminder work!

1. Install Ubuntu 14.10 server including LAMP Server and OpenSSH Server.

2. Install Zoneminder. You may use either the install procedures for any of the supported versions but we did this with ZM 1.28.0 from the iconnor

PPA. http://www.zoneminder.com/wiki/index.php/Ubuntu_Server_14.04_64-bit_with_Zoneminder_1.28.0_the_easy_way

Note: We will explore installing Zoneminder on a system already running systemd as time permits and post the results in this WIKI.

3. Log into Ubuntu and become root

  sudo su

4. Install additional systemd components

  apt-get install systemd-sysv

5. Re-boot the server. Log back in as root

6. Check that systemd is running

  ps -p 1 -o comm=   should return systemd

7. Create a file called zoneminder.service

  nano /lib/systemd/system/zoneminder.service

Paste or enter the following:

 # ZoneMinder systemd unit file
 # This file is intended to work with all Linux distributions
 [Unit]
 Description=ZoneMinder CCTV recording and security system
 After=network.target mysql.service apache2.service
 Requires=mysql.service apache2.service
 [Service]
 User=www-data
 Type=forking
 ExecStart=/usr/bin/zmpkg.pl start
 ExecReload=/usr/bin/zmpkg.pl restart
 ExecStop=/usr/bin/zmpkg.pl stop
 PIDFile="/run/zm/zm.pid"
 [Install]
 WantedBy=multi-user.target

CTRL+o to save the file CTRL+x to exit nano

8. Create a file called zoneminder.conf

 nano /etc/tmpfiles.d/zoneminder.conf

Paste or enter the following

 d /var/run/zm 0755 www-data www-data

CTRL+o to save the file

CTRL+x to exit nano

IMPORTANT: If ZoneMinder complains on startup that the /var/run/zm folder is missing, that means you have skipped this step!


9. Change permissions on the file

 chmod 755 /etc/tmpfiles.d/zoneminder.conf

IMPORTANT: At this point the /var/run/zm directory has not been created. You may restart the PC which will create the directory or create it manually with the command "mkdir /var/run/zm"

10. Enable Zoneminder

  systemctl enable zoneminder.service

11. Start Zoneminder

  systemctl start zoneminder.service

12. Check to see that Zoneminder is running

  systemctl status zoneminder.service

Thanks to Isaac Connor, Andrew Bauer and Carla Schroder for the pieces that allowed this puzzle to go together.