Data

Install the NoSQL RavenDB Data System

14 May 2021 6:00am, by

Cloud native, container, mobile, big data, and web developers often depend on databases to extend the functionality of their applications. When that’s the case, chances are pretty good they turn to a NoSQL database. NoSQL systems are well-suited for workloads that require speed, agility, and scalability.

There are many NoSQL databases available, one of which is RavenDB. RavenDB was designed for the .NET platform and offers plenty of features to appeal to developers of all types of applications:

  • Supports multiple databases
  • Sharding
  • Advanced query language
  • High availability
  • Scaling
  • Can handle multi-document transactions

I’m going to walk you through the process of getting RavenDB up and running on Ubuntu Server 20.04.

The only things you’ll need for this are a running instance of Ubuntu Server 20.04 (which can either be on-premise or via cloud-hosted services, such as AWS, Azure, Google Cloud, Linode, or Rackspace) and a user with sudo privileges.

Once you have procured those items, you’re ready to install.

Installing the RavenDB Dependencies

RavenDB is a Microsoft product, which means you won’t find the software in the standard repository. Even one of the dependencies for RavenDB isn’t found in the standard repos. So before we install the RavenDB package, we first need to download an installer that will add the necessary MS repository for the dependencies. Once that repository has been added, you can the required packages.

Log into your Ubuntu Server instance and download the .deb file (for the installation of the repository) with the command:

wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

Install that package with the command:

sudo dpkg -i *.deb

Once the repository has been added, update apt with the command:

sudo apt-get update

After apt updates, install the necessary RavenDB dependencies with the command:

sudo apt-get install apt-transport-https aspnetcore-runtime-3.1 -y

Install and Configure RavenDB

Next, we need to download the required RavenDB file with the command:

wget -O ravendb.tar.bz2 https://hibernatingrhinos.com/downloads/RavenDB%20for%20Linux%20x64/latest

Unpack that file with the command:

tar xvjf ravendb.tar.bz2

You can either leave the newly-created RavenDB directory where it is or move it to another location. For this tutorial, we’ll leave it where it is.

Open the RavenDB configuration file with the command:

nano ~/RavenDB/Servers/settings.json

If your RavenDB directory is somewhere other than your home directory, make sure to edit the above path accordingly.

In that file, change the ServerURL line to match the IP address of your hosting server. That file should look like this:

Where SERVER is the IP address of your hosting server. Do note that we are enabling RavenDB to be used on a private network, without certificates. If you’ll be using RavenDB over a public network, that configuration file would look something like this:

Where PRIVATE is the private IP address of your server and PUBLIC is the public DNS URL for your cloud instance.

Save and close the file.

Next, we must create a systemd file for RavenDB. Create a new file with the command:

sudo nano /etc/systemd/system/ravendb.service

In that file, paste the following:

Where /PATH/TO is the path to the RavenDB folder and USER is the user that will start the RavenDB process (such as root).

Save and close the file. Reload the systemd daemon with the command:

sudo systemctl daemon-reload

Start and enable RavenDB with the following commands:

sudo systemctl start ravendb

sudo systemctl enable ravendb

Accessing the RavenDB Web Interface

Open a web browser and point it to http://SERVER:8080 (Where SERVER is either the IP address or domain of the hosting server). You should be greeted by the Raven EULA. Read or scroll through the license and then click Accept.

In the resulting window (Figure 1 below), you will be prompted to either secure your instance by generating a Let’s Encrypt certificate or uploading your own certificate. You can also opt to go the unsecured route.

Figure 1: The RavenDB Setup Wizard first page.

I highly recommend you go the secure route and either generate a new certificate or provide your own. However, if you are only currently experimenting with RavenDB, go ahead and click UNSECURE to start working with the platform right away. You can also opt to change the RavenDB them by clicking Select Theme (upper right corner). I tend to prefer light themes, so I’ll go with that.

Depending on which route you go (SECURE or UNSECURE), your setup will vary. I opted to go the UNSECURE route (as I’m just using this for testing purposes), so the next step is to enter the default ports and IP address. Because we are currently using port 8080 for the setup, you cannot use that as the HTTP port, so go with 8081. Fill out the rest of the information (using the default TCP port and the IP address of the hosting server and then click Next.

In the final window, you’ll be required to restart the RavenDB server, so click Restart server. After you click the restart button, you’ll be immediately greeted with an error page. Wait a moment for the server to restart and then click refresh on your browser, You should then see the RavenDB dashboard (Figure 2), where you can start working with this NoSQL database server.

Figure 2: The RavenDB dashboard is ready to go.

At this point, you can click CREATE DATABASE to create your first RavenDB database. Give the database a name (Figure 3), select any necessary options, and click Create.

Figure 3: Creating your first RavenDB database.

Congratulations, RavenDB is up and running and you’ve created your first database. You can now begin filling that database with data and then use it for your mobile, web, or cloud application.

A newsletter digest of the week’s most important stories & analyses.