Rethinking the traditional database structure, RethinkDB is a powerful NoSQL document-based engine optimized for real-time web applications. The following tutorial will teach you how to install RethinkDB on Ubuntu 22.04 Jammy Jellyfish or Ubuntu 20.04 Focal Fossa Linux by utilizing the command line terminal and importing the official RethinkDB APT repository with cli commands and installing the software directly from it.
Table of Contents
Update Ubuntu
First, update your system to ensure all existing packages are up to date to avoid potential conflict issues during the installation.
First, update your system to ensure all existing packages are up to date.
sudo apt update
Optionally, you can list the updates for users who require review or are curious to see what is available to update. This can be good if you have a specific you forgot to place; use the apt-hold command.
sudo apt --list upgradable
Proceed to upgrade any outdated packages using the following command.
sudo apt upgrade
Import RethinkDB Repository
Install Required Packages
The following dependencies will need to be installed to install RethinkDB successfully. Most of these packages are already on your system, but running the command can help ensure they’re installed.
sudo apt install software-properties-common apt-transport-https curl -y
If you skip and encounter issues, return and just run the command.
Import RethinkDB GPG Key
The next step is to import the GPG key to verify the authenticity of the packages. In your terminal, execute the following command to import to your keychain.
curl -fsSL https://download.rethinkdb.com/repository/raw/pubkey.gpg | sudo gpg --dearmor | sudo tee /usr/share/keyrings/rethinkdb-archive-keyrings.gpg > /dev/null
Import RethinkDB Repo
Now that you have imported the GPG key to verify the authenticity of the packages run the following command, which will add the RethinkDB APT repository to your sources listings.
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/rethinkdb-archive-keyrings.gpg] https://download.rethinkdb.com/repository/ubuntu-$(lsb_release -cs) $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list
The above command should work for all current versions of Ubuntu.
Install RethinkDB
First, update your repository list to reflect the new repository changes:
sudo apt update
You can finally install the database software using the following command in your terminal.
sudo apt install rethinkdb
Optionally, you can confirm the installation by checking the version number using the following command.
rethinkdb --version
Example output:
rethinkdb 2.4.2~0jammy (GCC 11.2.0)
Enable the service on system startup and activate it immediately.
sudo systemctl enable rethinkdb --now
Check the status before continuing to ensure it is active and without errors.
systemctl status rethinkdb
Example output:
Configure RethinkDB Service
By default, the RethinkDB instance will not be initiated on startup or active; you must copy the sample configuration file, and from here, you can configure your instances.
sudo cp /etc/rethinkdb/default.conf.sample /etc/rethinkdb/instances.d/instance1.conf
For multiple instances, you can name these whatever you want. For users that require a new configuration, this can be downloaded from the project’s GitHub or see the official configuration file options from RethinkDB.
The following will show common areas to look at and change if required.
File Path Options
Below you can configure and change the directory locations. This can be left as default and should only be changed if you require alternative directory locations.
### File path options
## Directory to store data and metadata.
## Command line default: ./rethinkdb_data
## Script default: /var/lib/rethinkdb/<name>/ (where <name> is the name of this file without the extension)
# directory=/var/lib/rethinkdb/default
## Log file options.
## Default: <directory>/log_file
# log-file=/var/log/rethinkdb
WebUI Options
Standard options, you can change the default HTTP-PORT from “8080” to something else. I would suggest doing this and making it random for security purposes.
### Web options
## Port for the HTTP admin console.
## Default: 8080 + port-offset
# http-port=8080
## Disable web administration console.
# no-http-admin
Network Options
Set automatic IP address binds. The default is all; for instance, you can set specific IP addresses or IP ranges like 127.0.0.1/24.
### Network options
## Address of local interfaces to listen on when accepting connections.
## May be 'all' or an IP address, loopback addresses are enabled by default.
## Default: all local addresses
# bind=127.0.0.1
Meta Name
Changing the server name is pretty self-explanatory.
### Meta
## The name for this server (as will appear in the metadata).
## If not specified, it will be randomly chosen from a short list of names.
# server-name=server1
The above are some of the options. Given RethinkDB will be deployed in different environments, you may or may not need to modify these and other settings.
Access RethinkDB Web UI
RethinkDB comes with the ability to use a web-based interface to access it in local environments. For external domains and environments, you would set up a reverse proxy with Nginx. The local environment can be accessed on port “8080,” which is the default port.
In your terminal, for those who have not set up the configuration file and want to launch an instance, run the following command to open RethinkDB and allow any computer system to connect.
rethinkdb --bind all
Example output:
joshua@ubuntu-linux:~$ rethinkdb --bind all
Recursively removing directory /home/joshua/rethinkdb_data/tmp
Initializing directory /home/joshua/rethinkdb_data
Running rethinkdb 2.4.2~0jammy (GCC 11.2.0)...
Running on Linux 5.15.0-56-generic x86_64
Loading data from directory /home/joshua/rethinkdb_data
Listening for intracluster connections on port 29015
Listening for client driver connections on port 28015
Listening for administrative HTTP connections on port 8080
Listening on cluster addresses: 127.0.0.1, 192.168.50.234, ::1, fe80::e5c7:3efa:3294:ffca%2
Listening on driver addresses: 127.0.0.1, 192.168.50.234, ::1, fe80::e5c7:3efa:3294:ffca%2
Listening on http addresses: 127.0.0.1, 192.168.50.234, ::1, fe80::e5c7:3efa:3294:ffca%2
Server ready, "ubuntu_linux_ofk" 044e2d46-1111-40a2-9b04-efeadf9a52a2
For example, use the following command to lock off a dedicated IP address.
rethinkdb --bind ip-address
Now open the local environment using a similar address as per below.
### localhost
http://localhost:8080
### server-ip
http://192.168.xx.xx:8080
Example:
Conclusion
The tutorial has shown you how to install RethinkDB on Ubuntu 22.04 or 20.04 LTS by importing the official repository and installing it directly, ensuring you have the most up-to-date version.