CubeDrive Installation   ->   Install 3rd-party software

Install 3rd-party software



Java, MySQL, MongoDB, Tomcat, and Nginx third-party software are required to run CubeDrive.



1: JDK


Download and install JDK 8 from

http://download.oracle.com
install java-8
     sudo apt install openjdk-8-jdk
install supervisor
    sudo apt install supervisor
install wkhtmltopdf
    wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb
    sudo apt install ./wkhtmltox_0.12.6-1.focal_amd64.deb    
    

Please set JAVA_HOME in the Linux system. For example, add the following line in the file: /etc/profile.d/oracle_jdk.sh

JAVA_HOME=/usr/local/java
export JAVA_HOME
PATH=${JAVA_HOME}/bin:${PATH}:
export PATH 

Save the file, quit the editor, and run the commands below:

chmod 755 /etc/profile.d/oracle_jdk.sh
source /etc/profile

2: Database Server


MySQL is used as the CubeDrive database server. In general, MySQL can be pre-installed while installing the Linux system. If not, please go to:

http://dev.mysql.com/downloads/mysql/

You can download and install MySQL (version 5.7.*) in your Linux server.

docker run -d --name mysql-5.7 -v /data/mysql-5.7:/var/lib/mysql -p 172.31.25.240:3306:3306 -p 127.0.0.1:3306:3306 -e MYSQL_ROOT_PASSWORD="mysql-abc-2022" --restart=always mysql:5.7
    

Create Schema

After MySQL is installed successfully, please generate a schema for the CubeDrive:


     drop database cubedrive;
     create database cubedrive DEFAULT CHARACTER SET utf8;
     use cubedrive;    
    

Create table

Email us to get the MySQL tables and inject the SQL file into the above MySQL schema:

Database-cubedrive.sql
cat Database-cubedrive.sql | /usr/bin/mysql -u root --password=root -h localhost cubedrive  

Insert default data

Download the SQL files and inject the SQL file into the above MySQL schema:

Database-initialData.sql
cat Database-initialData.sql | /usr/bin/mysql -u root --password=root -h localhost cubedrive

(Option) Update cnf file

Add the variables below in /etc/my.cnf to set UTF-8 and support multiple languages.

[mysqld]
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake

If you have any issues when installing mysql database, please search Google online. CubeDrive does not have special requirements for the MySQL database server.


3: MongoDB


Download MongoDB from https://www.mongodb.com/try/download/community and select version 3.4.24

Install MongoDB
docker run -d --name  mongo-3.4 -v /data/mongo-3.4:/data/db -p 172.31.25.240:27017:27017 -p 127.0.0.1:27017:27017 -e MONGO_INITDB_ROOT_USERNAME="root" -e MONGO_INITDB_ROOT_PASSWORD="mongo-abc-2022"  --restart=always mongo:3.4.24 -auth

Start MongoDB:
mongo client: 
docker exec -it mongo-3.4 mongo
use cubedrive
db.auth("cubedrive","Roocae0k")
    

4: Tomcat


Download and install Tomcat 8 on your Linux system. Tomcat can also be pre-installed while installing the Linux system. Please check it first.

http://apache.sunsite.ualberta.ca/tomcat/tomcat-7/v7.0.65/bin/apache-tomcat-7.0.65.tar.gz
For example, you can put it under:
/opt/3rd-parts/cubedrive-server-1

Update server.xml

Edit file: /opt/3rd-parts/cubedrive-server-1/conf/server.xml

Enable

<Connector executor="tomcatThreadPool" port="8109" protocol="org.apache.coyote.http11.Http11AprProtocol" connectionTimeout="600000" redirectPort="8443" enableLookups="false" disableUploadTimeout="false" connectionUploadTimeout="36000000" URIEncoding="UTF-8"/>
<Connector executor="tomcatThreadPool" port="9109" protocol="org.apache.coyote.ajp.AjpAprProtocol" connectionTimeout="300000" keepAliveTimeout="300000" redirectPort="8443" acceptorThreadCount="5" acceptCount="500"/>

Disable

<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

Enlarge Tomcat memory

The default tomcat server memory is 256m which is not enough for the system. We need enlarge tomcat memory, go to:

/opt/3rd-parts/cubedrive-server-1/bin

Edit file (catalina.sh) by adding the following line after line: #!/bin/sh

JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms2548m -Xmx2548m -Xmn768m -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:+UseFastAccessorMethods -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/fzhuang/dump/sheet-server-1 -Dxr.load.xml-reader=org.ccil.cowan.tagsoup.Parser -XX:PermSize=192m -XX:MaxPermSize=192m"

Note: this line should be inserted at the top of the file: catalina.sh.

(Option) Add SSH

If you need add SSL, please get a ssl license first and update Tomcat

>$ cd /<tomcat_HOME>/conf
>$ vi server.xml
<Connector port="80"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true" />
<Connector port="443"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" debug="0" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" keystoreFile="/etc/tomcat6/keystore" keystorePass="changeit" />

5: Nginx


Nginx is a web server which can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. For more details, please visit: https://nginx.org/en/

Install redis-server


      
docker run --name redis-6 -d -v /data/redis-6:/data -p 172.31.25.240:6379:6379 -p 127.0.0.1:6379:6379 --restart=always redis:6-alpine --appendonly yes --requirepass "Nohw6uag"

6: URL


Please also have a domain name that can be bound to your Linux IP address. For example:

www.yourCompany.com/cubedrive

7: SSL


Please also have a SSL certificate for Nginx ready.

The SSL/TLS protocol uses a pair of keys - one private, one public - to authenticate, secure and manage secure connections. These keys are a linked pair of text files and are created together as a pair when you create your Certificate Signing Request (CSR).

SSL works by making one key of the pair (the public key) known to the outside world, while the other (the private key) remains a secret only you know.