In this post we are going to install and configure dnsmasq with a simple webUI acting as a front end for our less technical users. Our goal is to simplify dns in our lab sandboxes, and keep users from directly modifying our dnsmasq config files.
Installation
First we need to install dnsmasq.
# dnf -y install dnsmasq
Now lets enable and start the service. We will also check the status of the service to ensure that we do not have any issues with the default config.
So far we have dnsmasq configured and running, and we have installed a web front end and have been able to start it on the command line. Now we need to configure the front end to start as a service when the OS boots. So we now need to turn the webUI into a systemd service.
First we create the following service file
# vi /etc/systemd/system/dnsmasq-webconf.service
The contents of which are below. Note that we have modified relative paths to be absolute paths.
I recently got my hands on a couple of gigabyte servers. These machines came preinstalled with Ubuntu 20.04. Credentials for a OS local user account were on a sticker on the machines. However there was no indication of what the BMC credentials were. According to this document, there should be default credentials that we can use on the motherboard, however, they were not working.
These machines came with Ubuntu 20.04 on them, and did not have ipmitool installed.
$ sudo apt install ipmitool --fix-missing
Once installed we need to determine what BMC users exist.
$ sudo ipmitool user list 1
In the output below you can see that there is one user – “admin” – identified as ID #2
Now lets reset the password for “admin”.
$ sudo ipmitool user set password 2
We are then prompted to create a new password.
We should now be able to load the BMC web interface and login with our new credentials
I have already installed Nvidia proprietary drivers and the Nvidia Cuda Toolkit. I documented the install of the Cuda toolkit in an older post which can be found here.
Since I have Nvidia GPUs in my host system, and I intend to run some services in containers, I want to make sure that I install the nvidia-container-toolkit. Instructions on how to setup the repo on Ubuntu 22.04 can be found here. Once you have setup the repo, you can follow the steps below, or just follow the instructions found in the link above.
Test Connectivity from a remote host. If you are unable to reach the ip/port you may need to modify firewall on the remote system.
$ telnet 10.1.10.14 11434 Trying 10.1.10.14… Connected to 10.1.10.14. Escape character is '^]'.
Install OpenWeb UI
I am using the open-webui:cuda container as I am running dual Nvidia GPUs. I want OpenWeb-UI to bind to the primary interface on the host so that I can access it from my workstation.
# docker run -d -p 10.1.10.14:3000:8080 --gpus all --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:cuda
The -v option in the command below will create a volume for OpenWeb-UI. You can verify with the command below
$ docker volume ls
DRIVER VOLUME NAME
local open-webui
Confirm that the container has started.
$ docker ps
If it has failed to start use “docker logs <container-id>” to troubleshoot.
Now, in a web browser, navigate to the ip/port combo you entered in the docker run command shown above. You should be greeted with the OpenWeb-UI getting started page.
Install ChromaDB
Use the command below to instanciate the ChromaDB container. 10.1.10.14 is the ip of my host, adjust as needed to fit your needs
In order to setup RAG you will need to do the following.
Create a Knowledge Base
Upload files
Create the Model that will use the Knowledge Base
First we will create a knowledge base. Navigate to Workspace > Knowledge > + Create a Knowledge Base. Choose a name for your Knowledge base and add a description.
We are going to name ours, Gordon Lightfoot
Now select Create Knowledge
Look real hard for the text “Drag and drop a file to upload or select a file to view”. This is where you w drag and drop your documents. We have two documents to add to our collection.
You can also upload entire directories or sync with a directory
Now navigate to Workspace > Models > + Add New Model. Imput a name for your custom model and choose a base model. I am choosing tinyllama for this test.
Scroll down and select Save & Create
Now let’s chat with our new model. Select Workspace and then select your new model (My Gordon Lightfoot Model)
You are now ready to chat with your model
Let’s ask it a question
So there you go. A working RAG implementation with Ollama, OpenWebUI, and VectorDB. I am sure that there are a lot more features to explore here and I am sure I have a lot more tuning to do. But for now I am off to a good start.
We are installing on a very fresh install of Ubuntu 22.04 with an Nvidia 3070ti GPU. Nvidia Drivers were installed at build time. However lets check to see what version of the Nvidia driver we are currently running.
$ nvidia-detector
nvidia-driver-570
While we are at it, let’s make sure that we have nvidia-smi installed which is included in the package shown below
$ sudo apt install nvidia-utils-570
We will need gcc, which the meta-package below will include (along with make and other dev tools).
# sudo apt install build-essential -y
Lets check what version of python we have installed.
$ python3 --version
Python 3.10.12
Now install python-venv which is the python module that supports creating virtual environments. Reference the python version shown in the output in the step above
# sudo apt install python3.10-venv -y
Installing the Nvidia Cuda Toolkit
Note: If you installed the nvidia-cuda-toolkit from default ubuntu noble repo, uninstall it first as that version is probably too old. Uninstall with “sudo apt purge nvidia-cuda* -y“
“The NVIDIA CUDA Toolkit is a software development kit that helps users create GPU-accelerated applications. It includes libraries, compilers, debuggers, and optimization tools”. Since we have an Nvidia GPU we will install it as shown below.
First we wget the Nvidia Cuda Repository pin as shown above. Then we move it to /etc/apt/preferences.d/ (shown below).
This is a configuration file that is used to prioritize packages from the NVIDIA CUDA repository when installing CUDA on a Linux system. Basically it tells apt where to get the Cuda Toolkit.
Nvidia states that you need to add the following env vars to your .bashrc, however you will also need to add them to your python virtual env — in venv/bin/activate. These variables will be needed during the install process below.
Note that every time you want to use instructlab cli (ilab) post-install you must source the file above. venv/bin/activate
The install guide found here has you run this command to clear out the pip package cache (for this one package. Not required for first install, but may be on subsequent install runs.
$ pip cache remove llama_cpp_python
We then run the 3 commands shown below. Apparently there is a known bug and we will not pick up these required packages as needed, so we need to install them manually, and in the order shown below.
The instructions have you wrap up the of Instructlab with a pip install of vllm, however this install will fail due as it cannot find nvcc without setting the env variables. So set the following env vars as shown below.
The instructions for installing instructlab with Nvidia Cuda support as documented on instructlab.ai currently have you pip install a very specific version of vllm (with cuda support), however I have found that this command will fail (at least on Fedora 40, Ubuntu 22.04, and Ubuntu 24.04) that command is shown below.
One up and running you will see output similar to what is shown below.
INFO: Started server process [1252947]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
Testing Pytorch Module
You can create and run the python script below to test if your GPU is identified correctly. This step is not required, but its handy in identifying potential issues with gpu/cuda.
$ python3 ./test.py
CUDA available: True
CUDA version: 12.4
Torch version: 2.5.1+cu124
GPU count: 1
GPU name: NVIDIA GeForce RTX 3070 Ti
Instructlab Init and Setup
Now that we have ilab installed we can initialize our environment with the command below. This command will download the Taxonomy repository to our local machine along with a config file. Apparently ilab init has a few default GPUs available to choose from, but since my current GPU is
Our config file is located in our home directory, if you want to take a look. Note that our GPU, being a Nvidia RTX 3070 TI, will have differing config values than what we selected above (A100), so in a later step we will need to edit our config
/home/cpaquin/.config/instructlab/config.yaml
To see the info regarding your workstation, you can run the command below. We will use some of the data below to update our config
Use the command below to edit the generated config.
$ ilab config edit
Here we go through the file and ensure that we are setting the number of GPUs correctly. We also modify some additonal settings that have differed from the default (as ilab thinks we now have a $40k GPU). Below is some of what we have configured.
# Metadata pertaining to the specifics of the system which the Configuration is
# meant to be applied to.
metadata:
# Manufacturer, Family, and SKU of the system CPU, ex: Apple M3 Max
# Default: None
cpu_info:
# Amount of GPUs on the system, ex: 8
# Default: None
gpu_count: 1
# Family of the system GPU, ex: H100
# Default: None
gpu_family: RTX 3070 TI
# Manufacturer of the system GPU, ex: Nvidia
# Default: None
gpu_manufacturer: Nvidia
# Specific SKU related information about the given GPU, ex: PCIe, NVL
# Default: None
gpu_sku:
Working with Models
Before we start working with a model, lets take a look at the ilab command parameters. We can see that we have several options such as download, list, test, train, chat, serve, etc.
Lets download a model with the command below. The command below will download the default model sets in the config file
$ ilab model download
output below
View your downloaded models via the command below
$ ilab model list
Now we serve the default model with the command below
$ ilab model serve
Open another terminal window and source the env file from the instructlab directory
$ source venv/bin/activate
Then run the command below to begin an interactive chat session
Note that every time you want to use instructlab cli (ilab) post-install you must source the file above. venv/bin/activate
We then run the 3 commands shown below. Apparently there is a known bug and we will not pick up these required packages as needed, so we need to install them manually.
The install guide found here has you run this command to clear out the pip package cache (for this one package. Not required for first install, but may be on subsequent runs.
NOTE: The vllm install is currently failing with this error – ImportError: libcudnn.so.8: cannot open shared object file: No such file or directory. I am looking to find a resolution or work-around