• OpenKM on QNAP via Docker

  • Problems with installing OpenKM? No problemo, the solution is closer than you think.
Problems with installing OpenKM? No problemo, the solution is closer than you think.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #54193  by amer1
Hi everyone,

I started using a DMS in 2009. I migrated to OpenKM in 2017. I had been running OpenKM on a VM with 4G of memory for the last 6 years. My VMWare ESXi server is getting old and I need to replace it.

I decided to go small footprint via a 2-bay NAS. I picked the QNAP TS-262 since it had an Intel processor and same amount of memory I always gave OpenKM. This was my first NAS. However, it is Linux based and I was confident enough with my Linux skills to make it work somehow.

It turned out to be a smooth process. So much so, I thought I would post my notes for others if needed. The following is what I did.

For a new or factory reset unit, I accessed the NAS via a web browser and started the "Smart Start Installation".

Once logged in, opening "Storage and Snapshots", the welcome wizard gives choices of "storage pool and thick/thin volume" or "static volume". A "static volume" is easier on memory, so I canceled the default wizard and clicked "New Volume" and picked "Traditional Configuration" and followed the wizard for RAID 1.

From "Control Panel"->"Privelege"->"Users", using "Advanced Settings"->"Home Folder", I enabled home folders for the new volume.

Via "Control Panel"->"Network and File Services"->"Telnet / SSH", I enabled SSH by checking "Allow SSH Connection"

I opened "App Center" and after the wizard I then used the search in upper right to find "mariadb".

I installed "MariaDB 5" and when ready, opened it and configured via wizard. I made note of the root password.

I searched for and installed "Container Station". When ready, I open it and configure via wizard.

Using my favorite SSH client, I connected to the QNAP using the ID I created during the "Smart Start Installation". I switched to admin/root account via:
Code: Select all
sudo -i
I selected "Q" and respond "Y" for command prompt.

I needed a home for the admin account, using command:
Code: Select all
mkdir $HOME
I configureed "MariaDB 5" using "vi". Hitting "i" for insert then to save and quit, hitting the esc key and typing ":wq":
Code: Select all
vi /etc/config/my.cnf
Found and edited the "default-storage-engine" to be:
Code: Select all
default-storage-engine = innodb
Found the "[client]" section and added the line:
Code: Select all
default-character-set = utf8
Found the "[mysqld]" section and added the lines:
Code: Select all
character-set-server = utf8
collation-server = utf8_general_ci
Saved the file and quit. Restarted MariaDB via:
Code: Select all
/etc/init.d/mariadb5.sh stop; /etc/init.d/mariadb5.sh start
Entered the MariaDB console via:
Code: Select all
DEF_VOL=$(/sbin/getcfg SHARE_DEF defVolMP -f /etc/config/def_share.info)
$DEF_VOL/.qpkg/MariaDB5/bin/mysql -h localhost -u root -p
Checked the DB engine via:
Code: Select all
show engines;
InnoDB should be default with all features as "YES".

Created the OpemKM database via:
Code: Select all
Created the openkm account. Edited the password in the following command. Note the network location because containers run in a different subnet.
Code: Select all
CREATE USER openkm@'10.0.%' IDENTIFIED BY 'MyPassword';
Granted the account full access to the DB and exited via:
Code: Select all
GRANT ALL ON okmdb.* TO openkm@'10.0.%' WITH GRANT OPTION;
Pulled down the latest OpenKM image via:
Code: Select all
$DEF_VOL/.qpkg/container-station/bin/docker pull openkm/openkm-ce:latest
Created a container that forwards the NAS port 1080 to the container's port 8080.
Code: Select all
$DEF_VOL/.qpkg/container-station/bin/docker create --name openkm-ce-1 -p 1080:8080 openkm/openkm-ce
Got the local OpenKM config files and made a backup copy.
Code: Select all
cd ~
$DEF_VOL/.qpkg/container-station/bin/docker cp openkm-ce-1:/opt/tomcat/OpenKM.cfg OpenKM.cfg 
$DEF_VOL/.qpkg/container-station/bin/docker cp openkm-ce-1:/opt/tomcat/conf/server.xml server.xml
mkdir originals
cp * originals
ls -l originals
Edited the config file and commented (via #) out H2 and un-commented MySQL5. Make sure the "hibernate.hbm2ddl" line says "create".
Code: Select all
vi OpenKM.cfg
Edited the server file and commented (via <!-- and ..>) out the H2 driver and un-commented the MySQL driver. Replace localhost with the name or ip address of the NAS and edit the password for openkm.
Code: Select all
vi server.xml
Copy the config files back to the container via:
Code: Select all
$DEF_VOL/.qpkg/container-station/bin/docker cp OpenKM.cfg openkm-ce-1:/opt/tomcat/OpenKM.cfg 
$DEF_VOL/.qpkg/container-station/bin/docker cp server.xml openkm-ce-1:/opt/tomcat/conf/server.xml 
Start the container:
Code: Select all
$DEF_VOL/.qpkg/container-station/bin/docker start openkm-ce-1
Kept the SSH session open should I needed to make any corrections. I returned to the web page.

I open "Container Station" and clicked "openkm-ce-1" to open it. I could see the console messages.

If no issues, I accessed OpenKM via:


Once working, I opened settings for the "openkm-ce-1" container and enabled "Auto Start".

I was done!

Backups can be performed by these commands (modifying path and password as needed):
Code: Select all
DEF_VOL=$(/sbin/getcfg SHARE_DEF defVolMP -f /etc/config/def_share.info)
$DEF_VOL/.qpkg/container-station/bin/docker stop openkm-ce-1
rm -r $OPENKMDEST/repository
$DEF_VOL/.qpkg/container-station/bin/docker cp openkm-ce-1:/opt/tomcat/repository $OPENKMDEST
$DEF_VOL/.qpkg/MariaDB5/bin/mysqldump -h localhost -u root --password='MyPassword' okmdb > $OPENKMDEST/okmdb.sql
$DEF_VOL/.qpkg/container-station/bin/docker start openkm-ce-1
If anyone has any ideas for improvements or additions, please comment.

I wish to thank the OpenKM team for all their work and dedication over the years.


About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.