Installing on Ubuntu and Debian (Manual)
Preliminaries
Section titled “Preliminaries”Check disk size
Section titled “Check disk size”$ df -hCreate a user named openkm
Section titled “Create a user named openkm”$ sudo adduser openkmCheck if partners’ channels are enabled
Section titled “Check if partners’ channels are enabled”$ cat /etc/apt/sources.listIf they are not enabled, please enable them.
$ sudo vim /etc/apt/sources.list$ sudo apt-get updateCheck server configuration
Section titled “Check server configuration”$ wget -Nc smxi.org/inxi$ sudo chmod +x inxi$ sudo ./inxi -FIncrease limit
Section titled “Increase limit”$ sudo vim /etc/pam.d/suUncomment the following line
#session required pam_limits.so
to
session required pam_limits.so
$ sudo vim /etc/security/limits.confAdd the following lines to the end of the file (before the line # End of file)
* soft nofile 6084
* hard nofile 6084
Checking Java version
Section titled “Checking Java version”$ java -versionIf Java is correctly installed on your computer, the name and version of the Java virtual machine are displayed:
openjdk version "1.8.0_212"OpenJDK Runtime Environment (build 1.8.0_212-8u212-b03-0ubuntu1.18.04.1-b03)OpenJDK 64-Bit Server VM (build 25.212-b03, mixed mode)Install Java
Section titled “Install Java”For Ubuntu
$ sudo apt-get update$ sudo apt-get install openjdk-8-jdkFor Debian
$ su -$ apt-get update$ apt-get install openjdk-8-jdk$ exitIn the case of Debian 10 “Buster,” Java 8 packages are not included in the default repositories. Hence, you may need to switch to SID (not recommended for production servers) or use the packages from https://adoptopenjdk.net/. Run these commands as root:
$ apt install wget gnupg software-properties-common$ wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | apt-key add -$ add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/$ apt-get update$ apt-get install adoptopenjdk-8-hotspotSet OpenJDK 1.8 as your default Java version.
Section titled “Set OpenJDK 1.8 as your default Java version.”$ sudo update-alternatives --config javaInstalling database
Section titled “Installing database”Install MySQL if you do not have it already installed:
$ sudo apt-get install mysql-serverWhen you install MySQL, the installer will ask you for a password for the root user. Keep this password handy.
You can also install MariaDB, which replaces MySQL in the latest versions:
$ sudo apt-get install mariadb-serverChange MySQL root password
Section titled “Change MySQL root password”Do this only if it’s necessary to change the MySQL root password.
Method 1
Section titled “Method 1”$ /usr/bin/mysqladmin -u root -h localhost password 'password.'Method 2
Section titled “Method 2”$ sudo /etc/init.d/mysql stop$ sudo mysqld --skip-grant-tables &$ mysql -u root MySQL> UPDATE user SET Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root';> FLUSH PRIVILEGES;> exit;Method 3
Section titled “Method 3”$ mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';> flush privileges;Method 4
Section titled “Method 4”$ sudo /etc/init.d/mysql stop$ mysqld_safe --skip-grant-tables &$ mysql -u root mysql> UPDATE user SET Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root';> FLUSH PRIVILEGES;> exit;More information at MySQL: Resetting permissions.
Check InnoDB is the default MySQL engine
Section titled “Check InnoDB is the default MySQL engine”$ mysql -h localhost -u root -p> show engines;If it is not default, modify /etc/mysql/my.cnf
$ vim /etc/mysql/my.cnfUnder [mysqld], add
default-storage-engine = innodb
Create database
Section titled “Create database”CREATE DATABASE okmdb DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_bin;CREATE USER openkm@localhost IDENTIFIED BY 'password';GRANT ALL ON okmdb.* TO openkm@localhost WITH GRANT OPTION;Installing Tomcat
Section titled “Installing Tomcat”$ cd /home/openkm$ unzip Tomcat-8.5.69.zipConfiguring Tomcat as a service
Section titled “Configuring Tomcat as a service”Create a file with the script:
$ sudo vim /etc/init.d/openkm#!/bin/sh
### BEGIN INIT INFO# Provides: tomcat# Required-Start: $remote_fs $syslog# Required-Stop: $remote_fs $syslog# Default-Start: 2 3 4 5# Default-Stop: 0 1 6# Short-Description: Start and stop Apache Tomcat# Description: Enable Apache Tomcat service provided by daemon.### END INIT INFO
ECHO=/bin/echoTEST=/usr/bin/testTOMCAT_USER=openkmTOMCAT_HOME=/home/openkm/tomcat-8.5.69TOMCAT_START_SCRIPT=$TOMCAT_HOME/bin/startup.shTOMCAT_STOP_SCRIPT=$TOMCAT_HOME/bin/shutdown.sh
$TEST -x $TOMCAT_START_SCRIPT || exit 0$TEST -x $TOMCAT_STOP_SCRIPT || exit 0
start() { $ECHO -n "Starting Tomcat" su - $TOMCAT_USER -c "$TOMCAT_START_SCRIPT &" $ECHO "."}
stop() { $ECHO -n "Stopping Tomcat" su - $TOMCAT_USER -c "$TOMCAT_STOP_SCRIPT 60 -force &" while [ "$(ps -fu $TOMCAT_USER | grep java | grep tomcat | wc -l)" -gt "0" ]; do sleep 5; $ECHO -n "." done $ECHO "."}
case "$1" in start) start ;; stop) stop ;; restart) stop sleep 30 start ;; *) $ECHO "Usage: tomcat {start|stop|restart}" exit 1esacexit 0Make it executable:
$ sudo chmod 755 /etc/init.d/openkmUpdate the run-levels:
$ sudo update-rc.d openkm defaultsCheck the service
Section titled “Check the service”Start the service:
$ sudo service openkm startStop the service:
$ sudo service openkm stopInstalling OpenKM
Section titled “Installing OpenKM”With Tomcat stopped, copy the openkm.war file into /home/openkm/tomcat-8.5.69/webapps
$ cp openkm.war /home/openkm/tomcat-8.5.69/webappsInstalling third-party software
Section titled “Installing third-party software”| Software | Required | Command |
|---|---|---|
| LibreOffice | Yes | bash<br>$ apt-get install libreoffice<br> |
| Tesseract | No | bash<br>$ apt-get install tesseract-ocr tesseract-ocr-eng<br>Depending on your locale, you may want to install another language file. |
| ClamAV | No | bash<br>$ apt-get install ClamAV<br> |
| ImageMagick | Yes | bash<br>$ apt-get install imagemagick<br> |
| Ghostscript | Yes | bash<br>$ apt-get install ghostscript<br> |
Start application
Section titled “Start application”Check openkm.properties parameters
Section titled “Check openkm.properties parameters”$ vim /home/openkm/tomcat-8.5.69/openkm.propertiesYour configuration should be something like this:
# OpenKM Hibernate configuration values
spring.jpa.properties.hibernate.dialect=com.openkm.db.dialect.MySQL5InnoDBDialect
spring.jpa.hibernate.ddl-auto=create-only
First-time application start:
$ service tomcat startTo see the startup process, execute the following command:
$ tail -f /home/openkm/tomcat-8.5.69/log/catalina.logWhen the application is started, you’ll see in the log file the lines:
2015-07-04 18:28:10,680 [main] INFO org.apache.coyote.http11.Http11Protocol - Starting ProtocolHandler ["http-bio-0.0.0.0-8080"]2015-07-04 18:28:10,688 [main] INFO org.apache.coyote.ajp.AjpProtocol - Starting ProtocolHandler ["ajp-bio-127.0.0.1-8009"]2015-07-04 18:28:10,692 [main] INFO org.apache.catalina.startup.Catalina - Server startup in 41456 msThe application will be accessible at http://YOUR_IP:8080/OpenKM using the user okmAdmin with password admin. (Do not forget to change it!) For more information about Manage users and roles.
Configure default extensions:
Go to Administration > Utilities > Database query and execute:
INSERT INTO OKM_EXTENSION (EXT_UUID, EXT_NAME) VALUES ('808e7a42-2e73-470c-ba23-e4c9d5c3a0f4', 'Live Edit');INSERT INTO OKM_EXTENSION (EXT_UUID, EXT_NAME) VALUES ('58392af6-2131-413b-b188-1851aa7b651c', 'HTML Editor 4');INSERT INTO OKM_PROFILE_MSC_EXTENSION (PEX_ID, PEX_EXTENSION) VALUES (1, '808e7a42-2e73-470c-ba23-e4c9d5c3a0f4');INSERT INTO OKM_PROFILE_MSC_EXTENSION (PEX_ID, PEX_EXTENSION) VALUES (1, '58392af6-2131-413b-b188-1851aa7b651c');Troubleshooting
Section titled “Troubleshooting”In the case of Debian 10, how to install Java:
Section titled “In the case of Debian 10, how to install Java:”$ apt-get install software-properties-common$ apt-add-repository 'deb http://security.debian.org/debian-security stretch/updates main'$ apt-get update$ apt-get install openjdk-8-jdkOther standard additional configurations
Section titled “Other standard additional configurations”OpenKM comes with a lot of configuration parameters. Please make sure to review: Recommended configuration parameters.