Difference between revisions of "Ubuntu Server 16.04 64-bit with Zoneminder 1.29.0 the easy way"

From ZoneMinder Wiki
Jump to navigationJump to search
Line 62: Line 62:


  service mysql reload
  service mysql reload
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.
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.

Revision as of 08:23, 10 April 2016

Ubuntu 16.04 is scheduled for release on April 21, 2016. As of this, March 25, 2016, the final beta has been released and it contains Zoneminder 1.29.0! The following procedures were run on the final Beta 16.04. Things could change in the next couple of weeks!

If you are interested in upgrading your current Ubuntu/Zoneminder to Ubuntu 16.04, see here: https://wiki.zoneminder.com/Common_Issues_with_Zoneminder_Installation_on_Ubuntu#Ubuntu_16.04_-_ZM_1.29.0_Upgrade I would remind you that these are preliminary procedures and may not always work!

I would advise you not upgrade a working "production" Zoneminder server until I've had a chance to do some testing. If you must test yourself PLEASE use a VM or a PC you can afford to wipe and start over with!


08APR 16 - With MySQL update to 5.7 doing the procedure to switch to Mariadb 10.0 fails. I will keep working on this and post updates/fixes. As for now, if you install 16.04 final beta server and want Mariadb, do not upgrade your install before you switch to Mariadb. (Mariadb can be installed to replace MySQL. See Option below.)

Thanks,

bb


Optional: Install MariaDB Server 10.0.

Note: as of 09APR16 you will need to start with a Ubuntu 16.04 basic server install without LAMP. You should be able to replace MySQL 5.7 with Mariadb 10.0 once the final release comes out.

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

Click here for instructions to Install MariaDB Server 10.0


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.)

Log in then become root:

sudo su

Make sure you are up to date

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

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 Mariadb 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

service mysql reload

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). Edit the configuration file 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).