Installing on RedHat and CentOS (Manual)
If you decide to install Redhat, consider that you should have a licensed Redhat version. Otherwise, the repositories for installing software are locked.
It does not have much sense to install Redhat without a license subscription in the same direction and enable CentOS repos in a Redhat; if this is your way, better install CentOS at the beginning.
Preliminaries
Check disk size
$ df -h
Create a user named openkm
$ sudo adduser openkm
You can quickly generate random passwords at https://www.random.org/passwords.
Check server configuration
$ wget -Nc smxi.org/inxi
$ sudo chmod +x inxi
$ sudo ./inxi -F
If it doesn't work, try installing this package:
$ sudo yum install pciutils
Increase ulimit
$ sudo vim /etc/security/limits.conf
add the following lines to the end of the file (before the line # End of file)
* soft nofile 6084
* hard nofile 6084
Execute ulimit -n and see the open files limits are now updated.
Checking Java version
$ java -version
If 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-b04)
OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)
The Java version numeration name can be altered to be upgraded to a major version.
Install Java
Perform these steps only if Java 8 is not installed on your server.
$ sudo yum install java-1.8.0-openjdk-devel
The Java version may differ depending on your installed one, but we recommend the latest 1.8 release.
Set OpenJDK 1.8 as your default Java version
Perform this only if Java 8 is not your default Java version.
$ alternatives --config java
Installing database
Install MySQL if you do not have it already installed:
$ sudo yum install mysql-server mysql
Configure it as a service:
$ sudo chkconfig --levels 235 mysqld on
On the latest Centos, MariaDB has replaced the MySQL package in the repositories.
Install MariaDB:
$ sudo yum install mariadb-server
Configure as service:
$ sudo systemctl enable mariadb
If you get some trouble on the first database startup because it can not create files into the tmp folder, do the following:
Edit the /etc/selinux/config file:
$ sudo vim /etc/selinux/config
And apply this change to:
'SELINUX=disabled'
To take effect immediately, execute from the command line:
$ sudo setenforce 0
Change MySQL root password
Do it only If it's necessary to change the MySQL root password.
Method 1
$ /usr/bin/mysqladmin -u root -h localhost password 'password.'
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;
In this case, MySQL has not been started as a service, and the process must be killed to stop MySQL and start it again as a service.
Method 3
$ mysql
> UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
> flush privileges;
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;
In this case, MySQL has not been started as a service, and the process must be killed to stop MySQL and start it again as a service.
More information at MySQL: Reseting permissions.
Check InnoDB is the default MySQL engine
$ mysql -h localhost -u root -p
> show engines;
It should show something like this:
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
If it is not default, modify /etc/mysql/my.cnf
$ vim /etc/mysql/my.cnf
and under [mysqld], add
default-storage-engine = innodb
After changing the default MySQL engine, the MySQL service must be restarted to take effect.
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 OpenKM and Tomcat bundle
$ cd /home/openkm
$ unzip openkm-6.3.2-community-tomcat-bundle.zip
The tomcat version numeration name can be altered to be upgraded to a major version.
Configuring Tomcat as a service
For security reasons, you shouldn't run Tomcat as root. It is better to use the user named openkm.
Create a file with the script:
$ sudo vim /etc/init.d/Tomcat
#!/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/echo
TEST=/usr/bin/test
TOMCAT_USER=openkm
TOMCAT_HOME=/home/openkm/tomcat
TOMCAT_START_SCRIPT=$TOMCAT_HOME/bin/startup.sh
TOMCAT_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 1
esac
exit 0
The script must be changed if you use another user to start the service or your $TOMCAT_HOME is not /home/openkm/tomcat
Make it executable:
$ sudo chmod 755 /etc/init.d/Tomcat
Update the run-levels:
$ sudo chkconfig tomcat --level 2345 on
Check the service
Start the service:
$ sudo service tomcat start
Stop the service:
$ sudo service tomcat stop
Installing third-party software
Software | Required | Description |
---|---|---|
OpenOffice or LibreOffice |
Yes |
Check these packages are present:
Execute this command line to check the installed packages: $ rpm -qa | grep openoffice Take the names of the packages as an orientation. If a headless package is not installed, OpenKM cannot start the soffice service. |
Tesseract |
No |
Some useful links: |
ClamAV |
No |
Some useful links: |
Imagemagick |
Yes |
$ yum install ImageMagick |
GhostScript |
Yes |
$ yum install ghostscript |
Htop |
no |
Download from http://pkgs.repoforge.org/htop/ $ rpm -ivH htop-1.0.3-1.el6.rf.x86_64.rpm |
Start application
Check OpenKM.cfg parameters
$ vim /home/openkm/tomcat/OpenKM.cfg
Your configuration should be something like this:
# OpenKM Hibernate configuration values
hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
hibernate.hbm2ddl=create
Ensure hibernate.dialect=org.hibernate.dialect.MySQL5Dialect is enabled if your database is MySQL
First-time application start:
$ service tomcat start
To check if the startup process can execute the command:
$ tail -f /home/openkm/tomcat/log/catalina.log
When 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 ms
The application will be accessible at http://YOUR_IP:8080/OpenKM by user:okmAdmin with password: admin. ( Do not forget to change it !). For more information, please check: Manage users and roles.
Configure the default extensions:
Go to Administration > 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');
Linux Oracle 7. X Troubleshooting
The libreoffice and tesseract tools are not in the default repositories; you can follow the steps described in the URL below to install them:
Install libreoffice from RPM
You should download the last RPM file version, which might be found at https://www.libreoffice.org/download/download/?type=rpm-x86&version=6.0.4&lang=en
The process described below has been described at https://www.tecmint.com/install-libreoffice-on-rhel-centos-fedora-debian-ubuntu-linux-mint/
Libreoffice at the end will be installed into the folder /opt/libreoffice6.0
$ yum remove openoffice* libreoffice*
$ cd /opt
$ wget https://www.libreoffice.org/donate/dl/rpm-x86_64/6.0.4/es/LibreOffice_6.0.4_Linux_x86-64_rpm.tar.gz
$ tar -xvf LibreOffice_6.0.4_Linux_x86-64_rpm.tar.gz
$ cd LibreOffice_6.0.4_Linux_x86-64_rpm/RPMS
$ yum localinstall *.rpm
Install Tesseract
The script below has been found at https://github.com/EisenVault/install-tesseract-redhat-centos/. We suggest looking at the last version of the script in the GitHub project for updates.
Before executing the script, review it, and consider applying changes about downloading the dictionaries you need; for example, the Spanish dictionary should be downloaded at https://github.com/tesseract-ocr/tessdata/raw/3.04.00/spa.traineddata. What is not present in the script by default?
#!/bin/sh
cd /opt
yum -y update
yum -y install libstdc++ autoconf automake libtool autoconf-archive pkg-config gcc gcc-c++ make libjpeg-devel libpng-devel libtiff-devel zlib-devel
#Install AutoConf-Archive
wget ftp://mirror.switch.ch/pool/4/mirror/epel/7/ppc64/a/autoconf-archive-2016.09.16-1.el7.noarch.rpm
rpm -i autoconf-archive-2016.09.16-1.el7.noarch.rpm
#Install Leptonica from Source
wget http://www.leptonica.com/source/leptonica-1.75.3.tar.gz
tar -zxvf leptonica-1.75.3.tar.gz
cd leptonica-1.75.3
./autobuild
./configure
make
make install
cd ..
#!/bin/sh
#Install Tesseract from Source
wget https://github.com/tesseract-ocr/tesseract/archive/3.05.01.tar.gz
tar -zxvf 3.05.01.tar.gz
cd tesseract-3.05.01
./autogen.sh
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig LIBLEPT_HEADERSDIR=/usr/local/include ./configure --with-extra-includes=/usr/local/include --with-extra-libraries=/usr/local/lib
LDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include" make
make install
ldconfig
cd ..
#Download and install tesseract language files
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/ben.traineddata
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/eng.traineddata
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.traineddata
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/tha.traineddata
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/osd.traineddata
mv *.traineddata /usr/local/share/tessdata
#Download Hindi Cube data
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.cube.bigrams
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.cube.fold
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.cube.lm
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.cube.nn
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.cube.params
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.cube.word-freq
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/hin.tesseract_cube.nn
mv hin.* /usr/local/share/tessdata
ln -s /opt/tesseract-3.05.01 /opt/tesseract-latest
Other standard additional setup configurations
OpenKM comes with a lot of configuration parameters. We suggest taking a look at Recommended configuration parameters.
- Configuring Apache HTTP Reverse-Proxy
- Configuring mail
- Configuring Tomcat memory utilization
- Configuring Tomcat port
- Configuring Tomcat SSL/TLS
- Configuring Tomcat timezone
Restart installation from scratch
The OpenKM first startup does some background configurations like filesystem folder creation and changes in the OpenKM.cfg that only happen during the first startup.
Sometimes there may be some mistake in OpenKM configuration, such as a wrong database connection or similar issues during the first startup, which raises an application failure. To restart the installation from scratch, we suggest following the next steps.
- Ensure OpenKM is stopped.
- Edit the OpenKM.cfg and set the parameter to hibernate.hbm2ddl=create
- In case issue with the database connection, we suggest checking the link from the OpenKM server. Remember, some databases require enabling the user to gain connection from a server ( specific IP, range of IP, any server ).
- Delete the folder named "repository."
- Start OpenKM.