Deploying MindsDB on Linode
Tags: tutorial, cloud, database, machinelearning
Published: 2023-12-26 18:56:42

![Cover](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ovk612t7iuzh640bg0ny.png)

## Introduction

MindsDB is a state-of-the-art AI layer that integrates with traditional databases and enhances their ability to draw meaningful inferences from the existing data.

With MindsDB, one can easily train models that predict results and forecast outcomes based on available data. It has also several integrations with a wide variety of data sources and LLM models that make it robust and accurate for various user applications.

In this tutorial, you will learn to deploy an instance of MindsDB on Linode which is currently a part of Akamai.

## Creating a Linode

Linode provides scalable and cost-effective VMs to its users with high availability and reliability. You can follow the steps below to spin up a Linode instance.

**Step 1:** [Sign up](https://www.linode.com/lp/free-credit-short/?promo=sitelin100-02162023&promo_value=100&promo_length=60) for a new Linode account to avail 100$ worth of free credits. Existing users can simply [log in](https://login.linode.com/login) using their credentials.

![Sign up](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b4w1be9w7qgim3qdofwd.png)

**Step 2:** Once you're logged in, click on `Create Linode` to proceed.  

![Create Linode](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xhmfhc3fs8ebsi22cuxw.png)

**Step 3:** In the `Create` page, you need to define the configuration for the VM as per your requirement. For this tutorial, you can use the following configuration.

- **Choose a Distribution:** Ubuntu 22.04 LTS
- **Region:** Mumbai, IN (ap-west) (Choose the region closest to you.)
- **Linode Plan:** Shared CPU - Linode 4GB
- **Linode Label:** mindsdb-demo (You can give any name.)
- **Add Tags:** Leave it as it is.
- **Root Password:** Provide a password of your choice.
- **SSH Keys:** As you provided a password, you don't need an SSH Key.
- **Assign Firewall:** None
- **Attach a VLAN:** Leave it at default.
- **Add-Ons:** You can choose to keep the options checked or unchecked based on your requirements.
     - **Backups:** Keep it unchecked.
     - **Private IP:** Keep it checked.

![Linode Config](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5s8gio7199hsy4ax9plh.png)

Now click on `Create Linode` button to initiate the VM creation process. It should take a while to provision the instance.

![VM Provisioning](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/het52lr6t6yftep8dn0e.png)

**Step 4:** Once you see a `Running` status on the instance dashboard, you can interact with the instance by clicking on the `Launch LISH Console` button.

![Linode Console](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x5dltnhjbxheg93s6s1g.png)

Use the username as `root` along with the password you specified in the config to access the VM through the console.

![VM Root Login](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pjas1kl01vyn701vcjkv.png)

You are now ready to deploy MindsDB on this instance.

## Deploying MindsDB on the Linode VM

You can easily deploy an instance of MindsDB on this VM using Docker. To do so, follow the steps below.

**Step 1:** You need to first update the package lists available on the VM so that all the packages are up-to-date. Use the command given below to do so.

```bash
sudo apt update
```

![Package Update](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h42zfstl1ex82wuhu8cu.png)

**Step 2:** Docker is essential for this deployment. You can install it with the command given below.

```bash
sudo apt install docker.io
```
Type `Y` and hit `Enter` when prompted to accept the changes and proceed with the installation.

![Docker Install](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/najonsyfwlqpaf47sfg8.png)

**Step 3:** Now you need to pull the latest stable release of MindsDB from Docker. You can use the command given below to do this.

```bash
sudo docker pull mindsdb/mindsdb
```

Wait until the image pull is complete to proceed.

![Docker Pull](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wxf5hkzffzeszrj0qvoc.png)

**Step 4:** Now you can run MindsDB on your instance using Docker. You will also need to expose the respective ports for the MindsDB GUI and the MySQL API. Use the command given below to do so.

```bash
sudo docker run -p 47334:47334 -p 47335:47335 mindsdb/mindsdb
```

Wait until all the processes and APIs are up and running. You should see the confirmation in the console window.

![MindsDB Run](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/28iyg1gjavdrsmvqtsf5.png)

> **Note:** `sudo` is not necessary to execute commands in the console when you're logged in as the `root` user.

## Testing the MindsDB Instance

You have now successfully started MindsDB on the VM using Docker. To visit the MindsDB interface, simply access the public IP of the VM on port `47334`.

```bash
http://Linode Public IP:47334
```

You can find the public IP of the VM on the instance details page.

![Public IP](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/02dxtfaxhwzrcw0no2tq.png)

Once you access the GUI, you can find the `Query Editor` where you can write SQL-like queries and then view the results in the `Result Viewer` below it.

![MindsDB GUI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zr03a5r3ifg05iqha4ck.png)

To test whether the deployment is well and good, you can simply run a basic query given below and check its results.

```sql
SHOW tables;
```

This should list out all the basic tables available in your MindsDB instance by default.

![Tables List](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yyal9ftdw6z83wknc46t.png)

This confirms that the instance is running properly and you easily access it using the internet.

## Conclusion

In this tutorial, you successfully learned how to create a VM on Linode, deploy an instance of MindsDB on it, and then access and query it using the public IP of the VM.

Now that you've deployed the instance, you can go ahead and start working with AI Models or Chatbots and explore MindsDB to its full potential. In case you need any further details, feel free to check out their official documentation [here](https://docs.mindsdb.com/what-is-mindsdb).

Lastly, before you leave, don't forget to drop a like and share it with your peers if you got to learn something new today.



[![Try Here](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mkae8wxdzzy6eyyc7tvg.png)](https://cloud.mindsdb.com/)

[![Sponsorship Badge](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kksqbxtz7ff9kup9ylyt.png)](https://github.com/sponsors/Rutam21)