ArangoDB is a modern multi-model database system developed by ArangoDB GmbH. it’s a free and open-source database system that supports three different data models, documents, graphs, and key/values. ArangoDB is a flexible database system that provides high performance and ACID transactions, also its easy to scale vertically and horizontally.

ArangoDB provides a unified query language called AQL, which allows you to store your data in different data modules. The AQL is a declarative query language that allows the combination of different data access patterns in a single query.

In this tutorial, we will show you how to install and configure ArangoDB the multi-model database system on the Debian 11 server.

Prerequisites

  • A Linux server Debian 11.
  • A non-root user with sudo/root privileges.

Installing ArangoDB

By default, ArangoDB provides a binary package for the most popular Linux distribution such as Debian, Ubuntu, and CentOS. This allows developers and administrators easier to install the ArangoDB on their machines or servers.

Before installing ArangoDB, run the apt command below to install the gnupg2 package utility and the apt-transport-https for secure installation through HTTPS connections.

sudo apt install -y gnupg2 apt-transport-https

After installation is completed, download the GPG key of ArangoDB and add it to your Debian system.

curl -OL https://download.arangodb.com/arangodb39/DEBIAN/Release.key

sudo apt-key add - < Release.key

<img alt="add gpg key" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/05/echo/1-add-gpg-key-arangodb3.png62823ac59c0fa.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="173" loading="lazy" src="data:image/svg xml,” width=”750″>

Next, add the ArangoDB repository for the Debian system using the below command.

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

Update and refresh your Debian repository.

sudo apt update

In the below screenshot you will see the ArangoDB repository is added to the Debian system.

<img alt="add arangodb repository" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/05/echo/2-add-arangodb-repository.png62823ac5de8e8.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="226" loading="lazy" src="data:image/svg xml,” width=”750″>

Now install the ArangoDB package using the apt command below.

sudo apt install arangodb3 arangodb3-dbg

During the installation, you will be prompted to set up the root password for the ArangoDB. Input your password and select OK.

<img alt="setup root password" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/05/echo/4-setup-root-password-arangodb3.png62823ac61995c.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="186" loading="lazy" src="data:image/svg xml,” width=”750″>

Repeat your root password and select OK.

<img alt="repeat the root password" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/05/echo/5-repeat-root-password.png62823ac652b48.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="265" loading="lazy" src="data:image/svg xml,” width=”527″>

To automatically upgrade the database, select Yes to enable it.

<img alt="enable automatically upgrade" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/05/echo/6-enable-automatically-upgrade.png62823ac691732.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="125" loading="lazy" src="data:image/svg xml,” width=”750″>

Now you will be prompted to backup the old database data of ArangoDB, which will be stored based on the date in the /var/lib directory. Select Yes to backup the database.

<img alt="backup-database-before upgrade" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/05/echo/7-backup-database-before-upgrade.png62823ac6f20b0.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="103" loading="lazy" src="data:image/svg xml,” width=”750″>

The installation of ArangoDB will now be completed.

Next, start and enable the ArangoDB service using the below command.

sudo systemctl start arangodb3

sudo systemctl enable arangodb3

Lastly, verify the ArangoDb service using the command below.

sudo systemctl status arangodb3

As you can see from the below screenshot, the service arangodb3 is running and enabled. The arangodb3 service will automatically be started at system startup.

<img alt="verify arangodb3" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/05/echo/8-start-enable-arangodb3.png62823ac73a5cd.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="224" loading="lazy" src="data:image/svg xml,” width=”750″>Advertisement

Setup System Optimization for ArangoDB Deployment

For the ArangoDB deployment, you will need to optimize your system using some specific configuration, especially to get more performance of ArangoDB.

Now you will be creating a bash script that will automatically execute whenever the system is boot. This script will automatically optimize your Debian system for running ArangoDB.

First, install the sysfsutils package using the apt command below.

sudo apt install sysfsutils -y

After installation is completed, create a new bash script /etc/init.d/arangodb-os-optimization using nano editor.

sudo nano /etc/init.d/arangodb-os-optimization

Add the bash script below to the file.

#!/bin/bash

### BEGIN INIT INFO

# Provides: arangodb-memory-configuration

# Required-Start:

# Required-Stop:

# Default-Start: 2 3 4 5

# Default-Stop: 0 1 6

# Short-Description: Set arangodb kernel parameters

# Description: Set arangodb kernel parameters

### END INIT INFO

# 1 - Raise the vm map count value

sudo sysctl -w "vm.max_map_count=2048000"

# 2 - Disable Transparent Huge Pages

sudo bash -c "echo madvise > /sys/kernel/mm/transparent_hugepage/enabled"

sudo bash -c "echo madvise > /sys/kernel/mm/transparent_hugepage/defrag"

 

# 3 - Set the virtual memory accounting mode

sudo bash -c "echo 0 > /proc/sys/vm/overcommit_memory"

Save and close the file when you are done.

Now make the script executable by changing the permission to 755 or x using the below command.

sudo chmod  x /etc/init.d/arangodb-os-optimization

Lastly, add the script to run at boot using the below command.

sudo update-rc.d arangodb-os-optimization defaults

Now you have completed the ArangoDB installation and added an auto-optimize script for running ArangoDB.

<img alt="setup arangodb optimization script" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/05/echo/9-setup-arangodb3-script-optimization.png62823ac76fa28.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="167" loading="lazy" src="data:image/svg xml,” width=”707″>

Connect to ArangoDB and Create a Database and User

After completing the ArangoDB installation, you will now learn how to log in to the arangoDB using the ArangoDB shell named “arangosh” and create a new database and user for ArangoDB. The arangosh command line allows you to establish a connection to the ArangoDB, it is like the mysql command on MySQL, pgsql of PostgreSQL, or mongosh for MongoDB.

Run the below command to log in to the ArangoDB shell. If you did not specify the username, this will automatically connect based on your system. In this case, the user is the root.

sudo arangosh

Input the root password of ArangoDB. Once you are connected, you will see the following output. You can see on the following screenshot the detailed connection to the ArangoDb, which is connected as the root user to the default database _system and the ArangoDB server tcp://127.0.0.1:8529.

<img alt="login to arangodb arangosh shell" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/05/echo/10-login-to-arangodb-arangosh-shell.png62823ac7b3b35.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="264" loading="lazy" src="data:image/svg xml,” width=”750″>

To create a new user, you will need to load the user module. Run the following query to load the users module and create a new user testuser with the password testpassword.

const users = require('@arangodb/users');

users.save('testuser', 'testpassword');

Next, run the below queries to create a new database testdb and grant administrative access (rw – read and write) to the user testuser.

db._createDatabase('testdb');

users.grantDatabase('testuser', 'testdb', 'rw');

Type exit to log out from the ArangoDB shell or you can just press Ctrl c.

<img alt="create new database and user" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/05/echo/11-create-user-database-arangodb3.png62823ac7ef853.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="276" loading="lazy" src="data:image/svg xml,” width=”750″>

Lastly, to verify the test user and testdb database, run the following command to connect to the ArangoDB as user testuser to the database testdb.

sudo arangosh --server.endpoint tcp://127.0.0.1:8529 --server.username testuser --server.database testdb

Input the password for the testuser and you will see the following output.

In the below screenshot, you will see the detailed current connections to the ArangoDB, which is connected as the user testuser to the database testdb on the ArangoDB server tcp://127.0.0.1:8529.

<img alt="login to arangodb using new user" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/05/echo/12-login-to-arangodb3.png62823ac83aff7.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="181" loading="lazy" src="data:image/svg xml,” width=”750″>

Enable ArangoDB Web Administration Console

One of the main advantages of ArangoDB is that it provides a web-based administration console for managing your ArangoDB deployment. The default administration dashboard is running under the same port 8529 on the localhost or 127.0.0.1.

Now, if you are running the ArangoDB on a server, you will need to change the bind address to your server IP address so you can access the ArangoDB web administration console.

Edit the configuration /etc/arangodb3/arangod.conf using nano editor.

sudo nano /etc/arangodb3/arangod.conf

Change the default endpoint address from 127.0.01 to your server IP address. In this example, the server IP address is 192.168.5.20.

endpoint = tcp://192.168.5.20:8529

Save and close the file when you are done.

Now restart the ArangoDB service to apply new changes to your ArangoDB configuration.

sudo systemctl restart arangodb3

Verify the listening port and IP address on your server using the below command.

ss -plnt

As you can see on the following screenshot, the ArangoDB is now running on the server IP address 192.168.5.20 with default port 8529.

<img alt="enable arangodb web administration console" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/05/echo/13-enable-webconsole-arangodb3.png62823ac87776f.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="122" loading="lazy" src="data:image/svg xml,” width=”750″>

Next, turn on your web browser and visit the ArangoDB server IP address with port 8529.

http://192.168.5.20:8529/

You will see the ArangoDB login page below. Input your database user and password and click Login. This example uses the default root user of ArangoDB.

<img alt="login to arangodb" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/05/echo/14-login-arangodb3.png62823ac8b10c4.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="591" loading="lazy" src="data:image/svg xml,” width=”750″>

Select the database that you want to connect to and click the button Select DB: dbname.

<img alt="select the database to connect" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/05/echo/15-select-database.png62823ac8f2a61.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="539" loading="lazy" src="data:image/svg xml,” width=”750″>

Below you can see the ArangoDB administration dashboard.

<img alt="ArangoDB administration dfashboard" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/05/echo/16-arangodb-administration-dashboard.png62823ac952573.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="514" loading="lazy" src="data:image/svg xml,” width=”750″>

Next, click on the USERS menu on the left side and you will see the user testuser that you just created.

<img alt="ArangoDB list users" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/05/echo/17-arangodb3-list-users.png62823ac988822.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="354" loading="lazy" src="data:image/svg xml,” width=”750″>

Lastly, click on the DATABASE menu and you will see the testdb available on the ArangoDB.

<img alt="ArangoDB List databases" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/05/echo/18-arangodb3-list-databases.png62823ac9eaaee.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="409" loading="lazy" src="data:image/svg xml,” width=”657″>

Conclusion

Congratulations! You have now completed and learned how to install the ArangoDB on the Debian 11 server. You have also learned how to use the ArangoDB shell for creating a database and user. Lastly, you have also learned how to enable the ArangoDB web administration console for your deployment.