Saturday, December 28, 2024
Google search engine
HomeData Modelling & AIHow To Install ArangoDB on Ubuntu 20.04/18.04

How To Install ArangoDB on Ubuntu 20.04/18.04

Welcome to our guide on how to install ArangoDB on Ubuntu 20.04/18.04. ArangoDB is a multi-model, open-source database with flexible data models for graphs, documents, and key-values. It is designed for high-performance applications which use SQL-like query language or JavaScript extensions.

ArangoDB is ACID compliant and it is designed to scale horizontally with a few mouse clicks. On top of that, it also provides an internal API that is used to communicate with clients.

ArangoDB doesn’t support SQL as it comes with its own declarative language called AQL (ArangoDB Query Language). AQL is a single SQL-like query language for all data models of the database.

Key features of ArangoDB

  • It is fully open source and released under Apache 2.0 License.
  • Has a flexible data modeling which allows you to model your data as combination of key-value pairs, documents or graphs – perfect for social relations
  • Comes with a Powerful query language (AQL) for modifying and retrieving data.
  • You can run queries on multiple documents or collections with optional transactional consistency and isolation
  • Support for Replication and Sharding: You can set up the database in a master-slave configuration or spread bigger datasets across multiple servers
  • You can use ArangoDB as an application server and fuse your application and database together for maximal throughput.
  • Good storage for performance and data durability through its support for modern storage hardware, like SSD and large caches.
  • ArangoDB can be easily deployed as a fault-tolerant distributed state machine, which can serve as the animal brain of distributed appliances

Install ArangoDB on Ubuntu 20.04/18.04

The process of installing ArangoDB on Ubuntu 20.04/18.04 is straightforward. This guide will demonstrate a single instance installation of ArangoDB but you can also do:

  • Master/Slave installation
  • Active Failover setup
  • Cluster installation
  • Multiple Datacenters & Standalone Agency setup

The packages are readily available on an Apt repository. The only manual work required is adding the apt repository to your system using the commands below.

Step 1: Add ArangoDB Apt repository

Run the following command to add an apt repository to your system.

echo 'deb https://download.arangodb.com/arangodb34/DEBIAN/ /' | sudo tee /etc/apt/sources.list.d/arangodb.list

Step 2: Import repository key

The next step is to import GPG key used for signing the packages.

wget -q https://download.arangodb.com/arangodb34/DEBIAN/Release.key -O- | sudo apt-key add - 

You should see the “OK” message as the output.

Step 3: Update system and install ArangoDB

Update your Apt package cache then install ArangoDB on Ubuntu 18.04.

sudo apt update
sudo apt -y install apt-transport-https
sudo apt -y install arangodb3

You will be required to answer a couple questions during installation.

1. Set DB root password

install arangodb ubuntu 18.04 01

Enter the password and confirm it.

install arangodb ubuntu 18.04 02
install arangodb ubuntu 18.04 03

2. Select if to automatically upgrade database files.

install arangodb ubuntu 18.04 04
install arangodb ubuntu 18.04 05

3. Choose the database storage engine to use.

install arangodb ubuntu 18.04 06
install arangodb ubuntu 18.04 07

4. Set to backup database before doing an upgrade.

install arangodb ubuntu 18.04 08 1
install arangodb ubuntu 18.04 09 1

Wait for the installation to finish then proceed to step 3 where you’ll start and manage ArangoDB service with systemd.

If you had miss to set root password during installation, you can secure ArangoDB after installation by running:

sudo arango-secure-installation

Step 4: Start ArangoDB service

The service should be automaticaly started upon installation. If it is not started, you can manually start it using systemctl service management command.

sudo systemctl start arangodb3
sudo systemctl enable arangodb3

Check service with below command.

$ systemctl status arangodb3
● arangodb3.service - ArangoDB database server
     Loaded: loaded (/lib/systemd/system/arangodb3.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2020-05-02 22:39:24 UTC; 1min 14s ago
   Main PID: 29622 (arangod)
      Tasks: 18 (limit: 131072)
     Memory: 221.9M
     CGroup: /system.slice/arangodb3.service
             └─29622 /usr/sbin/arangod --uid arangodb --gid arangodb --pid-file /var/run/arangodb3/arangod.pid --temp.path /var/tmp/arangodb3 --log.for>

May 02 22:39:24 ubuntu20 arangod[29622]: 2020-05-02T22:39:24Z [29622] INFO detected operating system: Linux version 5.4.0-26-generic (buildd@lcy01-amd6>
May 02 22:39:24 ubuntu20 arangod[29622]: 2020-05-02T22:39:24Z [29622] WARNING {threads} --server.threads (64) is more than eight times the number of co>
May 02 22:39:25 ubuntu20 arangod[29622]: 2020-05-02T22:39:25Z [29622] INFO {authentication} Jwt secret not specified, generating...
May 02 22:39:25 ubuntu20 arangod[29622]: 2020-05-02T22:39:25Z [29622] INFO using storage engine rocksdb
May 02 22:39:25 ubuntu20 arangod[29622]: 2020-05-02T22:39:25Z [29622] INFO {cluster} Starting up with role SINGLE
May 02 22:39:25 ubuntu20 arangod[29622]: 2020-05-02T22:39:25Z [29622] INFO {syscall} file-descriptors (nofiles) hard limit is 131072, soft limit is 131>
May 02 22:39:25 ubuntu20 arangod[29622]: 2020-05-02T22:39:25Z [29622] INFO {authentication} Authentication is turned on (system only), authentication f>
May 02 22:39:25 ubuntu20 systemd[1]: /lib/systemd/system/arangodb3.service:28: PIDFile= references a path below legacy directory /var/run/, updating /v>
May 02 22:39:25 ubuntu20 arangod[29622]: 2020-05-02T22:39:25Z [29622] INFO using endpoint 'http+tcp://127.0.0.1:8529' for non-encrypted requests
May 02 22:39:26 ubuntu20 arangod[29622]: 2020-05-02T22:39:26Z [29622] INFO ArangoDB (version 3.4.9 [linux]) is ready for business. Have fun!

The status should return “running“.

Step 5: Launching ArangoDB shell on Ubuntu

To launch ArangoDB shell, run:

$ sudo arangosh
Please specify a password:

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

arangosh (ArangoDB 3.4.11 [linux] 64bit, using jemalloc, build tags/v3.4.11-0-gf077c18143, VPack 0.1.33, RocksDB 5.16.0, ICU 58.1, V8 5.7.492.77, OpenSSL 1.1.0l  10 Sep 2019)
Copyright (c) ArangoDB GmbH

Command-line history will be persisted when the shell is exited.
Could not connect to endpoint 'tcp://127.0.0.1:8529', database: '_system', username: 'root'
Error message: 'Unauthorized'

Please note that a new minor version '3.7.11' is available
127.0.0.1:8529@_system>

Create a test database.

127.0.0.1:8529@_system> db._createDatabase("testdb");
 true

Create database user and grant access to the database created above.

var users = require("@arangodb/users");
users.save("testuser@localhost", "dbuserpassword");
users.grantDatabase("testuser@example", "testdb");

Check complete user management guide for more information.

List databases.

127.0.0.1:8529@_system> db._databases()
[
"_system",
"testdb"
]

You can now connect to the test database using the user testuser@localhost.

# arangosh --server.username "testuser@localhost" --server.database testdb

Please specify a password: 
                                       _     
  __ _ _ __ __ _ _ __   __ _  ___  ___| |__  
 / _` | '__/ _` | '_ \ / _` |/ _ \/ __| '_ \ 
| (_| | | | (_| | | | | (_| | (_) \__ \ | | |
 \__,_|_|  \__,_|_| |_|\__, |\___/|___/_| |_|
                       |___/
arangosh (ArangoDB 3.4.2-1 [linux] 64bit, using jemalloc, build tags/v3.4.2.1-0-g91afc6501f, VPack 0.1.33, RocksDB 5.16.0, ICU 58.1, V8 5.7.492.77, OpenSSL 1.1.0j  20 Nov 2018)
 Copyright (c) ArangoDB GmbH
 Connected to ArangoDB 'http+tcp://127.0.0.1:8529' version: 3.4.2-1 [server], database: 'testdb', username: 'testuser@localhost'
 Type 'tutorial' for a tutorial or 'help' to see common examples
 127.0.0.1:8529@testdb> 

To drop the database, use:

127.0.0.1:8529@_system> db._dropDatabase("testdb");
 true

Step 6: Accessing ArangoDB Admin Web Interface

ArangoDB server comes with a built-in web interface for administration. It lets you manage databases, collections, documents, users, graphs, run and explain queries, see server stats and much more.

The service is set to listen on localhost address but it can be changed to listen on Local LAN IP.

Comment the line endpoint = tcp://127.0.0.1:8529 and add your network IP.

$ sudo vim /etc/arangodb3/arangod.conf
...
#endpoint = tcp://127.0.0.1:8529
endpoint = tcp://192.168.10.11:8529

Restart ArangoDB service after making this change.

sudo systemctl restart arangodb3

If you have UFW firewall enable, ensure port 8529 is allowed in the firewall.

sudo ufw allow proto tcp from any to any port 8529

Access the Admin dashboard on http://[serverip or localhost]:8529. By default, authentication is enabled.

install arangodb ubuntu 18.04 10

Provide username and password to authenticate as and select database to connect to on the next screen.

install arangodb ubuntu 18.04 11

The database management web interface should look similar to below.

install arangodb ubuntu 18.04 12

Next Steps

Visit the ArangoDB Documentation and Tutorials to learn more about it and how you can do integrations with your Applications. This cheat sheet may also come in handy.

Our next guide will cover ArangoDB Cluster setup on Ubuntu 18.04. Until then, check other Database related guides on our website.

RELATED ARTICLES

Most Popular

Recent Comments