How to Install OrientDB on Linux
OrientDB and Java
OrientDB offers many advantages to Java software developers including the ability to run their applications inside the same Java Virtual Machine (JVM) as OrientDB. As no ORM (object-relational mapping) layer exists between your POJO classes and OrientDB’s object schema, there is no impedance mismatch to drag down productivity.
The OrientDB Manual (in PDF Format)
The OrientDB manual guides you through the installation process. As OrientDB is written in JAVA, you can run OrientDB inside your app, or your app inside OrientDB. You can connect to it with HTTP, REST, API calls or with the ubiquitous database driver.
You can switch OrientDB to be an in-memory database. Great for developer sandboxes and you don’t need to run HSQL for unit tests and MySQL in production. You can run the same OrientDB schema in-memory in dev and then deploy to the same schema to production.
OrientDB Can Be NOSQL | EAV | Object | Graph | Document
OrientDB can be NOSQL or SQL. You can make it an object database, a graph database, an entity attribute value EAV or columnar database, or a JSON, XML or HTML document database. You can run it within the auspices of an IDE, a cluster, or provisioned from clouds such as Amazon’s AWS and Google’s Compute Engine.
Let’s install OrientDB and then visit its object.load(), object.save(), and object.update() features. There are 5 steps to perform in order to install OrientDB.
How to Install OrientDB on Linux
Use the below steps.
- Install Oracle’s Java 1.8 with
- Create an orientdb operating system user
- Download and Unpack the archive into orientdb home
- Start the Orient database server with
- Launch the OrientDB console with
1. Install the Oracle Java 8 Runtime
To install Oracle JRE 8 run this command and then update your local repository before running the
apt-get install command.
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-set-default
Once you have given the go-ahead again. You will see a line that includes the following text.
(3.53 MB/s) - ‘jdk-8u77-linux-x64.tar.gz’ saved
It is important to check that Java version 1.8 is running. To do this execute the simple java command.
The output saying that Java 1.8 has been installed on Ubuntu will be similar to this.
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
2. Create an orientdb operating system user
Best practice is to create an orientdb operating system user so that the database does not run as root.
sudo adduser orientdb
Don’t worry, orientdb has been built to run this way so creating an orientdb user helps you run into fewer problems down the line.
Verify by checking /home. Does an orientdb directory exist?
3. Download and Unpack the OrientDB Archive
Download OrientDB via your browser or use
wget to avoid moving files here there and everywhere. We unpack orientdb into a temporary location and then copy the contents into the newly created
wget -O orientdb-2.2.9.tar.gz https://orientdb.com/download.php?file=orientdb-community-2.2.9.tar.gz
sudo tar -xf download.php?file=orientdb-community-2.2.9.tar.gz -C /tmp
su - orientdb
cp -R /tmp/orientdb-community-2.2.9/* .(mind the dot)
All the file ownership and permissions are correct because we copied the files as the orientdb user. If you didn’t use the above commands then make sure you
chown the orientdb directory tree.
4. Start the Orientdb Database Server
Navigate to the home of OrientDB and fire it up.
OrientDB should now prompt for the database administrator’s password with a message like the one below.
+---------------------------------------------------------------+ | 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. | +---------------------------------------------------------------+
After the password look at the console output for a line like the one below. OrientDB uses port 2480 by default.
OrientDB Studio available at http://192.168.1.70:2480/studio/index.html [OServer]
Use the URL to verify that your OrientDB web service is operational.
But how do I login?
With your browser OrientDB will show you a database called GratefulDeadConcerts and prompt for a username and password.
In the username field type in “root”. Then use the password you entered when the server started up for the first time. This combination should give you access into the OrientDB Server admin area.
5. Start the Orientdb Console
Now that you can interact with the server process with a web browser, it is time to fire up the inimitable console and start interacting with OrientDB.
There is an unprecedented number of ways to communicate with OrientDB especially if you use Java. You can talk to it with RESTful web services, you can directly call its API classes and methods whilst running in the same JVM. You can access its API by adding dependent JARs. You can query OrientDB with a JDBC driver, you can manage it through its web console, and let’s not forget the (command line) console.
Well done – OrientDB is now running with Oracle’s fast and furious Java 8 runtime. Your OrientDB is lights out and away you go.
Next Steps – OrientDB in Production
The above steps are production quality – but you may want to consider more things when running OrientDB in a production environment. You may want to
- run orient behind an Apache web server proxy
- use Apache to front the RESTful web service requests
- connect to it via the SSL (https) protocol
- backup, replicate it and recover it
Even though many of the above services are provided by the cloud, at times clouds are not cost effective especially with non trivial data sizes and a need for mid to large computational resources.
Please drop us a comment letting us know if the install went well. Also make a request for a post on any aspect of OrientDB or indeed any other technology.