In this article, We are going to perform How to Install OrientDB on Ubuntu 18.04/16.04 LTS or any other cloud platform like Amazon Ec2, Azure VM, Google Cloud Compute,etc. with preinstalled Ubuntu 18.04/16.04 LTS.
Table of Contents
Introduction
OrientDB is Open Source No SQL database management system.
Prerequisite
- Ubuntu 18.04/16.04 LTS with Minimal Installation
- SSH Access with sudo privileges
- Open Firewall Port: 2480
Step #1: Download and Install OrientDB on Ubuntu
Navigate to /tmp directory.
cd /tmp
Download the OrientDB setup. To download latest community version visit OrientDB official site.
wget https://s3.us-east-2.amazonaws.com/orientdb3/releases/3.0.4/orientdb-3.0.4.tar.gz
Output:
https://s3.us-east-2.amazonaws.com/orientdb3/releases/3.0.4/orientdb-3.0.4.tar.gz Resolving s3.us-east-2.amazonaws.com (s3.us-east-2.amazonaws.com)... 52.219.104.154 Connecting to s3.us-east-2.amazonaws.com (s3.us-east-2.amazonaws.com)|52.219.104.154|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 39038249 (37M) [application/x-gzip] Saving to: ‘orientdb-3.0.4.tar.gz’ orientdb-3.0.4.tar.gz 100%[===================================================================================>] 37.23M 71.9MB/s in 0.5s
Extract the Setup
tar xvf orientdb-3.0.4.tar.gz
Move Extracted setup to /opt/oriendb directory
sudo mv orientdb-3.0.4 /opt/orientdb
Create a user named “oriendb” with no shell access
sudo useradd -r orientdb -s /sbin/nologin
Give the ownership permission to oriendb user
sudo chown -R orientdb:orientdb /opt/orientdb/
Open the config script , replace user and DB config path as shown below
sudo nano /opt/orientdb/bin/orientdb.sh
From
ORIENTDB_DIR="" ORIENTDB_USER=""
Change to
ORIENTDB_DIR="/opt/orientdb" ORIENTDB_USER="orientdb"
Sample Output:
# chkconfig: 2345 20 80 # description: OrientDb init script # processname: orientdb.sh # You have to SET the OrientDB installation directory here ORIENTDB_DIR="/opt/orientdb" ORIENTDB_USER="orientdb" LOG_DIR="../log"
Navigate to /opt/orientdb/bin path
cd /opt/orientdb/bin
Run server.sh script
sudo ./server.sh
You should be prompted to create a root password and confirm password. Set a Password and continue.
Sample Output:
2021-05-24 06:53:34:988 INFO Listening http connections on 0.0.0.0:2480 (protocol v.10, socket=default) [OServerNetworkListener] +---------------------------------------------------------------+ | WARNING: FIRST RUN CONFIGURATION | +---------------------------------------------------------------+ | This is the first time the server is running. Please type a | | password of your choice for the 'root' user or leave it blank | | to auto-generate it. | | | | To avoid this message set the environment variable or JVM | | setting ORIENTDB_ROOT_PASSWORD to the root password to use. | +---------------------------------------------------------------+ Root password [BLANK=auto generate it]: ********* Please confirm the root password: ********* 2021-05-24 06:54:32:022 INFO Installing dynamic plugin 'orientdb-studio-3.0.4.zip'... [OServerPluginManager] 2021-05-24 06:54:32:031 INFO Installing dynamic plugin 'orientdb-teleporter-3.0.4.jar'... [OServerPluginManager] 2021-05-24 06:54:32:049 INFO Installing dynamic plugin 'orientdb-etl-3.0.4.jar'... [OServerPluginManager] 2021-05-24 06:54:32:065 INFO Installing dynamic plugin 'orientdb-neo4j-importer-plugin-3.0.4-dist.jar'... [OServerPluginManager] 2021-05-24 06:54:32:081 INFO ODefaultPasswordAuthenticator is active [ODefaultPasswordAuthenticator] 2021-05-24 06:54:32:082 INFO OServerConfigAuthenticator is active [OServerConfigAuthenticator] 2021-05-24 06:54:32:083 INFO OSystemUserAuthenticator is active [OSystemUserAuthenticator] 2021-05-24 06:54:32:085 INFO [OVariableParser.resolveVariables] Property not found: distributed [orientechnologies] 2021-05-24 06:54:32:105 WARNI Authenticated clients can execute any kind of code into the server by using the following allowed languages: [sql] [OServerSideScriptInterpreter] 2021-05-24 06:54:32:111 INFO OrientDB Studio available at http://172.20.41.112:2480/studio/index.html [OServer] 2021-05-24 06:54:32:113 INFO OrientDB Server is active v3.0.4 - Veloce (build 4578b51f72a55feaa0852bc8ddd52929011d956c, branch 3.0.x). [OServer]
Step #2: Create OrientDB Service
Stop the orientdb service by pressing CTRL+C, if you started using ./server.sh.
First, copy orientdb service file to /etc/systemd/system/ directory
sudo cp /opt/orientdb/bin/orientdb.service /etc/systemd/system/
Change as per below , orientdb service should look like below
# # Copyright (c) OrientDB LTD (http://http://orientdb.com/) # [Unit] Description=OrientDB Server After=network.target After=syslog.target [Install] WantedBy=multi-user.target [Service] User=orientdb Group=orientdb ExecStart=/opt/orientdb/bin/server.sh
Reload the daemon
sudo systemctl daemon-reload
Start the OrienDB Service
sudo systemctl start orientdb.service
Check the status
sudo systemctl status orientdb.service
Output:
. orientdb.service - OrientDB Server
Loaded: loaded (/etc/systemd/system/orientdb.service; disabled; vendor preset: enabled)
Active: active (running) since Thu 2020-02-06 07:26:38 UTC; 8s ago
Main PID: 72198 (java)
Tasks: 24
Memory: 159.5M
CPU: 4.046s
CGroup: /system.slice/orientdb.service
└─72198 java -server -Xms2G -Xmx2G -Djna.nosys=true -XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true -Dfile.encoding=UTF8 -Drhino.opt.level=9 -Djav
Step #3: Access OrientDB GUI Dashboard
Open your favorite browser and type localhost or IP with port number, Open the firewall/inbound port 2480 to access externally.
http://localhost:2480 OR http://IP:2480
Step #4: Login OrientDB using Command Line
Navigate to OrintDB config path
cd /opt/orientdb/bin
Run the console.sh
/opt/orientdb/bin$ ./console.sh
Output:
OrientDB console v.3.0.4 - Veloce (build 4578b51f72a55feaa0852bc8ddd52929011d956c, branch 3.0.x) https://www.orientdb.com Type 'help' to display all the supported commands.
Step #5: Creating User in OrientDB using Command Line
Navigate to OrientDB Config path.
cd /opt/orientdb/bin
Open a console
/opt/orientdb/bin$ ./console.sh
Login to OrientDB with root username and password
orientdb> connect remote:127.0.0.1/demodb root fosstechnix@123
Output:
Connecting to database [remote:127.0.0.1/demodb] with user 'root'...OK
Create a user named “dbadmin” and password “fosstechnix@2020”
orientdb {db=demodb}> CREATE USER dbadmin IDENTIFIED BY fosstechnix@2020 ROLE admin
Output:
User created successfully.
Troubleshooting:
The sum of the configured JVM maximum heap size (2075918336 bytes) and the OrientDB maximum cache size (268435456 bytes) is larger than the available physical memory size (com.orientechnologies.common.jna.ONative$MemoryLimitResult@4e2ce0d7 bytes). That may cause out of memory errors, please tune the configuration up. Use the -Xmx JVM option to lower the JVM maximum heap memory size or storage.diskCache.bufferSize OrientDB option to lower memory requirements of the cache.
Solution
Please find the below block in /opt/orientdb/bin/server.sh
. . .
# ORIENTDB memory options, default to 2GB of heap.
if [ -z "$ORIENTDB_OPTS_MEMORY" ] ; then
ORIENTDB_OPTS_MEMORY="-Xms2G -Xmx2G"
fi
. . .
Replace with below values which are minimum memory allocation.
# ORIENTDB memory options, default to 2GB of heap.
if [ -z "$ORIENTDB_OPTS_MEMORY" ] ; then
ORIENTDB_OPTS_MEMORY="-Xms128m -Xmx256m"
fi
Conclusion
In this article, We have covered How to Install OrientDB on Ubuntu 20.04/18.04 LTS.