Linux 如何彻底重新安装 zoneminder?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18761594/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I do a clean re-install of zoneminder?
提问by Robin Pain
Because doing this:-
因为这样做:-
sudo apt-get remove --purge zoneminder
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo rm -rf /var/lib/mysql
sudo apt-get remove --purge apache2*
sudo apt-get clean
sudo apt-get update
sudo apt-get upgrade
sudo rm -r /var/www/*
sudo rm -r /etc/apache2/*
sudo rmdir /var/www
sudo rmdir /etc/apache2
sudo rm -r /opt/zm
sudo rm /etc/apache2/conf.d/zoneminder.conf
sudo dpkg --configure -a
reboot hardware
sudo apt-get install zoneminder
produces this error:-
产生此错误:-
* Starting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]
Setting up libapache2-mod-php5 (5.4.6-1ubuntu1.4) ...
Creating config file /etc/php5/apache2/php.ini with new version
* Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]
Setting up apache2 (2.2.22-6ubuntu2.3) ...
Setting up zoneminder (1.25.0-1.1ubuntu1) ...
Starting ZoneMinder: Can't open config file '/opt/zm/etc/zm.conf': No such file or directory at /usr/local/share/perl/5.14.2/ZoneMinder/Config.pm line 100
BEGIN failed--compilation aborted at /usr/local/share/perl/5.14.2/ZoneMinder/Config.pm line 100.
Compilation failed in require at /usr/local/share/perl/5.14.2/ZoneMinder.pm line 33.
BEGIN failed--compilation aborted at /usr/local/share/perl/5.14.2/ZoneMinder.pm line 33.
Compilation failed in require at /usr/bin/zmpkg.pl line 37.
BEGIN failed--compilation aborted at /usr/bin/zmpkg.pl line 37.
failure
invoke-rc.d: initscript zoneminder, action "start" failed.
dpkg: error processing zoneminder (--configure):
subprocess installed post-installation script returned error exit status 2
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Processing triggers for ureadahead ...
Errors were encountered while processing:
zoneminder
E: Sub-process /usr/bin/dpkg returned an error code (1)
Originally zoneminder installed "first time" Ok on this 32bit "mint 14" machine using just the single apt-get install zoneminder command from here:- http://www.tuxradar.com/content/build-your-own-surveillance-zoneminderbut when I tried to upgrade a couple of days ago to version 1.26.2 by compiling manually, I messed it up.
最初 zoneminder 是“第一次”安装的,在这台 32 位“mint 14”机器上只使用来自这里的单个 apt-get install zoneminder 命令:- http://www.tuxradar.com/content/build-your-own-surveillance- zoneminder但是当我几天前尝试通过手动编译升级到 1.26.2 版时,我把它搞砸了。
How can I remove zoneminder completely so that the original "clean" install works again?
如何完全删除 zoneminder 以便原始的“干净”安装再次运行?
回答by Robin Pain
No need to do any of the above, from this link:- http://pjpramod.blogspot.co.uk/2010/01/starting-zoneminder-cant-open-config.html
无需执行上述任何操作,来自此链接:- http://pjpramod.blogspot.co.uk/2010/01/starting-zoneminder-cant-open-config.html
So I did this:-
所以我这样做了:-
sudo rm -r /usr/local/share/perl/5.14.2/*
and then the install completes OK - but the popups no longer work (don't open at all or open in the same window), so don't do that.
然后安装完成 OK - 但弹出窗口不再工作(根本不要打开或在同一窗口中打开),所以不要这样做。
Finally I abandoned re-installing the pre-built package (1.25.0 - or was it 1.25.2?) and downloaded the 1.26.3 tar file and unpacked it and cd'ed into it... ...and ./configure was missing... ...but if you run bootstrap.sh
最后我放弃了重新安装预构建的包(1.25.0 - 还是 1.25.2?)并下载了 1.26.3 tar 文件并将其解压缩并放入其中... ...和./配置丢失... ...但如果你运行 bootstrap.sh
./bootstrap.sh
then that (and some other things) magically appear.
然后那个(和其他一些东西)神奇地出现了。
Then did this:
然后做了这个:
sudo ./configure --prefix=/opt/zm --with-mysql=/usr --with-ffmpeg=/usr --with-webuser=www-data --with-webgroup=www-data --disable-debug --disable-crashtrace --enable-mmap=yes --with-webdir=/var/www --with-cgidir=/usr/lib/cgi-bin ZM_SSL_LIB=openssl
and it configured OK.
它配置好。
then this
那么这个
sudo make
followed by this:-
其次是:-
sudo make install
and it installed OK but when I tried to run zoneminder I got database errors so did something like this to delete zm:-
它安装正常,但是当我尝试运行 zoneminder 时,我遇到了数据库错误,所以做了这样的事情来删除 zm:-
mysql -uroot -pyourPassWord
mysql > drop database zm;
mysql > quit;
and this to recreate it (I know nothing about databases, this is monkey-see, monkey-do from here):-
这是重新创建它(我对数据库一无所知,这是从这里开始的猴子看,猴子做):-
mysql -u root -pyourPassWord
>create database zm;
>exit
mysql -u root -pyourPassWord zm < db/zm_create.sql
mysql -u root -pyourPassWord zm
>grant select,insert,update,delete on zm.* to 'zmuser'@localhost identified by 'zmpass';
>quit
mysqladmin -u root -pyourPassWord reload
and it then worked OK (I am running zm like this:-)
然后它工作正常(我像这样运行 zm :-)
sudo /etc/init.d/zm start
And while trying to figure out what link between apache and zm did (and how apache works etc) I discovered that you only need to do this:-
在试图找出 apache 和 zm 之间的联系(以及 apache 的工作原理等)时,我发现您只需要这样做:-
localhost/index.php
to bring up zoneminder, working OK, in my browser - Yee Haw! Not bad for two day's effort and one divorce.
在我的浏览器中调出 zoneminder,工作正常 - Yee Haw!两天的努力和一次离婚还不错。
But I could only get zmpkg.pl to work by doing this:-
但我只能通过这样做让 zmpkg.pl 工作:-
sudo /opt/zm/bin/zmpkg.pl
and not this:-
而不是这个:-
sudo zmpkg.pl
Because, I learn, that that $PATH is defined "globally" for sudo and therefore my adding /opt/zm/bin in my .bashrc file had no effect so then, rather than put zmpkg.pl into /usr/local/sbin (or one of those paths in "global" $PATH) I insert a link instead like this:-
因为,我了解到,$PATH 是为 sudo “全局”定义的,因此我在我的 .bashrc 文件中添加 /opt/zm/bin 没有效果,因此,而不是将 zmpkg.pl 放入 /usr/local/sbin (或“全局”$PATH 中的这些路径之一)我插入一个链接,而不是这样:-
sudo ln -s /opt/zm/bin/zmpkg.pl /usr/local/sbin/zmpkg.pl
and it works! so now e.g.
它有效!所以现在例如
sudo zmpkg.pl status
works again.
再次工作。
Does anyone know how all this should be done? E.g. so that
有谁知道这一切应该怎么做?例如,这样
localhost/zm
works again?
又工作了?
Update on 20th December 2013: I just upgraded to verion 1.26.5 successfully on this mint 14 system by repeating some of the above instructions i.e. 1) Stop zoneminder.
2013 年 12 月 20 日更新:我刚刚通过重复上述一些说明,即 1) 停止 zoneminder,在此 mint 14 系统上成功升级到 1.26.5 版。
2) Download version 1.26.5
2) 下载 1.26.5 版本
3) Ran the ./bootstrap.sh script (as mentioned above).
3) 运行 ./bootstrap.sh 脚本(如上所述)。
4) Ran the ./configure... script (as mentioned above).
4) 运行 ./configure... 脚本(如上所述)。
5) Ran the make (as mentioned above - but got errors)...
5)运行make(如上所述 - 但出现错误)......
So I read the README and copied and pasted this from it (line 24):
所以我阅读了自述文件并从中复制并粘贴了它(第 24 行):
root@host:~# aptitude install -y apache2 mysql-server php5 php5-mysql build-essential libmysqlclient-dev libssl-dev libbz2-dev libpcre3-dev libdbi-perl libarchive-zip-perl libdate-manip-perl libdevice-serialport-perl libmime-perl libpcre3 libwww-perl libdbd-mysql-perl libsys-mmap-perl yasm subversion automake autoconf libjpeg8-dev libjpeg8 apache2-mpm-prefork libapache2-mod-php5 php5-cli libphp-serialization-perl libgnutls-dev libjpeg8-dev libavcodec-dev libavformat-dev libswscale-dev libavutil-dev libv4l-dev libtool ffmpeg libnetpbm10-dev libavdevice-dev libmime-lite-perl dh-autoreconf dpatch;
and then did a sudo make clean and then repeated 4) and 5) above and it compiled OK.
然后做了一个 sudo make clean ,然后重复上面的 4) 和 5),它编译好了。
6) Did the "sudo make install" OK (i.e. on top of the old version I guess).
6)“sudo make install”是否正常(我猜是在旧版本之上)。
7) Then did all the rest of the "as mentioned above" instructions to delete zm from the database (after trying to zm unsuccessfully) and re-inserted it and then it started OK via the "zmpkg.pl start" script as version 1.26.5
7)然后执行所有其余的“如上所述”指令从数据库中删除 zm(在尝试 zm 失败后)并重新插入它,然后它通过“zmpkg.pl start”脚本作为版本 1.26 正常启动.5
8) As before I then had to manually reset up all cameras and password and users and zones but at least it all worked "first time"
8)和以前一样,我不得不手动重置所有摄像机和密码以及用户和区域,但至少这一切都是“第一次”
回答by Mohsen
I would suggest that you have to uninstall all the packages which include LAMP(apache, mysql, php) and zoneminder.
我建议您必须卸载包括 LAMP(apache, mysql, php) 和 zoneminder 在内的所有软件包。
use this command to remove these packages.
使用此命令删除这些包。
sudo aptitude purge <pkg-name>
Then you have to go to zoneminder manual installation directory (say /usr/src). and use command
然后你必须去 zoneminder 手动安装目录(比如 /usr/src)。并使用命令
sudo make clean
sudp updatedb
After this you can start normal install procedure.
在此之后,您可以开始正常的安装程序。