RavenDB is a free and open-source NoSQL database that was designed to use with dot net or Microsoft. But, you can now use the RavenDB NoSQL database widely on Windows, Mac, Ubuntu, and other Linux distributions. Using a NoSQL database can change the database speed revolutionary speedy. If you’re a database engineer, you might have already known that the debate between SQL or NoSQL is not a strong topic anymore. Any new database programmer can use RavenDB to learn the NoSQL engine. RavenDB is easy, and has both cloud-based and local machine-based services, and can provide a high performance than other DB engines.
RavenDB NoSQL Database on Ubuntu Linux
Linux users often prefer PostgreSQL relational DB engine as the goto database engine, but there is no hard feeling in trying a different non-relational DB engine. RavenDB is mostly optimistic, while other engines are pessimistic. RavenDB supports all key-value, doc-based, column-based, and graph-based NoSQL.
In RavenDB, you can use the ACID (atomicity, consistency, isolation, durability) database to ensure that your query performance is well and no query conflicts occur. In this post, we will see how to install and use RavenDB on Ubuntu distribution.
Step 1: Install Microsoft-Prod and Runtime Application
To install the RavenDB NoSQL database on Ubuntu, you need to make sure that your system is updated and the repository runs smoothly. Run the following aptitude command given below to update and upgrade the system.
sudo apt update && sudo apt upgrade
Now, as the RavenDB NoSQL database was initially created for dot net and Windows-based systems, we will need to download and install the Microsoft Prob package on our Ubuntu system. First, run the following wget command given below to download the compiled version of the Microsoft Prob package on the filesystem.
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
When the download finishes, run the following Debian package installer command with root access to install the Microsoft Prob tool.
sudo dpkg -i packages-microsoft-prod.deb
After installing the Microsoft Prob tool, we now need to install the HTTP transport tool and the runtime tool to ensure that we face no issues while installing the RavenDB NoSQL database on Ubuntu.
Run the following aptitude commands given below with root access to install the HTTP transport layer tool and update the repository.
apt-get install apt-transport-https -y
apt-get update -y
You can now run the following command given below with root access to install the Runtime tool.
sudo apt-get install aspnetcore-runtime-3.1 -y
Step 2: Install RavenDB NoSQL Database on Ubuntu
In this step, we will see how to download RavenDB and install it on our Ubuntu system. First, run the wget command given below to download the latest compressed version of RavenDB. The file will automatically be stored inside the home directory of your filesystem. If you face any issues while downloading, please change your Linux server location and run a quick apt-update command to update to refresh the repository.
wget -O ravendb.tar.bz2 https://hibernatingrhinos.com/downloads/RavenDB%20for%20Linux%20x64/latest
When the download finishes, run the tar command given below with root access to extract the RavenDB compressed file. You may also need to run the change ownership command given below after extracting the file to make the files executable.
tar xvjf ravendb.tar.bz2
chmod -R 755 ~/RavenDB
Now, browse the RavenDB directory and run the forward-slash run.sh command to run the RavenDB NoSQL database on Ubuntu. On the terminal shell, you would see the application name, PID, build version, CPU core details, and memory status of your system.
$ cd ~/RavenDB
Now, one thing I must mention, when you run the RavenDB for the first time from the terminal shell, it will open the web interface and ask you to set the database. You can close the browser if you want to do the configuration first.
We will set up the database through the web interface tool right after the finishing configuration part. As the RavenDB tool runs on the garbage collection (GC) mode, so it does not take system resources.
Step 3: Configure Database RavenDB on Ubuntu Linux
In this stage, we’re ready to do the set the server IP address. Usually, every time you open RavenDB, it will automatically choose a new network port to load the web interface. You can edit the RavenDB database configuration script on your Ubuntu machine to set a fixed IP address and port. Run the following command with root access to edit the configuration script. When the script opens, replace the server URL and the port with your desired address.
sudo nano ~/RavenDB/Server/settings.json
You can go through the configuration script supplied below for a better understanding.
After setting up the network IP addresses, you may now run the following command with root privilege given below to edit RavenDB daemon on your Ubuntu system. This system daemon will keep the RavenDB database keep running on the system’s background.
sudo nano /etc/systemd/system/ravendb.service
When the system daemon script opens, copy and paste the script given below to set the daemon.
Now save the script and close the editor. Then, run the system control commands given below to reload the system daemon, enable and start the RavenDB database on your Ubuntu system.
systemctl start ravendb
systemctl enable ravendb
If everything goes correctly, you can now run the next system control command to check the RavenDB database status.
sudo systemctl status ravendb
In addition, you can also set the UFW firewall rule for allowing the RavenDB network port on your Ubuntu system.
sudo ufw allow <port>
Step 4: RavenDB NoSQL Database Web on Ubuntu
As I mentioned earlier, the RavenDB database automatically opens on the web browser when you execute the script through the terminal shell. In the first web interface, you will need to accept the software license to go forward.
In the next step, you will see two columns named ‘Secure’ and ‘Unsecure’. From the ‘Secure’ section, you will find options for encrypting through Let’s Encrypt; or, you can also provide your own certificate.
From the ‘Unsecure’ column select the ‘Unsecured’ button to set up your RavenDB database on the Ubuntu machine.
When the RavenDB setup wizard opens, you need to put the HTTP port, TCP port, IP address to create a new cluster. After filling up all the necessary fields, click on the ‘Next’ button to finish the setup. Then you will need to restart the server.
Finally, after a quick restart when you run the RavenDB NoSQL database on Ubuntu, you will find options to explore the Database, server dashboard, cluster dashboard, and manage the server. The RavenDB tool will also display the system’s current CPU load, RAM load, and network status.
To create a new NoSQL database, click on the ‘CREATE DATABASE’ button from the right-bottom section on your screen.
When a new window opens, put your database name in the ‘Name’ field, and put the replication value 1 if you’re creating a standalone database. Ultimately, click on the ‘Create’ button to finish building the database.
No doubt, relational databases are great to use and easy to write. But the NoSQL does mean No SQL, and it stands for ‘Not Only SQL’. Practicing NoSQL with RavenDB is great. It supports APIs and can be used in a distributed way. In the entire post, we have seen how to install RavenDB on a Ubuntu machine and how to get started with it.
If you find this post useful and technical, please share it with your friends and the Linux community. You can also write down your opinions regarding this post in the comment section. Please do visit the RavenDB Bootcamp to know more about RavenDB.
Could not install aspnetcore-runtime-3.1 -y