Home > Java, Ubuntu > Setting up an OrientDB server on Ubuntu

Setting up an OrientDB server on Ubuntu

January 19th, 2013 Leave a comment Go to comments

Go to the directory you want to install OrientDB.

cd /opt

Download one of the two flavors of OrientDB (standard or graph edition). (If you don’t know which to take, pick the Graph Ed.)

sudo wget https://s3.amazonaws.com/orientdb/releases/orientdb-1.3.0.tar.gz
#sudo wget https://s3.amazonaws.com/orientdb/releases/orientdb-graphed-1.3.0.tar.gz

Unpack the file

sudo tar -zxvf orientdb-1.3.0.tar.gz

I usually remove the tar.gz file and add a symlink

sudo rm orientdb-1.3.0.tar.gz
sudo ln -s orientdb-1.3.0/ orientdb

Configure the default orientdb password. (I use vi, you use your own favorite editor ;))

sudo vi orientdb/config/orientdb-server-config.xml

Go to the section [orient-server > storages > storage] in the xml, change the default username and password and save the file

<!-- Default in-memory storage. Data are not saved permanently. -->
<storage path="memory:temp" name="temp" userName="yourUsername" userPassword="yourPassword" loaded-at-startup="true" />

Get the root password for later use or/and add your own preferred account in [orient-server > users]:
(I prefer to remove the root account and add a new one)

<user name="yourUsername" password="yourPassword" resources="*"/>

As the file is holding passwords it might be a good idea to remove the read permission for other users.

sudo chmod 640 /opt/orientdb/config/orientdb-server-config.xml

Create a user that will run the server:

# -d, --home-dir HOME_DIR       home directory of the new account
# -M, --no-create-home          do not create the user's home directory
# -r, --system                  create a system account
# -s, --shell SHELL             login shell of the new account (/bin/false =  no login)
# -U, --user-group              create a group with the same name as the user
sudo useradd -d /opt/orientdb -M -r -s /bin/false -U orientdb

Change ownership of orientdb directory/links:

sudo chown -R orientdb.orientdb orientdb*

Modify the user group rights so that users in the orientdb group can invoke shell scripts.

sudo chmod 775 /opt/orientdb/bin
sudo chmod g+x /opt/orientdb/bin/*.sh
sudo usermod -a -G orientdb yourUsername

Copy the init.d script:

sudo cp orientdb/bin/orientdb.sh /etc/init.d/

Update the init.d script with this sed script or just edit the file. (The copied one)

sudo sed -i "s|YOUR_ORIENTDB_INSTALLATION_PATH|/opt/orientdb|;s|USER_YOU_WANT_ORIENTDB_RUN_WITH|orientdb|" /etc/init.d/orientdb.sh

And change the following lines, we use sudo because our system account does not have a login shell.

# You have to SET the OrientDB installation directory here (if not already done so)
ORIENTDB_DIR="/opt/orientdb"
ORIENTDB_USER="orientdb"
 
#su -c "cd \"$ORIENTDB_DIR/bin\"; /usr/bin/nohup ./server.sh 1>../log/orientdb.log 2>../log/orientdb.err &" - $ORIENTDB_USER
sudo -u $ORIENTDB_USER sh -c "cd \"$ORIENTDB_DIR/bin\"; /usr/bin/nohup ./server.sh 1>../log/orientdb.log 2>../log/orientdb.err &"
 
#su -c "cd \"$ORIENTDB_DIR/bin\"; /usr/bin/nohup ./shutdown.sh 1>>../log/orientdb.log 2>>../log/orientdb.err &" - $ORIENTDB_USER
sudo -u $ORIENTDB_USER sh -c "cd \"$ORIENTDB_DIR/bin\"; /usr/bin/nohup ./shutdown.sh 1>>../log/orientdb.log 2>>../log/orientdb.err &"

Update the rc.d dirs

cd /etc/init.d
sudo update-rc.d orientdb.sh defaults

The server will now start and stop on startup/shutdown. For now we start it by hand.

sudo /etc/init.d/orientdb.sh start

Verify that it is running by opening the studio (e.g. http://localhost:2480/) or run ‘sudo /etc/init.d/orientdb.sh status’.

Now we can log in and create a new database,
Start the console:

/opt/orientdb/bin/console.sh

Create a new database:

create database remote:/yourDatabaseName yourUsername yourPassword local

Done. Grab a beer, you’ve earned it. 😉

  1. brechanbech
    February 4th, 2013 at 05:29 | #1

    Really good set of instructions, no problem following them even for a noob like myself.

    Only one problem: sudo g+x doesn’t work! Is there a bit of text missing here?

  2. brechanbech
    February 4th, 2013 at 06:15 | #2

    OK, just realized it’s a chmod

  3. February 4th, 2013 at 08:51 | #3

    Ah yes, chmod was missing. I added it to the post. Tnx for your feedback.

  4. Okihara
    June 20th, 2013 at 14:23 | #4

    Oh boy, the sudo instead of su got me going crazy! Many thanks!

  5. yprez
    July 2nd, 2013 at 15:21 | #5

    Running the init.d script and nothing happens…
    After half an hour of debugging I realized that /opt/orientdb/bin/server.sh simply wasn’t executable…

    So:
    sudo chmod g+x /opt/orientdb/bin/*.sh
    Is needed in any case.

    I need that beer.

  6. July 3rd, 2013 at 09:27 | #6

    Modified the post a bit to take that into account. Thank you.

  7. HL
    September 5th, 2014 at 14:46 | #7

    in orientdb-community-1.7.8, running console.sh results in what looks like an infinite loop of line breaks on the orientdb prompt. was it something i did (all the other instructions went fine)?

  8. Pluto
    September 6th, 2014 at 13:10 | #8

    HL, look for authorizations: I had the same issue some hours ago and I resolved changing with chmod: I don” remember exactly what but it was or config, or bin, or log that couldn’t be readen

  9. March 12th, 2015 at 10:22 | #9

    Hello! Try to start the console as the “orientdb” user: sudo -u orientdb /opt/orientdb/bin/console.sh
    Worked like a charm 🙂

  10. jeff68
    October 12th, 2015 at 22:17 | #10

    Nice tutorial, but it doesn’t seem to work for the latest version – v2.1.3.

    In the user and storage tag, what username and password should be used? Is it the same as the login name or the system user that was created?

  11. October 13th, 2015 at 08:15 | #11

    The user tag can be different from the system user that is used to run the service. I will have a look at v2.1.3 to see where the current content needs an update.

  12. Vck
    November 10th, 2015 at 00:42 | #12

    Hi
    the last step output an error :
    sudo update-rc.d orientdb.sh defaults
    update-rc.d: warning: /etc/init.d/orientdb.sh missing LSB information
    update-rc.d: see
    System start/stop links for /etc/init.d/orientdb.sh already exist.

    sudo /etc/init.d/orientdb.sh start
    Starting OrientDB server daemon…
    sudo /etc/init.d/orientdb.sh status
    OrientDB server daemon is NOT running

    Thanks for this tuto

  13. Vck
    November 10th, 2015 at 12:33 | #13

    @Vck
    OrientDB server daemon is NOT running : nothing todo with LSB.
    You should write “sudo nano /etc/init.d/orientdb.sh” just after “And change the following lines, …”
    Silly i am :-/
    Thanks for this tuto

  1. January 26th, 2015 at 05:16 | #1

Time limit is exhausted. Please reload CAPTCHA.