Friday, July 9, 2021

Installing Tomcat

cd /opt && sudo wget

sudo tar xvzf apache-tomcat-9.0.50.tar.gz

sudo mv apache-tomcat-9.0.50 tomcat

sudo gedit /etc/profile

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export CATALINA_HOME=/opt/tomcat


sh /opt/tomcat/bin/

sh /opt/tomcat/bin/


Friday, February 12, 2021

Import large sql file in Phpmyadmin on Ubuntu 20.04 (Debian9)

If try to import big sql (mysql) file and take long lime or fail to work.

Follow the steps:

Create an 'upload' and a 'save' directories for PhpMyadmin

mkdir /etc/phpmyadmin/upload 

mkdir /etc/phpmyadmin/save 

chmod a+w /etc/phpmyadmin/upload 

chmod a+w /etc/phpmyadmin/save

Then edit phpmyadmin's config file: 

sudo nano /etc/phpmyadmin/

add absolute path for both 'upload' and 'save' directories:

$cfg['UploadDir'] = '/etc/phpmyadmin/upload'; 

$cfg['SaveDir'] = '/etc/phpmyadmin/save';

If you encounter Script timeout passed massage

Edit the bellow config.default.php

nano \usr\share\phpmyadmin\libraries\config.default.php

Restart Apache2 and to finish an import resume with Phpmyadmin 

Thursday, February 11, 2021

How do I uninstall MySQL completely from ubuntu/Debian

sudo -i

service mysql stop

killall -KILL mysql mysqld_safe mysqld

apt-get --yes purge mysql-server mysql-client

apt-get --yes autoremove --purge

apt-get autoclean

deluser --remove-home mysql

delgroup mysql

rm -rf /etc/apparmor.d/abstractions/mysql /etc/apparmor.d/cache/usr.sbin.mysqld 

/etc/mysql /var/lib/mysql /var/log/mysql* /var/log/upstart/mysql.log* /var/run/mysqld



sudo rm -rf /var/lib/mysql 


sudo apt-get remove --purge *mysql\*

sudo apt-get autoremove

sudo apt-get autoclean 

Tuesday, January 12, 2021

MySQL Autobackup of Koha in Debian/Ubuntu

I am showing you the easiest way to keep automate your koha db backupthat is the combination of MySQL Dumps and a cronjob.

Create a file called

mkdir /home/debian/backup/

copy the bellow line.

mysqldump -uroot -p******* koha_library | gzip > /home/debian/backup/koha_`date +%F`.sql.gz

save it

Test the script

 chmod +x /home/debian/backup/

Create and schedule a new cron job

Execute the script:

 sh /home/debian/backup/

And add the following line at the bottom of crontab -e

 30 23 * * * /home/debian/backup/

(This will execute the script every day at 23:30.)

------------------------------PERIODIC REMOVAL OF FILES--------------------------

tested on Debian/UBUNTU

  nano /home/debian/backup/

Add the line at the end: (this script will remove your Koha backfiles after 7 days)

  find /home/debian/backup/koha* -type f -mtime +7 -exec rm {}

--------------------------Auto Restart Mysql service------------------------------------------

And add the following line at the bottom of crontab -e 

30 23 * * * systemctl is-active  || systemctl start mysql.service

This will run every midnight at 11.30PM

Sunday, September 13, 2020

How to AutoBackup MySQL on Ubuntu/Debian

Here is an utility program called "automysqlbackup" that is available in the Ubuntu repositories.

sudo apt-get install automysqlbackup

Run the command by typing:

sudo automysqlbackup
/etc/lib/automysqlbackup ls
daily  monthly weekly
/etc/lib/automysqlbackup/daily ls
koha_library test

Saturday, September 12, 2020

Reset MySQL Root Password on Ubuntu 16.04 / 17.10 and 18.04/20.04 LTS

sudo /etc/init.d/mysql stop

sudo mkdir /var/run/mysqld/

sudo chown mysql /var/run/mysqld/

sudo mysqld_safe --skip-grant-tables &


You may promnt something like this… you may have to press the Enter keykoha@ubuntu:~mysqld_safe Logging to syslog.

2017-12-25T16:49:30.554646Z mysqld_safe Logging to '/var/log/mysql/error.log'.

2017-12-25T16:49:30.578079Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

2017-12-25T16:49:32.568746Z mysqld_safe mysqld from pid file /var/run/mysqld/ ended

[1]+  Done                    sudo mysqld_safe --skip-grant-tables


sudo mysql -u root

use mysql;

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

update user set authentication_string=PASSWORD("Newpassword")

where User='root';

flush privileges;
sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start
Take Koha backup
Access mysql -h -P 3306 -u root -p
Backup of Koha_library
mysqldump -u root -p koha_library > koha_library.sql

Installing Tomcat

cd /opt &&  sudo wget sudo tar xvzf a...