Ubuntu Server 16.04 64-bit with Zoneminder 1.29.0 the easy way

From ZoneMinder Wiki
Jump to navigationJump to search

Ubuntu 16.04 is released and I have verified the Zoneminder install with teh default LAMP!

Ubuntu 16.04 with LAMP

Install Basic Server (if you used the mini.iso), OpenSSH Server, and LAMP Server (This procedure uses the default MySQL 5.7.)

If you get a blank screen after installing Ubuntu 16.04, press Alt + F1 to open a console.

Log in then become root:

sudo su

Make sure you are up to date

apt-get update
apt-get upgrade
apt-get dist-upgrade

At this point you should have Ubuntu 16.04 installed with LAMP which includes the default MySQL 5.7. You have the option to use Mariadb Server 10.0 which will replace MySQL 5.7 (Click on Options link in Contents above) or continue with MySQL 5.7..

You will need to make a settings change to MySQL as follows: Note: The MySQL configuration file is located at: /etc/mysql/mysql.conf.d/mysqld.cnf To better manage the MySQL server I recommend you move the config file and replace the default my.cnf symbolic link.

rm /etc/mysql/my.cnf  (this removes the current symbolic link)
cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/my.cnf

To change MySQL settings:

nano /etc/mysql/my.cnf

Underneath [mysql] add the following

sql_mode = NO_ENGINE_SUBSTITUTION

Ctrl+o Enter to save

CTRL+x to exit

Restart MySQL

systemctl restart mysql

Recommended: Secure MySQL.

mysql_secure_installation


Optional: A tool that you may want to install is mysqltuner. This is handy to see what database parameters need to be adjusted as your ZM system builds up events.

apt-get install mysqltuner

Once installed, run mysqltuner from a command prompt as root (sudo). Review recommended changes. Edit the configuration file (my.cnf) and make the recommended changes. Stop zoneminder, restart the database server then start zoneminder.

Install Zoneminder

apt-get install zoneminder php-gd

Create Zoneminder database in MySQL (Note: this also creates the default Zoneminder user and permissions in MySQL)

mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
mysql -uroot -p -e "grant all on zm.* to 'zmuser'@localhost identified by 'zmpass';"
mysqladmin -uroot -p reload

Set permissions of /etc/zm/zm.conf to root:www-data 740

chmod 740 /etc/zm/zm.conf
chown root:www-data /etc/zm/zm.conf

Create a new user

adduser www-data video

Enable CGI, Zoneminder and rewrite configuration in Apache.

a2enmod cgi
a2enconf zoneminder
a2enmod rewrite

Fix Permissions

chown -R www-data:www-data /usr/share/zoneminder/

Fix to allow API to work

nano /etc/apache2/apache2.conf

Change None to All two places as shown below

<Directory /usr/share>
        AllowOverride All
        Require all granted
</Directory>
<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

Ctrl+o Enter to save

CTRL+x to exit

Enable and start Zoneminder

systemctl enable zoneminder
service zoneminder start

Add timezone to PHP

nano /etc/php/7.0/apache2/php.ini

Search for [Date] (Ctrl + w then type Date and press Enter) and make changes as follows for your time zone

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = America/New_York

Ctrl+o Enter to save

CTRL+x to exit

Restart Apache

service apache2 reload

Open Zoneminder in a web browser (http://server-ip/zm).


Optional: Install MariaDB Server 10.0.

MariaDB has some enhanced features which do not exist in MySQL and thus migration back to MySQL might not always work.

Note: as of 21APR16 it is recommended to upgrade to Mariadb before installing Zoneminder!

Upgrade the LAMP installed MySQL 5.7 to Mariadb with the command:

apt-get install mariadb-server

Secure Mariadb, create root password et. al.

mysql_secure_installation

Note: The MySQL/MariaDB configuration file is located at: /etc/mysql/mysql.conf.d/mysqld.cnf To better manage the MariaDB server I recommend you move the config file and replace the default my.cnf symbolic link (this also works for MySQL 5.6).

rm /etc/mysql/my.cnf  (this removes the current symbolic link)
cp /etc/mysql/mariadb.conf.d/50-server.cnf /etc/mysql/my.cnf

To change Mariadb settings:

nano /etc/mysql/my.cnf

Ctrl+o Enter to save

CTRL+x to exit

A tool that you may want to install is mysqltuner. This is handy to see what database paramaters need to be adjusted as your ZM system builds up events.

apt-get install mysqltuner

Continue installing Zoneminder: https://wiki.zoneminder.com/Ubuntu_Server_16.04_64-bit_with_Zoneminder_1.29.0_the_easy_way#Install_Zoneminder


Here is a link to manually install LAMP with Mariadb server Install MariaDB Server 10.0