How to install OrientDB in Ubuntu

To install OrientDB in Ubuntu

OrientDB is a multi-platform, multi-model NoSQL database for managing databases. This is completely based on java programming language. Installation of OrientDB is explained in this manual.

Installation of JAVA

Start adding the repository that are required for the installation of OrientDB.

root@linuxhelp:~# add-apt-repository ppa:webupd8team/java 
 Oracle Java (JDK) Installer (automatically downloads and installs Oracle JDK7 / JDK8 / JDK9). There are no actual Java files in this PPA.

More info (and Ubuntu installation instructions):
- for Oracle Java 7: http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
- for Oracle Java 8: http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html
.
.
.
gpg: keyring `/tmp/tmpifrl02wk/secring.gpg'  created
gpg: keyring `/tmp/tmpifrl02wk/pubring.gpg'  created
gpg: requesting key EEA14886 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpifrl02wk/trustdb.gpg: trustdb created
gpg: key EEA14886: public key " Launchpad VLC"  imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK


Then update the repositories by using the following command.

root@linuxhelp:~# apt-get update 
Get:1 http://ppa.launchpad.net wily InRelease [15.5 kB]
Hit http://security.ubuntu.com wily-security InRelease                         
Hit http://in.archive.ubuntu.com wily InRelease                                
Hit http://in.archive.ubuntu.com wily-updates InRelease                                                  
Hit http://security.ubuntu.com wily-security/main Sources                                      
Get:2 http://ppa.launchpad.net wily/main amd64 Packages [3,394 B]                   
Hit http://in.archive.ubuntu.com wily-backports InRelease                                    
Hit http://security.ubuntu.com wily-security/restricted Sources                                
Get:3 http://ppa.launchpad.net wily/main i386 Packages [3,394 B]                    
Hit http://in.archive.ubuntu.com wily/main Sources
.
.
.
Hit http://in.archive.ubuntu.com wily-backports/multiverse Translation-en                                                                                                            
Hit http://in.archive.ubuntu.com wily-backports/restricted Translation-en                                                                                                            
Hit http://in.archive.ubuntu.com wily-backports/universe Translation-en                                                                                                              
Fetched 23.8 kB in 14s (1,608 B/s)                                                                                                                                                   
Reading package lists... Done


Once the update is completed, install the Java package using the below command.

root@linuxhelp:~# apt-get install oracle-java8-installer 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  gsfonts-x11 java-common
Suggested packages:
  default-jre equivs binfmt-support visualvm ttf-baekmuk ttf-unfonts ttf-unfonts-core ttf-kochi-gothic ttf-sazanami-gothic ttf-kochi-mincho ttf-sazanami-mincho ttf-arphic-uming
The following NEW packages will be installed:
  gsfonts-x11 java-common oracle-java8-installer
0 upgraded, 3 newly installed, 0 to remove and 252 not upgraded.
Need to get 163 kB of archives.
.
.
.
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/rmic to provide /usr/bin/rmic (rmic) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/schemagen to provide /usr/bin/schemagen (schemagen) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/serialver to provide /usr/bin/serialver (serialver) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/wsgen to provide /usr/bin/wsgen (wsgen) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/wsimport to provide /usr/bin/wsimport (wsimport) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-oracle/bin/xjc to provide /usr/bin/xjc (xjc) in auto mode
Oracle JDK 8 installed
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/lib/amd64/libnpjp2.so to provide /usr/lib/mozilla/plugins/libjavaplugin.so (mozilla-javaplugin.so) in auto mode
Oracle JRE 8 browser plugin installed
Setting up gsfonts-x11 (0.22) ...


Lets check the java version we have installed.

root@linuxhelp:~# java -version 
java version " 1.8.0_101" 
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)


Download the OrientDB package using wget command.

root@linuxhelp:~# wget https://orientdb.com/download.php?file=orientdb-community-2.1.3.tar.gz 
--2016-09-28 15:22:15--  https://orientdb.com/download.php?file=orientdb-community-2.1.3.tar.gz
Resolving orientdb.com (orientdb.com)... 104.18.54.241, 104.18.55.241, 2400:cb00:2048:1::6812:37f1, ...
Connecting to orientdb.com (orientdb.com)|104.18.54.241|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 28739549 (27M) [application/forced-download]
Saving to: ‘ download.php?file=orientdb-community-2.1.3.tar.gz’ 
download.php?file=orientdb-community-2.1.3. 100%[==========================================================================================> ]  27.41M  70.7KB/s   in 11m 37ss

2016-09-28 15:33:53 (40.3 KB/s) - ‘ download.php?file=orientdb-community-2.1.3.tar.gz’  saved [28739549/28739549]


Extract the downloaded package into the /opt directory.

root@linuxhelp:~# tar -xf download.php?file=orientdb-community-2.1.3.tar.gz -C /opt 


Rename the directory by running the following command.

root@linuxhelp:~# mv /opt/orientdb-community-2.1.3 /opt/orientdb 

To launch OrientDB

Next, move to the OrientDB directory and run the orientDB server with the following command.

root@linuxhelp:/opt/orientdb# bin/server.sh 
Root password [BLANK=auto generate it]: linuxhelp
You can enter your password, after that orientdb server will be started as you can see in the below output.
2016-09-28 15:36:23:774 INFO  Installing dynamic plugin ' studio-2.1.zip' ... [OServerPluginManager]
2016-09-28 15:36:23:900 INFO  Installing dynamic plugin ' orientdb-lucene-2.1.3-dist.jar' ... [OServerPluginManager]
2016-09-28 15:36:23:997 INFO  Lucene index plugin installed and active. Lucene version: LUCENE_47 [OLuceneIndexPlugin]
2016-09-28 15:36:24:010 INFO  Installing GREMLIN language v.2.6.0 - graph.pool.max=50 [OGraphServerHandler]
2016-09-28 15:36:24:012 INFO  [OVariableParser.resolveVariables] Error on resolving property: distributed [orientechnologies]
2016-09-28 15:36:24:014 INFO  Installing Script interpreter. WARN: authenticated clients can execute any kind of code into the server by using the following allowed languages: [sql] [OServerSideScriptInterpreter]
2016-09-28 15:36:24:022 INFO  OrientDB Server v2.1.3 (build UNKNOWN@r  2015-10-04 10:56:30+0000) is active. [OServer]


OrientDB will listen in port number 2424 for binary connections and 2480 for http connections. To confirm the listening for the connection use the below command.

root@linuxhelp:~# netstat -plunt | grep 2424 
tcp6       0      0 :::2424                 :::*                    LISTEN      4108/java       
root@linuxhelp:~# netstat -plunt | grep 2480 
tcp6       0      0 :::2480                 :::*                    LISTEN      4108/java


After running the OrinetDB server we can connect to the database using the below command.

root@linuxhelp:~# /opt/orientdb/bin/console.sh 
OrientDB console v.2.1.3 (build UNKNOWN@r  2015-10-04 10:56:30+0000) www.orientdb.com
Type ' help'  to display all the supported commands.
Installing extensions for GREMLIN language v.2.6.0

orientdb> 
Now we can connect the localhost using below command.

orientdb>  connect remote:127.0.0.1 root linuxhelp     

Connecting to remote Server instance [remote:127.0.0.1] with user ' root' ...OK
orientdb {server=remote:127.0.0.1/}> 
Tag : OrientDB
FAQ
Q
What are the commands used to backup in Orientdb?
A
By using this command you can run the backup script

./backup.sh []
Q
It is possible to connect multiple databases?
A
You can connect but not at the same time.
Q
Can I configure with out stopping the service?
A
That is not recommended. For efficient configuration you have to stop the service
Q
Do you have a alternate editor?
A
You can make use of Vim editor
Q
How to use the Stack Overflow on saving objects?
A
This could be due to the high deep of the graph, usually when you create many records. To fix it save the records more often.