Getting the Codename of our Ubuntu Version
First, we need to know the code name of our Ubuntu version. We can find that by reading from the file “os-release”. From this file we can read only the line that has words “VERSION_CODENAME” inside of it.
> cat /etc/os-release | grep VERSION_CODENAME
Our Ubuntu codename is “focal”. It is also possible to use command:
> lsb_release -cs
We can see from the command line above that our user account is “user“. “computer” is the name of our system.
Adding a Repository Where MonetDB is Stored
Next, in folder “/etc/apt/sources.list.d” we will create a file with the name “monetdb.list”.
> cd /etc/apt/sources.list.d #jump to that folder > sudo touch monetdb.list #create new file, you will be asked to provide password
Inside of this file we have to place this text. These are addresses to MonetdDB repository.
deb https://dev.monetdb.org/downloads/deb/ focal monetdb
deb-src https://dev.monetdb.org/downloads/deb/ focal monetdb
We can add this text by inserting these two lines in our terminal:
sudo sh -c 'echo "deb https://dev.monetdb.org/downloads/deb/ focal monetdb" >> monetdb.list' sudo sh -c 'echo "deb-src https://dev.monetdb.org/downloads/deb/ focal monetdb" >> monetdb.list'
Now our file looks like this:
Installing GPG key
Then, we would execute this command. This command will read GPG key file from the internet, and it will place that file in location /etc/apt/trusted.gpg.d/monetdb.gpg. GPG key is a file which will be used to verify MonetDB packages before installing them.
sudo wget --output-document=/etc/apt/trusted.gpg.d/monetdb.gpg https://dev.monetdb.org/downloads/MonetDB-GPG-KEY.gpg
This monetd.gpg file is binary file. We can read its content with the command:
sudo apt-key finger
This command will read values of all the GPG keys in our Ubuntu. One of those keys will be for MonetDB:
If result of this command is equal to “8289 A5F5 75C4 9F50 22F8 EE20 F654 63E2 DF0E 54F3” for MonetDB, then that means that we have installed the correct key.
Now we can install MonetDB. First, we will update our list of available software with command:
sudo apt update
Then we can install MonetDB server and client:
sudo apt install monetdb5-sql monetdb-client
Next step is to enable “MonetDB” service. This service will run each time we boot our computer.
sudo systemctl enable monetdbd
But, if we want our service to run immediately, we don’t have to wait for the next boot. We can start our service with:
sudo systemctl start monetdbd
Now that we started our service, let’s check its status. We type:
systemctl status monetdbd
We can see that our process is enabled and is running.
Adding an User in MonetDB
Next step is to add users, who are allowed to run a database server, to user group monetdb. “user” is the name of the users account.
sudo adduser user monetdb
To activate this change, we have to log out. If we are using console, we just have to type “exit” and then we can log in again. If we are using GUI, then we can just click on “Log Out” button somewhere in our desktop environment.
We can now type “mserver5” in terminal (or console), and we will get a proof that our server is installed.
We can also type “monetdb status“.