How to Install and Use ArangoDB on Ubuntu 16.04

Published on: Wed, Aug 30, 2017 at 11:26 am EST
Databases Linux Guides Server Apps Ubuntu

Introduction

ArangoDB is an open source NoSQL database with a flexible data model for documents, graphs, and key-values. It is a powerful database with a wide range of features that are needed for a modern web application. The database itself can be managed easily with the bundled web or command line interface.

In this tutorial, I will explain how to install and configure ArangoDB on Ubuntu 16.04.

Prerequisites

  • A newly deployed Vultr Ubuntu 16.04 server instance.
  • A non-root user with sudo privileges setup on your server.

Step 1: System update

Before starting, it is recommended to update your system to the latest stable version with the following commands:

apt-get update -y
apt-get upgrade -y

Next, restart the system to apply these changes.

Step 2: Install ArangoDB

By default, ArangoDB is not available in Ubuntu repository, so you will need to add the ArangoDB repository to your system. First, download the public key from the ArangoDB site with the following command:

wget https://www.arangodb.com/repositories/arangodb3/xUbuntu_16.04/Release.key

Next, add the downloaded key.

sudo apt-key add Release.key

Open the Apt sources list.

sudo nano /etc/apt/sources.list

Add the ArangoDB repository:

deb https://www.arangodb.com/repositories/arangodb3/xUbuntu_16.04/ /

Save the file and update your system with the following command:

sudo apt-get update -y

Next, install ArangoDB by running the following command:

sudo apt-get install arangodb3 -y

Once the installation is complete, start the arangodb3 service with the following command:

sudo systemctl start arangodb3

You can also check the status of ArangoDB with the following command:

sudo systemctl status arangodb3

You will see output similar to the following.

?? arangodb3.service - LSB: arangodb
   Loaded: loaded (/etc/init.d/arangodb3; bad; vendor preset: enabled)
   Active: active (running) since Sat 2017-07-29 20:55:26 IST; 11min ago
     Docs: man:systemd-sysv-generator(8)
   CGroup: /system.slice/arangodb3.service
       ??????4228 /usr/sbin/arangod --uid arangodb --gid arangodb --pid-file /var/run/arangodb/arangod.pid --temp.path /var/tmp/arangod --log.foregro
       ??????4229 /usr/sbin/arangod --uid arangodb --gid arangodb --pid-file /var/run/arangodb/arangod.pid --temp.path /var/tmp/arangod --log.foregro

Jul 29 20:55:21 localhost systemd[1]: Starting LSB: arangodb...
Jul 29 20:55:21 localhost arangodb3[4161]:  * Starting arango database server arangod
Jul 29 20:55:26 localhost arangodb3[4161]: {startup} starting up in daemon mode
Jul 29 20:55:26 localhost arangodb3[4161]:    ...done.
Jul 29 20:55:26 localhost systemd[1]: Started LSB: arangodb.
Jul 29 20:55:26 localhost arangodb3[4161]: changed working directory for child process to '/var/tmp'

Step 3: Access ArangoDB CLI

ArangoDB comes with a built-in arangosh command line utility to access the database. Start arangosh.

arangosh

When asked for a password, enter the root password. You should see the following output:

                                       _     
  __ _ _ __ __ _ _ __   __ _  ___  ___| |__  
 / _` | '__/ _` | '_ \ / _` |/ _ \/ __| '_ \ 
| (_| | | | (_| | | | | (_| | (_) \__ \ | | |
 \__,_|_|  \__,_|_| |_|\__, |\___/|___/_| |_|
                   |___/                 

arangosh (ArangoDB 3.0.12 [linux] 64bit, using VPack 0.1.30, ICU 54.1, V8 5.0.71.39, OpenSSL 1.0.2g-fips  1 Mar 2016)
Copyright (c) ArangoDB GmbH

Pretty printing values.
Connected to ArangoDB 'http+tcp://127.0.0.1:8529' version: 3.0.12 [server], database: '_system', username: 'root'

Please note that a new minor version '3.1.19' is available
Type 'tutorial' for a tutorial or 'help' to see common examples
127.0.0.1:8529@_system> 

You can create databases, users, and perform all administrative tasks using this utility.

Step 4: ArangoDB web interface

ArangoDB comes with a built-in web interface for performing various administrative tasks. Before starting, you will need to edit the ArangoDB configuration files arangod.conf and arangosh.conf:

sudo nano /etc/arangodb3/arangod.conf

Add your server's IP address as follows:

endpoint = tcp://192.168.0.227:8529

Once you are finished, open the other configuration file:

sudo nano /etc/arangodb3/arangosh.conf

Again, add your server's IP address.

endpoint = tcp://192.168.0.227:8529

Save the file and restart the ArangoDB service:

systemctl restart arangodb3

Step 5: Firewall update

By default, ArangoDB runs on port 8529, so you will need to allow this port through the firewall. You can do this by running the following command:

sudo ufw allow 8529/tcp

Once you are finished, it's time to access ArangoDB web interface.

Open your favorite web browser and type the URL http://192.168.0.227:8529. This will open up the login screen for the _system db. After entering your login credentials, you will see the ArangoDB splash screen. This concludes my tutorial.

Want to contribute ?

You could earn up to $300 by adding new articles