トップ 差分 一覧 ソース 置換 検索 ヘルプ PDF RSS ログイン

Linuxで動体検知の監視システムを構築する

https://www.petapico.biz/%E3%83%A9%E3%82%B8%E9%A4%A8petapicoshop/zoneminder-%E3%81%BE%E3%81%A7%E3%81%AE%E4%B8%8B%E6%BA%96%E5%82%99%E3%81%A8%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB/
https://www.petapico.biz/%E3%83%A9%E3%82%B8%E9%A4%A8petapicoshop/zoneminder-%E3%81%A7%E3%81%A7%E3%81%8D%E3%82%8B%E7%9B%A3%E8%A6%96%E3%82%AB%E3%83%A1%E3%83%A9%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0%E3%81%A8%E3%81%AF/
http://debianj.com/ubuntu/webcam/zoneminder
http://www.zoneminder.com/
http://d.hatena.ne.jp/seinzumtode/20141129/1417252211

Dockerで動かす

 Docker準備

Docker_web.conf

 From centos
 
 RUN echo "RUNはbuild時に実行"
 # RUN apt update
 # RUN a2enmod rewrite
 # RUN docker-php-ext-install pdo_mysql
 RUN yum -y install epel-release
 RUN rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
 RUN yum -y install wget
 RUN  wget http://zmrepo.connortechnology.com/el/7/x86_64/zoneminder-1.30.4-1.el7.centos.x86_64.rpm
 RUN yum -y install zoneminder-1.30.4-1.el7.centos.x86_64.rpm
 RUN yum -y install mariadb
 RUN yum -y install mod_ssl
 RUN yum -y install patch
 
 RUN cp /usr/lib/systemd/system/zoneminder.service /etc/systemd/system/
 COPY zoneminder.service.patch /tmp/
 RUN patch /etc/systemd/system/zoneminder.service -p1 < /tmp/zoneminder.service.patch
 
 COPY zm.conf.patch /tmp/
 RUN patch /etc/zm/zm.conf -p1 < /tmp/zm.conf.patch
 
 COPY zoneminder.conf.patch /tmp
 RUN patch /etc/httpd/conf.d/zoneminder.conf -p1 < /tmp/zoneminder.conf.patch
 
 COPY php.ini.patch /tmp
 RUN patch /etc/php.ini -p1 < /tmp/php.ini.patch
 
 RUN systemctl enable httpd
 RUN systemctl enable zoneminder
 # docker-compose run --rm web /bin/bash -c "mysql -uroot -p -h mysql < /usr/share/zoneminder/db/zm_create.sql"
 # docker-compose run --rm web mysql -uroot -p -h mysql -e "grant all on zm.* to 'zmuser'@localhost identified by 'zmpass';"
 # docker-compose run --rm web mysqladmin -uroot -p -h mysql reload
 
 # CMD /sbin/init

docker-compose.yml

 version: '2'
 services:
  web:
    build:
      context: .
      dockerfile: ./docker_web.conf
    tty: true
    command: /sbin/init
    # user: "1000:1000"
    # volumes:
      # - ./src:/var/www/html
    privileged: true
    
    ports:
      - 80:80
    depends_on:
      - mysql
  mysql:
    image: mysql:5.6
    environment:
      - MYSQL_USER=zmuser
      - MYSQL_PASSWORD=zmpass
      - MYSQL_DATABASE=zm
      - MYSQL_ROOT_PASSWORD=mysqlpsswd
      - MYSQL_ROOT_HOST=%
    ports:
      - 3306:3306
    volumes:
      - ./data/mysql:/var/lib/mysql
      # - $PWD/conf/mysql:/etc/mysql:ro
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    environment:
      - PMA_ARBITRARY=1
      - PMA_HOST=mysql
      - PMA_USER=root
      - PMA_PASSWORD=mysqlpsswd
    depends_on:
      - mysql
    ports:
       - 81:80

php.ini.patch

878c878
< ;date.timezone =
---
> date.timezone = "Asia/Tokyo"

zm.conf.patch

39c39
< ZM_DB_HOST=localhost
---
> ZM_DB_HOST=mysql

zoneminder.conf.patch

9,10c9,10
< RewriteCond %{HTTPS} !=on
< RewriteRule ^/?(zm)(.*) https://%{SERVER_NAME}/$1$2 [R,L]
---
> #RewriteCond %{HTTPS} !=on
> #RewriteRule ^/?(zm)(.*) https://%{SERVER_NAME}/$1$2 [R,L]
17c17
<     SSLRequireSSL
---
>     #SSLRequireSSL
33c33
<     SSLRequireSSL
---
>     #SSLRequireSSL

zoneminder.service.patch

6c6
< Requires=mariadb.service httpd.service
---
> Requires=httpd.service

 ビルド

docker-compose build
docker-compose up

DB作成

docker-compose run --rm web /bin/bash -c "mysql -uroot -p -h mysql < /usr/share/zoneminder/db/zm_create.sql"
docker-compose run --rm web mysql -uroot -p -h mysql -e "grant all on zm.* to 'zmuser'@localhost identified by 'zmpass';"
docker-compose run --rm web mysqladmin -uroot -p -h mysql reload

パスワードは、docker-compose.ymlで指定した通り。mysqlpsswd
もう一回実行

 docker-compose up

アクセス

http://localhost/zm

[カテゴリ: OS > Linux]



  • Hatenaブックマークに追加
  • livedoorクリップに追加
  • del.icio.usに追加
  • FC2ブックマークに追加

最終更新時間:2019年01月20日 20時44分52秒