How do I do a clean re-install of zoneminder? - mysql

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-zoneminder
but when I tried to upgrade a couple of days ago to version 1.26.2 by compiling manually, I messed it up.
How can I remove zoneminder completely so that the original "clean" install works again?

No need to do any of the above, from this link:-
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.
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
./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:-
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:-)
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:-
localhost/index.php
to bring up zoneminder, working OK, in my browser - Yee Haw! Not bad for two day's effort and one divorce.
But I could only get zmpkg.pl to work by doing this:-
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:-
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.
2) Download version 1.26.5
3) Ran the ./bootstrap.sh script (as mentioned above).
4) Ran the ./configure... script (as mentioned above).
5) Ran the make (as mentioned above - but got errors)...
So I read the README and copied and pasted this from it (line 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.
6) Did the "sudo make install" OK (i.e. on top of the old version I guess).
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
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"

I would suggest that you have to uninstall all the packages which include LAMP(apache, mysql, php) and 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
sudo make clean
sudp updatedb
After this you can start normal install procedure.

Related

Uninstall MySQL in WSL

How do I uninstall MySQL in WSL?
I have version 5.7.4 installed. After reading over the changes for upgrading to the latest 5.7.x version so I could upgrade to 8.0 (there's a minimum requirement of 5.7.9 to upgrade to 8.0), I figured it would be easier to just uninstall MySQL and start over (I have nothing worth saving from playing around with it previously).
I tried running the following commands (as per this post and this one) and got the following responses:
$ sudo apt remove mysql mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package mysql
$ sudo apt-get remove --purge *mysql*
zsh: no matches found: *mysql*
$ sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*
zsh: no matches found: mysql-server-core-*
After running those, I'm still able to start and stop my server with the following commands (note that these are not necessarily the usual systemd commands because I'm in WSL2):
sudo /etc/init.d/mysql start
mysqladmin -u root -p shutdown
Unsure if this is relevant, but even when the server is running I'm not seeing the socket when I enter sudo find / -type s as suggested by this post.
I'm wondering it'd be okay to just delete what files I can find manually, but that seems like a bad idea
/var/lib/mysql/
/usr/share/mysql/
/usr/lib/mysql/
The problem was using zsh as a shell. I successfully removed MySQL with sudo apt-get remove --purge '*mysql*'

I can't install mysql on ubunut 20.04

i have to install mysql-server for my project. but while i install with sudo apt install mysql-server it say's E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied) and E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?. i'd try to search the solving method but is has no change. thanks for any help
(edit)
and also i get this error The following packages have unmet dependencies: mysql-server-core-8.0 : Depends: libprotobuf-lite23 (>= 3.12.4) but it is not installable
The error indicates that another process is updating on your Linux machine.
You can check what processes are locking the file by running:
sudo lsof /var/lib/dpkg/lock-frontend
and kill the PID indicated by the command. If no processes are indicated by the command above, the easiest and fastest way to solve the issue is by rebooting your machine.
After the reboot rerun the command:
sudo apt install mysql-server
If the error persists, delete the lock-frontend file and reshot the command above.
Maybe you have some active apt process already?
check it:
ps aux | grep -I apt
then
sudo kill 'busy process id'
or you can kill all apt processes:
sudo killall apt apt-get
and try install MySQL again
In other case you have a locked file, just check it:
sudo lsof /var/lib/dpkg/lock-frontend
then you try to remove lock
sudo rm /var/lib/dpkg/lock-frontend
and reconfigure dpkg
sudo dpkg --configure -a
sudo apt update

Unatttended MySQL 8 community install on Ubuntu 18.04 WSL

I am trying to install MySQL 8 on an Ubuntu (that is a Windows Subsystem for Linux) without any prompts.
I have the following script:
apt-key add --keyserver pgp.mit.edu --recv-keys 5072E1F5
echo 'deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-8.0' > /etc/apt/sources.list.d/mysql.list
apt-get update --yes
apt-get install --yes debconf-utils
echo 'mysql-community-server mysql-community-server/root-pass password' | sudo debconf-set-selections
echo 'mysql-community-server mysql-community-server/re-root-pass password' | sudo debconf-set-selections
apt-get install --yes mysql-community-server
(partly constructed thanks to the answers in this question)
and it appears to work fine, except that it prompts me to select authentication method... I want to pick the mysql_native_password and do so without being prompted interactively.
I'm guessing the solution is another debconf-set-selections setting, but... In addition to asking what is it for this case... Is there a reference of all possible options somewhere?
There's also the issue that apt-get says that a symlink is created for the service, and yet the service isn't created... But that's not really a showstopper, as I'm using WSL merely as a test ground for an actual Ubuntu server, where I'd think this would work... hopefully.
EDIT1: Nevermind the original question... I managed to find an answer here
which led to stumble upon this dockerfile
So I ended up adding
echo 'mysql-community-server mysql-server/default-auth-override select Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)' | sudo debconf-set-selections
is the line I need...
HOWEVER, the other, possibly WSL specific issue remains... that is, no MySQL service is created. I should note that while I have MySQL outside of WSL, the server is turned off, specifically so that the WSL could run.
I get the following output upon the install, near the end:
Setting up mysql-community-server (8.0.16-2ubuntu18.04) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
dpkg: error processing package mysql-community-server (--configure):
installed mysql-community-server package post-installation script subprocess returned error exit status 1
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Errors were encountered while processing:
mysql-community-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
And the only thing I can find related to that is suggestions of complete reinstall, but even reinstalling the WSL instance doesn't fix this.
EDIT2: Adding
apt-get dist-upgrade --yes --allow-remove-essential --allow-change-held-packages
Fixes the above error, and yet despite there not being any errors, the service is still not created.
I sort of fixed the missing mysql service by copying the /etc/init.d/mysql file from another WSL instance (mysql 8 installed through an upgrade) to /etc/init.d
sudo service mysql start
returns a [fail], but the mysql daemon runs just fine.
Otherwise, I've seen people achieve this more cleanly by installing a lower version from MySQL's repo first, and then upgrade to mysql 8.

How to install mysql-server in Ubuntu

I have mariadb in my ubuntu system but it is not working properly , so i want to again install mysql in my system .
For Remove mariadb i have run these commands .
sudo apt-get --purge remove "mysql*"
sudo mv /etc/mysql/ /tmp/mysql_configs/
nano /etc/apt/sources.list
sudo apt-get update
sudo apt-get install mysql-server-5.6
but after step 5 it's give me these errors :
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
libmysqlclient18 : Depends: mysql-common (= 5.6.30-1ubuntu14.04)
mariadb-server-5.5 : Breaks: mysql-server-5.6
Breaks: virtual-mysql-server
mariadb-server-core-5.5 : Conflicts: mysql-server-5.6
mysql-server-5.6 : Depends: mysql-client-5.6 (>= 5.6.30-0ubuntu0.14.04.1)
Depends: mysql-server-core-5.6 (= 5.6.30-0ubuntu0.14.04.1)
Recommends: mysql-common-5.6 but it is not going to be installed
Breaks: virtual-mysql-server
W: Duplicate sources.list entry http://debian.datastax.com/community/ stable/main amd64 Packages (/var/lib/apt/lists/debian.datastax.com_community_dists_stable_main_binary-amd64_Packages)
W: Duplicate sources.list entry http://debian.datastax.com/community/ stable/main i386 Packages (/var/lib/apt/lists/debian.datastax.com_community_dists_stable_main_binary-i386_Packages)
W: You may want to run apt-get update to correct these problems
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
Can anyone give me suggestion how can i install mysql in my system . Thanks in advance .
First of all, you need to update the system.
sudo apt update && upgrade
then perform the MySQL installation commands and follow the instructions.
sudo apt install mysql-server
sudo mysql_secure_installation
Once it has done. try to open MySQL.
sudo mysql
try to check the authentication method each of your MySQL user accounts uses with the following command in the MySQL terminal:
SELECT user,authentication_string,plugin,host FROM mysql.user;
this will return users with authentication_string.
Change the MySQL root password with the following command.
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
FLUSH PRIVILEGES;
Flush Privileges which tells the server to reload the grant tables and put your new changes into effect
It's very simple to install mysql on ubuntu , just follow these steps :
Step 1 : update the system
sudo apt update
Step 2 : Install mysql package
sudo apt install mysql-server
Step 3 : Once the installation is completed, the MySQL service will start automatically. To check whether the MySQL server is running, type:
sudo systemctl status mysql
The output of the following command should be :
OUTPUT
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2018-06-20 11:30:23 PDT; 5min ago
Main PID: 17382 (mysqld)
Tasks: 27 (limit: 2321)
CGroup: /system.slice/mysql.service
`-17382 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
Step 4 : Securing MySQL
sudo mysql_secure_installation
select one of the three levels of password validation policy(strong recommended).Set your password ,and then type y(yes) to all the questions , this will improve the security .
Step 5 : Once it has done. open MySQL by typing the following command :
sudo mysql
Step 6 : If you want to login to your MySQL server as root from an external program such as phpMyAdmin , then type these commands inside mysql.
mysql>ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'strong_password';
mysql>FLUSH PRIVILEGES;
mysql>exit;
After this you will be successfully able to run mysql , for this open terminal and type.
mysql -u root -p
Now type your password.
Congo! you are done with installing mysql.
Lesson from continuous deployment test. You MUST do this purge mysql-common. You CANNOT put mariadb and mysql in the same system, they want their own mysql-common and not sharing them. Which many other API wrapped around it to connect to those server.
And you must comment all the repo pointing to mariadb. Otherwise it will install the same version again from mariadb.
sudo apt-get purge mysql-common
# Put back the mysql-common , make sure you use the new mysql repo,
# remarks mariadb repo
sudo apt-get install software-properties-common
Always check whether any OTHER file or folder contains mariadb repo.
cd /etc/apt
fgrep -lR "maria"
The easy way for this is installing the synaptic package manager by typing the following command in the terminal:
sudo apt-get install synaptic
And then open synaptic by:
sudo synaptic
Then search for the package you have installed, mariadb, and mark it for complete removal and press apply.
And these commands to install mysql-server
sudo apt-get update
sudo apt-get install mysql-server
It's quite easy to install mysql on Ubuntu.
sudo apt-get update
sudo apt-get install mysql-server
You'll be asked to create a new password for root user. Set a good password and you're ready to go.
You can also follow this youtube videos for installation and basic understanding for Mysql
sudo apt-get update
sudo apt-get install mysql-server -y
if setup password
sudo mysql_secure_installation
if set new user
sudo mysql
>CREATE USER 'username'#'%' IDENTIFIED BY 'password';
>FLUSH PRIVILEGES;
>exit
sudo systemctl restart mysql

MySQL not running on Linux machine

I tried everything and I am still unable to start the MySQL service. The error is as below:
[root#localhost ~]# service mysql.server start Starting MySQL.....
ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid).
[root#localhost ~]# service mysql start Starting MySQL....
ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid).
Things I tried:
Removing the .err file and restarting, no use. Creating a .sock file and a .pid file as the above error mentions, still no use. Almost tried all the steps in most of the forums, still nothing.
I tried all the config files, nothing seems to resolve my issue.
Try the next steps:
First remove MySQL:
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
Then reinstall:
sudo apt-get update
sudo apt-get install mysql-server
sudo mysql_install_db
sudo /usr/bin/mysql_secure_installation
After these steps mysql process should be up and running. Anyway, if this is not happening ( you can verify by typing sudo service mysql status ) just try:
sudo service mysql start or sudo /etc/init.d/mysql start
I strongly reccommend to post your log files (/var/log/syslog) for mysql if you get any problems, so that we can advice you properly.
If you're still getting the same error, please check for svs answer from this SO question