33 C
Jaipur
Monday, October 26, 2020

How to Install RavenDB NoSQL database on Ubuntu 20.04

Must read

How to Use the Call Reason Feature on Truecaller

Truecaller has been shedding its image for quite some time and putting an effort to project itself as a privacy-conscious company. We in fact...

7 Best Strikethrough Text Generator Tools Online | Cross Out Text Like A Pro

Strikethrough text is generally used to denote the information that’s no longer valid or the text that has been deleted. This text styling is...

Hyundai i20 2020 First Look Unveiled; Now Sportier Than Ever

Hyundai Motor India has officially unveiled the first design renders for the upcoming i20. The new Hyundai i20 is set to launch next month...

RavenDB is a free and open-source document-oriented NoSQL database designed for .NET/Windows platform. RavenDB supports multiple databases, sharding, or partitioning the data across multiple servers. It has the ability to handle hundreds or thousands of databases on the same instance. RavenDB uses JSON to store documents and does not requires a schema to be declared and enables developers to work with data more naturally.

In this tutorial, we will learn how to install RavenDB on Ubuntu 20.04 server.

Prerequisites

  • A server running Ubuntu 20.04.
  • A root password is configured the server.

Install Required Dependencies

Before starting, you will need to install the NET Core runtime in your system. First, download and install the package repository with the following command:

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

You should get the following output:

Selecting previously unselected package packages-microsoft-prod.
(Reading database ... 91134 files and directories currently installed.)
Preparing to unpack packages-microsoft-prod.deb ...
Unpacking packages-microsoft-prod (1.0-ubuntu20.04.1) ...
Setting up packages-microsoft-prod (1.0-ubuntu20.04.1) ...

Next, update the repository with the following command:

apt-get install apt-transport-https -y
apt-get update -y

Once the repository is updated, install the .Net Core runtime with the following command:

apt-get install aspnetcore-runtime-3.1 -y

Once the installation has been completed, you can proceed to the next step.

Install RavenDB

First, download the latest version of the RavenDB by running the following command:

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

Once the download is completed, extract the downloaded file with the following command:

tar xvjf ravendb.tar.bz2

Next, proper permission to the RavenDB with the following command:

chmod -R 755 ~/RavenDB

Next, change the directory to RavenDB and run the setup script as shown below:

cd ~/RavenDB
./run.sh

You should s-ee the following output:

./run.sh: line 24: xdg-open: command not found
       _____                       _____  ____ 
      |  __                      |  __ |  _  
      | |__) |__ ___   _____ _ __ | |  | | |_) |
      |  _  // _`   / / _  '_ | |  | |  _ < 
      | |   (_| | V /  __/ | | | |__| | |_) |
      |_|  ___,_| _/ ___|_| |_|_____/|____/ 


      Safe by default, optimized for efficiency

 Build 50005, Version 5.0, SemVer 5.0.0, Commit a8d3f94
 PID 23883, 64 bits, 2 Cores, Phys Mem 1.941 GBytes, Arch: X64
 Source Code (git repo): https://github.com/ravendb/ravendb
 Built with love by Hibernating Rhinos and awesome contributors!
+---------------------------------------------------------------+
Using GC in server concurrent mode retaining memory from the OS.
Could not start browser: System.ComponentModel.Win32Exception (2): No such file or directory
   at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start(String fileName, String arguments)
   at Raven.Server.Utils.Cli.BrowserHelper.OpenStudioInBrowser(String url, Action`1 onError) in C:BuildsRavenDB-Stable-5.050005srcRaven.ServerUtilsCliBrowserHelper.cs:line 26
Server available on: http://127.0.0.1:43241
Server started, listening to requests...
TIP: type 'help' to list the available commands.
Running non-interactive.

At this point, RavenDB is started and listening on port 43241. Now, press CTRL + C to exit.

Configure RavenDB

By default, the RavenDB is accessible only from the localhost. So you will need to configure it to access from the remote host.

You can configure it by editing settings.json file:

nano ~/RavenDB/Server/settings.json

Add / Modify the following lines:

{
    "ServerUrl": "http://your-server-ip:8080",
    "Setup.Mode": "Initial",
    "DataDir": "RavenData",
    "Security.UnsecuredAccessAllowed": "PrivateNetwork"

}

Save and close the file when you are finished.

Create a Systemd Service File for RavenDB

Next, you will need to create a systemd service file to manage the RavenDB. You can create it with the following command:

nano /etc/systemd/system/ravendb.service

Add the following lines:

[Unit]
Description=RavenDB v4.0
After=network.target

[Service]
LimitCORE=infinity
LimitNOFILE=65536
LimitRSS=infinity
LimitAS=infinity
User=root
Restart=on-failure
Type=simple
ExecStart=/root/RavenDB/run.sh

[Install]
WantedBy=multi-user.target

Save and close the file. Then, reload the systemd daemon with the following command:

systemctl daemon-reload

Next, start the RavenDB and enable it to start at system reboot with the following command:

systemctl start ravendb
systemctl enable ravendb

You can now check the status of the RavenDB with the following command:

systemctl status ravendb

You should get the following output:

? ravendb.service - RavenDB v4.0
     Loaded: loaded (/etc/systemd/system/ravendb.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2020-08-01 11:25:12 UTC; 7min ago
   Main PID: 30833 (run.sh)
      Tasks: 32 (limit: 2353)
     Memory: 157.0M
     CGroup: /system.slice/ravendb.service
             ??30833 /bin/bash /root/RavenDB/run.sh
             ??30871 ./Raven.Server --browser

Aug 01 11:30:19 ubuntu2004 run.sh[30871]: Starting shut down...
Aug 01 11:30:21 ubuntu2004 run.sh[30871]: Shutdown completed
Aug 01 11:30:21 ubuntu2004 run.sh[30871]: Restarting Server...
Aug 01 11:30:21 ubuntu2004 run.sh[30871]: Using GC in server concurrent mode retaining memory from the OS.
Aug 01 11:30:21 ubuntu2004 run.sh[30871]: Server available on: http://69.87.218.19:8080
Aug 01 11:30:21 ubuntu2004 run.sh[30871]: Tcp listening on 69.87.218.19:38888
Aug 01 11:30:21 ubuntu2004 run.sh[30871]: Server started, listening to requests...
Aug 01 11:30:21 ubuntu2004 run.sh[30871]: TIP: type 'help' to list the available commands.
Aug 01 11:30:21 ubuntu2004 run.sh[30871]: ravendb> End of standard input detected, switching to server mode...
Aug 01 11:30:21 ubuntu2004 run.sh[30871]: Running non-interactive.

At this point, RavenDB is started and listening on port 8080.

Access RavenDB Web Interface

Now, open your web browser and type the URL http://your-server-ip:8080. You should see the following screen:Advertisement

Advertisement

Click on the Accept button to accept the License Agreement. You should see the following screen:

Secure the database

Here, there are three options to setup the RavenDB. Select the Unsecured option. You should see the following screen:

Configure database ports

Provide the HTTP Port, IP address and click on the Next button. You should see the following screen:

Configuration completed

Click on the Restart server to restart your system. After successful restart, you will be redirected to the RavenDB dashboard as shown below:

RavenDB dashboard

Click on the CREATE DATABASE button. You should see the following screen:Advertisement

Configure Replication in RavenDB

Provide your database name and click on the Create button. You should see your newly created database in the following screen:

Create a database in RavenDB

Conclusion

Congratulations! you have successfully installed RavenDB on Ubuntu 20.04. You can now start exploring RavenDB to get familiar with it. Feel free to ask me if you have any questions.

Source link

- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to Use the Call Reason Feature on Truecaller

Truecaller has been shedding its image for quite some time and putting an effort to project itself as a privacy-conscious company. We in fact...

7 Best Strikethrough Text Generator Tools Online | Cross Out Text Like A Pro

Strikethrough text is generally used to denote the information that’s no longer valid or the text that has been deleted. This text styling is...

Hyundai i20 2020 First Look Unveiled; Now Sportier Than Ever

Hyundai Motor India has officially unveiled the first design renders for the upcoming i20. The new Hyundai i20 is set to launch next month...

Best MagSafe Wireless Charging Car Mounts for iPhone 12 Pro Max

The inclusion of MagSafe on the iPhone 12 Pro Max is signaling the port-less iPhone future. I, for one, am not ready for that....