Quantcast
Channel: LinOxide
Viewing all articles
Browse latest Browse all 1287

How to Install and Use ArangoDB on Ubuntu 14.04 / 15.04

$
0
0

A database is more than just a place to store data. In today’s article we will make you learn about the basic to advance concepts of ArangoDB which is a multi-purpose open-source database with a flexible data model for documents, graphs, and key-values. Though it has its many features with Multi Model database support, extendable through Java Script, high performance and space efficiency, more over its easy to use with its graphical user interface. We can use ArangoDB  as a database or as a combined database/application server because it can answer random HTTP requests directly. Let’s take a review at its major features before we start its installation and configurations.

Why ArangoDB

  • Easy to install and configure
  • Integrated Application Servers
  • Web based console and CLI commands
  • Easy Administration and System Monitoring
  • Multi Model Database Document, Graphs and Keys

ArangoDB Installation Setup

Now we will describe the steps to install ArangoDB under the Ubuntu 15.04 Operating system. So, first of all we will download the corresponding debian package from the official web link to Arangodb download page. After setting up its repository we will be able to install ArangoDB easily with debian package manager.

STEP 1: Adding repository key to Apt

Before the installation we need to add a particular repository key to apt according to our Operating system version.

For Ubuntu 15.04
Use following commands with root user or sudo privileges to get and add key.

root@ubuntu-15:~# wget https://www.arangodb.com/repositories/arangodb2/xUbuntu_15.04/Release.key
root@ubuntu-15:~# apt-key add - < Release.key root@ubuntu-15:~# echo 'deb https://www.arangodb.com/repositories/arangodb2/xUbuntu_15.04/ /' >> /etc/apt/sources.list.d/arangodb.list

For Ubuntu 14.04
Similar if you are using Ubuntu 14.04 you need to add following key wih root user.

root@ubuntu-14:~# wget https://www.arangodb.com/repositories/arangodb2/xUbuntu_14.10/Release.key
root@ubuntu-14:~# apt-key add - < Release.key root@ubuntu-14:~# echo 'deb https://www.arangodb.com/repositories/arangodb2/xUbuntu_14.10/ /' >> /etc/apt/sources.list.d/arangodb.list

STEP 2: Install ArangoDB

Now Update your system after adding key to apt and then start the installion with apt-get command.

For Ubuntu 15.04:

root@ubuntu-15:~# apt-get update
root@ubuntu-15:~# apt-get install arangodb=2.5.5

For Ubuntu 14.04:

root@ubuntu-14:~# apt-get update
root@ubuntu-14:~# apt-get install arangodb=2.5.5

STEP 3: Adding HTTPS Downloads Support

This is an optional package if we need to add the download support of HTTPS then we should install the following package.

root@ubuntu-15:~# apt-get install apt-transport-https

We had done with the basic installation packages now make sure that the ArangoDB service is running properly. We can check its status by following command.

root@ubuntu-15:~# systemctl status arangodb

Using ArangoDB Shell

ArangoDB shell is a command line administration of ArangoDB. We will use it to create new databases, users, collections and documents etc.

In next few we show you you can easily get fimilar with the ArangoDB Shell.

STEP 1: Open ArangoDB Shell

We can launch its shell by using following command.

root@ubuntu-15:~#arangosh

Arango Shell

STEP 2: ArangoDB Shell Help

We can get more detailed help of the command line administration of ArangoDB by using the following command.

arangosh [_system]> db._help();

Arangosh Help

STEP 3: Testing ArangoDB Shell Commands

With the help of arangoDb shell commands now we will create new database and user and check how it works with us.

Use following commands to create new database with its user and password:

arangosh [_system]> db._useDatabase('test')
true
arangosh [test]> require("org/arangodb/users").save("linux", "linux123");

ArangoDB User

ArangoDB Web Interface Setup

Before moving to Web interface, we need to setup its basic parameters and configurations to setup server's access point and authentication.

STEP 1: Testing ArangoDB HTTP API

Make sure that ArangoDB is up and running. this could be checked by executing the following curl command to get results from ArangoDB HTTP API.

root@ubuntu-15:~# curl http://localhost:8529/_api/version

{"server":"arango","version":"2.5.5"}

STEP 2: Configure ArangoDB Endpoints

Open the configurations file to mention your servers IP as below both in the arangod.conf and arangosh.conf file.

root@ubuntu-15:~# vi /etc/arangodb/arangod.conf

endpoint = tcp://172.25.10.179:8529

root@ubuntu-15:~# vi /etc/arangodb/arangosh.conf
[server]
endpoint = tcp://172.25.10.179:8529

STEP 3: Enable Authentication

Its a best practice to enable authentication of ArangoDB Web interface, by default it comes with disabled state. We can make it enable by changing its parameter from yes to no in its configuration file.

root@ubuntu-15:~# vi /etc/arangodb/arangod.conf
# disable authentication for the admin frontend
disable-authentication = no

After making changes to configuration file restart Arangodb Service.

root@ubuntu-15:~# systemctl restart arangodb.service

Using ArangoDB Web Interface

We are now ready to go with ArangoDB Web Interface, Open your web browser and access it with its configured end point server Ip and default port 8925.

http://172.25.10.179:8529

Arangodb Web

Managing Databases

Choosing from the top bar menu of Web Interface click on the drop down option to Manage DBs. Here we can see the previously created databases from the command line that we are now able to manage them from the web interface. Also we can switch to another database or we can delete or add new databases here.

Create New Database

We can add new database from the web interface as below by giving it a specific name, user and password.

Add Database

ArangoDB Collections and Documents

Collections in ArangoDB are just like the tables where we will create new documents to place and manage our music libraries, users bio data or our books library.

Adding New Collection

Click to add new collection and fill out its name and type to save changes.

Add Collection

Creating New Document

If we click on the newly created collection, you will be able to see that there is no document present there. We can create new document under the same collection by pointing "+" sign on the top right side.

Create Document

Adding Data to Document

After creating the document we will be able to see it under the contents. Now we will open up the document and put our relevant information to it. To do so click on the particular document and change editor mode from tree to Code to add data in it.

Change Editor

We can add JSON Objects to fill out information in the document as below.

{
"firstName": "Kashif",
"lastName": "Fareedi",
"address": {
"street": "Street of Happiness",
"city": "Heretown, The Earth"
},
"hobbies": [
"swimming",
"biking",
"programming"
]
}

Now after saving the code, once again switch editor mode from Code to Tree and see its out in human readable format.

Tree Output

Using Applications in ArangoDB

The fresh installation of ArangoDB comes with no application installed on it. We can install new applications from the web interface as well as from command line interface. We can install the applications under different mount paths and using different sources like Github, Store or from the Zipped package.

Adding New Application

From the Web interface we need to click on the Add Application and just mention its mount point and add other information as shown.

Add Application

Managing New Applications

After we had installed the new application , click on it to open its description and to update its features. Similarly we can add applications that can acts as data repository, and which can be used as backend for the development and for the production of so called single-page applications, or JavaScript applications.

Manage App

Using AQL Editor of ArangoDB

ArangoDB comes with AQL Editor that we can use for querying the data from the command line or by using its web interfac as its fully integrated with ArangoDB. From the AQL Editor we will be able to put queries and to get its results from the pre configured databases, collections and documents. So lets see how it works as below.

AQL Query Test

In order to test the EQL Editor we will submit a following query to check its results as below.

RETURN Linux_Books

AQL Query

AQL Query Result

After we had submitted the query on EQL Editor, Click on Results to check its output as below.

AQL Query Results

Using ArangoDB Tools

ArangoDB comes with its built in tools that provides the facility to use JS Shell, APIs and with Users and Query management. Using its User management tool we can easily create new users with its user information, password and other current status.

Similarly we will be able to use its other tools like JS Shell to quickly test snippets of JavaScript code without having to reload a web page.
JS Shell

CONCLUSION:

We had done with the Installation of ArangoDB 2.2.5 version's on Ubuntu 15.04 by using its command line as well as Web interface for the administration of its databases in its unique way. So, ArangoDB is one of the best database administration tool because of its many supporting features.We had just covered the main installation steps in it with the overview of its all functional parameters.There are still alot of things that ArangoDB facilitates with us to do.

The post How to Install and Use ArangoDB on Ubuntu 14.04 / 15.04 appeared first on LinOxide.


Viewing all articles
Browse latest Browse all 1287

Trending Articles