ai, Technology, Tutorial, Ubuntu

SETTING UP OLLAMA ON AN UBUNTU MACHINE

This tutorial is an ubuntu (vanilla) version of this excellent ollama blog.

Following this blog wasn’t so easy for me because it assumed a bunch of dependencies that I didn’t have on my ubuntu machine.

The blog doesn’t really say clearly that you need pip and venv installed on the local machine in order to make this blog work smoothly. Also, it doesn’t say clearly that you should really have a project directory set up. So let’s do all that now before starting that great blog:

So the idea here, is that you first set up your ubuntu machine using this blog here (for the python and Open Webui parts), then you jump to the blog above to set up the ollama part and tour the Open WebUi parts.

1. Set up a Project Directory

I did this in my Home directory. Do it where you want. Do it by creating a folder in your favourite way. I called it ‘ollama’ because mama said I’m creative.

2. Set up Python PIP

PIP is a python packaging manager. You will need it to install the Open Webui stuff (the front-facing software to interact with the AI)

Run this command in your terminal:

sudo apt install python3-pip

3. Install Python Virtual Environment tool

Run this command so that your computer has capability to create a virtual environment:

sudo apt install python3.12-venv

(you may need to adjust that number / command as this blog ages over time, keep in mind)

4. Create your Virtual Environment in your Project Directory

  1. Navigate to your project directory that you created in Step 1 above using the terminal’s cd command
  2. Run this command to create the virtual environment, once you’ve navigated inside it:

python3 -m venv .venv

You should now have the hidden .venv directory inside your directory. You can check by running this command while inside: ls -al

5. Download and Install Open WebUi in the virtual Environment

Instead of the command listed in the blog navigate into your project directory and run:

.venv/bin/pip install open-webui

(So basically we’re running their command directly in the .venv/bin directory)

Note: this open webui download and installation took literally 3.5 hours to download and run installation. It’s true I have an old machine I’m testing this on. Just don’t expect this part to be fast – perhaps start the command and leave for work for the day…

6. Start Open WebUi

Because we’re in a virtual environment, you have to run the command from the blog (open-webui serve) with the path like this (while still in your project directory of course) like above in section 5:

.venv/open-webui serve

Note: This is probably because of my old computer but after running this command it took it did about 30 minutes of progress bars and then seemed to be stuck. After I exited the process in the terminal and re-ran the command above, everything worked great and the user interface opened up.

That’s it. Now you have the missing ingredients required to run that excellent ollama blog and enjoy the web ui tutorial stuff in there as well

Hope this helps

Tagged , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *