Backup and restore
Esta página aún no está disponible en tu idioma.
One of the most important things to have is an updated backup of your OpenKM.
If you have followed the installation instructions then you have configured OpenKM to use a production-safe database and optionally you have set a path the OpenKM repository data store.
In this case:
- First backup your database (make a SQL dump)
- Then backup your data on filesystem
Backup steps:
- Stop Tomcat (optional).
- Backup the database (mandatory).
- Backup the repository folder (mandatory).
- Start Tomcat (optional).
There is an alternative to traditional backup methods: you can export the whole repository from OpenKM Administration > Utilities > Repository export and choose metadata and history options. But we do not suggest this way of doing backups. For medium to large repositories we suggest some incremental backup solution.
Detailed steps
Section titled “Detailed steps”In case you have OpenKM configured with MySQL or MariaDB you can follow these steps to backup and restore. For other databases check its corresponding command.
Backup
Section titled “Backup”$ /etc/init.d/tomcat stop$ mysqldump -h localhost -u root -p okmdb > /path/to/openkm/okmdb.sql$ zip -r /path/to/backup/okm-backup.zip /path/to/openkm$ /etc/init.d/tomcat startAfter that, you will have a ZIP archive with the whole OpenKM installation and the exported database. Please, check before destroying the installation. We always recommend to restore the backup to ensure you have all the required files.
Restore
Section titled “Restore”Please, note that you have to create the database if wasn’t created previously. In case of MySQL or MariaDB install it:
$ sudo apt install mariadb-serverAnd execute the following sentences:
CREATE USER 'openkm'@'localhost' IDENTIFIED BY 's3cr3t0';CREATE DATABASE okmdb DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_bin;GRANT ALL ON okmdb.* TO 'openkm'@'localhost' WITH GRANT OPTION;Keep on mind that the user and database name may be different in you case. Please, take a look at the installation report or check it at $TOMCAT_HOME/conf/server.xml
Once created restore the database and files:
$ unzip /path/to/backup/okm-backup.zip -d /path/to/restore$ mysql -h localhost -u root -p okmdb < /path/to/restore/okmdb.sqlSet the permissions according to the user who start OpenKM:
$ sudo chown openkm:openkm /path/to/openkm -RInstall the required dependencies:
$ sudo apt install gawk imagemagick libreoffice tesseract-ocrOnce restored, verify file permissions, start OpenKM and make a repository check. See Repository checker.
Backup scripts
Section titled “Backup scripts”- Linux backup and restore with rdiff-backup tool
- Linux backup and restore with rsync
- Linux backup and restore with Duplicity
- Linux backup with LFTPLinux backup with LFTP