Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Upgrade to zoneminder-1.27.0 from an old overlay ebuild
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message

Joined: 19 Jan 2003
Posts: 323
Location: West Sussex, UK

PostPosted: Tue Jun 17, 2014 8:35 pm    Post subject: Upgrade to zoneminder-1.27.0 from an old overlay ebuild Reply with quote

A couple of months ago zoneminder was finally re-introduced into the portage tree following the re-activation of development last year. If you've been getting by on either the old Gentoo ebuild or one you downloaded from zugaina or another overlay, it is possible to upgrade to v1.27 in the portage tree.

However, there are a few gotchas to be aware of when doing the upgrade. I'm posting what I remember here so other people attempting this can take care and hopefully won't fall into the same traps that I did.

The gotchas are
  1. The database upgrade script has had a critical environment variable changed, which can cause it to fail if /etc/zm.conf is not updated first.
  2. The directories have moved from /var/www/zoneminder to /usr/libexec/zoneminder and /usr/share/zoneminder, so the apache config needs to be changed.
  3. All your existing recorded images in the /var/www/zoneminder/htdocs/events directory need to be manually moved to /var/lib/zoneminder/events.

I strongly recommended you take a full backup before proceeding!
In my case I attempted the upgrade on an LVM snapshot, scrapping the snapshot when it went wrong and keeping the final snapshot when it succeeded and I was sure everything was okay.

Please don't just blindly follow the instructions but treat them as guidelines; make sure you meticulously study the directories and files in question before and after each critical step.
These instructions are based purely on my memory, so they may not be 100% correct.

You only need to do this if you are upgrading from an earlier version of Zoneminder on Gentoo, installed by an old overlay ebuild.
These instructions do not apply if you are freshly installing zoneminder from scratch.

Firstly, stop zoneminder and apache
/etc/init.d/zoneminder stop
/etc/init.d/apache2 stop

Then upgrade zoneminder to v1.27
emerge -u zoneminder

Now update the files in /etc using etc-update, dispatch-conf or whatever you use.
GOTCHA 1: You need to pay special attention to /etc/zm.conf. The variable ZM_PATH_BUILD has been changed to ZM_PATH_DATA, which must be done in this file for the database upgrade script to work properly. The snippet of the file in question should look like this...
# Path to installed data directory, used mostly for finding DB upgrade scripts
If it's ZM_PATH_BUILD that is set, change it to ZM_PATH_DATA.

Ensure that the variables ZM_DB_HOST, ZM_DB_NAME, ZM_DB_USER and ZM_DB_PASS are the same as they were before; they define the credentials of the MySQL database that zoneminder will use.

You'll notice that the variables ZM_PATH_WEB and ZM_PATH_CGI have changed from /var/www/zoneminder to the following
# Path to ZoneMinder web files

# Path to ZoneMinder cgi files
Make sure that this change happens.

Compared with all that, updating /etc/init.d/zoneminder is a breeze. Just replace the whole of that file with the new one.

Upgrade the database
Now we've made sure that ZM_PATH_DATA is set in /etc/zm.conf we can now upgrade the database.

Make sure MySQL is running first, then run
Code: -u dbuser -p dbpass
replacing the dbuser and dbpass options with the username and password of the MySQL database zoneminder uses. The script will ask/recommend converting the database to InnoDB, answer yes to this. This will take a minute or two to perform, and then after a couple more prompts (answer yes if it offers to backup your database first!) it should update the database to the new version.

Update your apache configuration
GOTCHA 2: Gentoo's zoneminder v1.27 has a new directory layout, but apache will still be looking at the old layout.

The ebuild will not update the apache config for us, instead it just leaves an example config which can be found at /usr/share/doc/zoneminder-1.27.0/10_zoneminder.conf.bz2. For your convenience I'll quote it here:
ScriptAlias /cgi-bin/zms "/usr/libexec/zoneminder/cgi-bin/zms"
ScriptAlias /cgi-bin/nph-zms "/usr/libexec/zoneminder/cgi-bin/nph-zms"

<Directory "/usr/libexec/zoneminder/cgi-bin">
AllowOverride All
Options ExecCGI
Order allow,deny
Allow from all

Alias /zoneminder "/usr/share/zoneminder/www"

<Directory "/usr/share/zoneminder/www">
Options -Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Study this and use it to update your existing apache config. The ScriptAliases, Alias and <Directory paths highlighted in red above need to be changed from the /var/www... that they were set to before.

Move your previously recorded events and images
GOTCHA 3: Although your new zoneminder install is using new directory paths, the events previously recorded and images are still in the old directory.

In my case the old events and images directories were found in /var/www/zoneminder/htdocs, they have now moved to /var/lib/zoneminder.
mv /var/www/zoneminder/htdocs/events/* /var/lib/zoneminder/events/
mv /var/www/zoneminder/htdocs/images/* /var/lib/zoneminder/images/

Restart zoneminder and apache
/etc/init.d/apache2 start
/etc/init.d/zoneminder start

Fingers crossed, your new zoneminder should be up and running! Wait about 10 seconds for things to settle and then try opening the zoneminder web page...
If ~amd64 ebuilds are cutting edge, then git-9999 ebuilds are chainsaws.
"Not everyone can ride a unicycle, does that mean we should put another wheel on it?" - Lokheed
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum