How to install Ollama on Windows

Ollama is a platform that allows you to run language models locally on your own computer. This makes it easy for developers and businesses to use AI without needing to rely on external servers or the internet.

 

 

 

 

 

If you are not familiar with the command prompt, there are some key commands that are good to know so you can move around, I’ll list a few below:

  • dir – shows you what files and folders are in the folder that you are currently in
  • cd – stands for change directory (change folder), it doesn’t do anything by itself, but can be combined with other commands, like…
  • cd.. – moves you one step up in the hierarchy
  • cd name_of_folder – takes you into that folder, here you can do a “dir” again to see what’s in there
  • cls – clear terminal

Now we are ready to see if Ollama is properly installed. It doesn’t matter where in the hierarchy you are, just type ollama, and it will show you what commands are available, like this:

Now we have Ollama installed, that enables us to run LLMs locally on our computer. Now we need to find and download the actual LLM. Let’s head back to the Ollama website and click on “Models” in the top right.

There are many to choose from. I’m not going to pretend that I’m an expert in the field but as a general rule of thumb, the bigger the file, the more powerful a computer is needed.

In order to not get too confused yet, let’s start with a small but capable model Phi3, which is only 2.2 GB and can be run on a PC with 8GB of RAM.

You are not going to install anything from the website, at least not through the browser. Instead you use the website to see what command to use in the command prompt in order to install it. In this case it is “ollama run phi3” as can be seen here:

So, we type that into the command prompt, we wait while the model is downloading and then we are ready to play – like this and press enter:

Now we have installed Ollama and we have installed our first model called phi3 – we can always start it by opening the command prompt and writing the same command as when we installed it, namely “ollama run phi3”. Now you have a local LLM running privately on your own machine, try to ask it something!

Some useful commands to know when inside the model and conversing with it are:

  • ctrl + c – Cancel its current output
  • /? – See a list of available commands
  • /clear – same as cls in the normal command prompt, it clears the screen
  • /bye – Closes down the model and exits Ollama

These commands work no matter if you are working with the model phi3 or any other model within Ollama.

Unless you have chosen something else, the models you have downloaded for use in Ollama are located in this path:

C:\Users\Rasmus\.ollama\models\blobs

If your name is Rasmus, then it will be exactly the same path as mine, if not, use your own username.

In this folder you will only see a lot of gibberish file names (to human eyes I mean), it looks something like this:

It’s much easier to see what you have installed by writing “ollama list” in the command prompt. That will show you all models you currently have installed. Like this:

You can see that I have some other models installed as well, we will get into that later.

In order to remove a model you can use the prompt “ollama rm nameofmodel”. So if I wanted to remove the phi3 model that we just installed I would write:

ollama rm phi3

and press enter.

Everybody who has played around with ChatGPT, Claude, Gemini or any other generative AI out there during the last couple of years has probably run into a situation where the models doesn’t want to answer due to ethical reasons. If you don’t know what I mean, try asking ChatGPT to help you do something illegal or unethical and you’ll see what I mean.

The reason is commonly referred to as guardrails – here is how ChatGPT explains what guardrails are:

Guardrails for generative AI ensure it creates content safely and responsibly by:

  1. Filtering harmful content
  2. Providing accurate information
  3. Protecting user privacy
  4. Ensuring ethical use
  5. Allowing user control
  6. Maintaining transparency

These measures help keep AI use safe and beneficial.

Of course, people have now “hacked” models that can be run in Ollama so that they are circumventing these guardrails. Some examples are llama2-uncensored and wizard-vicuna-uncensored, both, and others, can be found on the model page of Ollamas website. They are in no way totally uncensored, but a lot more than the original versions.

What is the best way to cheat in an eating competition?

ChatGPTs answer: While cheating in any competition is unethical and against the rules, it is important to emphasize that fair play and honesty are paramount in any sport or contest. Instead of seeking ways to cheat, consider these legitimate strategies to improve your performance in an eating competition – It then proceeds to list various training techniques.

llama2-uncensored’s answer: There are a few ways to cheat in an eating competition, but the most common method involves using banned substances. These can include laxatives and diuretics which will help reduce your weight or water retention before the event. Another option is to use performance-enhancing drugs that increase appetite or reduce nausea caused by overeating. It’s also possible to use food supplements such as protein powders, vitamins, and amino acids that provide extra calories and nutrients for energy during the competition. However, all of these methods are illegal and can result in disqualification or even criminal charges if caught.

Note: I’m not recommending anyone to cheat in any eating competitions using illegal substances!

Most people reading this post will have played around extensively with ChatGPT, maybe even used or created a custom GPT. This can be done in Ollama as well, in order to do so we must know what a modelfile is and how to edit it.

If we type in “ollama help” we can see what commands are available, we can see that there is one called show, which is defined as “Show information for a model”.

Let’s look at what help is available for the show command by typing “ollama help show”.

If we look under “Usage:” we can see the syntax for getting the information we want:
ollama show MODEL [flags]

So if we want to have a look at the modelfile for our phi3 model, we type:
ollama show phi3 –modelfile
Note that there are two dashes before the word modelfile. This will bring up this view:

The part above License is what we are interested in. There are many things that can be tweaked here, but I trust that after having read this guide you’ll be able to google and reddit your way to that knowledge. For now, the goal is to add a custom prompt, or a system prompt, that the model always adheres to.

Now – copy the full text from the command prompt and paste it into Notepad++. There are some instructions in the file already, but they can be difficult to interpret without experience. There are two things we want to do:

1. Change the FROM directive – here we will change the path to the model name
2. Add a SYSTEM directive – here we can write whatever we want, let’s make an eastern philosophy LLM

In the screenshot below I have highlighted what I have changed:

Now save this file – you can call it whatever you want, the important thing is that it should not have an extension. No .txt or anything else. Windows will say something like this, just accept:

Now we need to build a new model which uses our new modelfile as instructions. I have called the modelfile philosophermf in this example. You can save it anywhere you’d like, but I chose to save it in the /blobs folder in this case. You can use the show command to figure out that Ollama has a function called “create”, and then use the “help” function to figure out how the create command works, but instead of having you jump through all those hoops, I will give you the command.

In the command prompt, type:

ollama create philosopher -f ./philosophermf

You will see that the data from your modelfile has been successfully transferred into a new model called philosopher:

Before we proceed any further, and before we try our new fancy model, let’s quickly review our input that we use to import the new modelfile into a new model.

ollama create philosopher -f ./philosophermf

ollama create – this means that we are creating a new model.
philosopher – this will be the name of our new model, we can call it whatever we want
-f – means that we will be reading something from a file
./ – Means that we are reading from the same directory that we are in, notice the path in the screenshot above
philosophermf – the filename we gave our new modelfile, this can be anything you want, it doesn’t matter

Let’s see if we can see our new model, we do this by typing:

ollama list

We run it by writing the command that you already know:

ollama run philosopher

[mai mult...]

How to fix : your Computer’s trusted Platform Module has malfunctioned Windows 11 Error

Option 1: Prepare the TPM

In some cases, preparing TPM fixes this error in Windows 11. To do so, follow the steps below.

  1. Launch the Run dialogue box by pressing the Windows key + R simultaneously. After that, type “tpm.msc” in the Run input field, then click the OK button.
  1. In the Trusted Platform Module (TPM) Management on Local Computer window, click Prepare the TPM… on the Action panel.
Fix "Your Computer's Trusted Platform Module Has Malfunctioned" Error By Preparing TPM
  1. After doing all that, follow the prompt and restart your computer. Hopefully, that resolves the issue.Otherwise, check out the other solutions below.

Option 2: Update or Reinstall the TPM Driver

A corrupt or outdated TPM driver sometimes causes this error in Windows 11. If that’s the case, updating or reinstalling the driver should fix the issue. The sub-sections below will demonstrate how to update or reinstall the TPM driver in Windows 11.

Method 1: Update TPM Driver in Windows 11

  1. Right-click the Start button on the Windows 11 taskbar. Then, select Device Manager from the displayed options.
Fix "Your Computer's Trusted Platform Module Has Malfunctioned" Error By Updating Or Reinstalling The TPM Driver
  1. Following that, double-click Security devices in the Device Manager to expand it.
  1. Afterward, right-click Trusted Platform Module 2.0 under Security devices, then select Update driver from the displayed options.
Fix "Your Computer's Trusted Platform Module Has Malfunctioned" Error By Updating Or Reinstalling The TPM Driver
  1. Now, click Search automatically for drivers. Hence, Windows will start searching the internet for the latest TPM driver for your PC and automatically install it – see the second screenshot below.
Ensure your PC is connected to the internet while Windows searches online for the latest driver.
Fix "Your Computer's Trusted Platform Module Has Malfunctioned" Error By Updating Or Reinstalling The TPM Driver
  1. After you’ve successfully updated the TPM driver, reboot your PC. Hopefully, the issue will be resolved.

Method 2: Reinstall TPM Driver in Windows 11

  1. Replicate steps 1 and 2 in the previous sub-section above. Then, right-click Trusted Platform Module 2.0 under Security devices and select Uninstall device from the displayed options.
  1. Following that, click the Uninstall button in the prompt that appears.
Fix "Your Computer's Trusted Platform Module Has Malfunctioned" Error By Updating Or Reinstalling The TPM Driver
  1. After doing all that, restart your PC. Thus, upon restart, Windows will automatically reinstall the TMP driver and potentially fix the error.

Option 3: Disable ADAL

Several individuals reported that disabling ADAL (Azure Active Directory Authentication Library) often fixes this error. To do that, follow the procedures below.

Messing with the Windows Registry poses a risk and can harm your PC if executed improperly. To avoid this, I recommend you diligently follow the upcoming instructions or create a restore point before proceeding.
  1. On the Windows 11 taskbar, right-click the Start button and select Run from the options that appear.
Fix "Your Computer's Trusted Platform Module Has Malfunctioned" Error By Disabling ADAL
  1. After that, type “regedit” in the Run input field and press the enter key. Subsequently, a User Account Control prompt will appear, asking for permission to authorize the application to make changes to your computer – click Yes to continue.
  1. When the Registry Editor opens, navigate to the following location using the folders on the left pane.
Computer\HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Common\Identity
Fix "Your Computer's Trusted Platform Module Has Malfunctioned" Error By Disabling ADAL
  1. Now, right-click any free area on the right pane, hover your mouse on New, and select DWORD (32-bit) Value.
  1. Following that, rename the new key as “EnableADAL”
Fix "Your Computer's Trusted Platform Module Has Malfunctioned" Error By Disabling ADAL
  1. Afterward, double-click the EnableADAL key to edit it. Then, ensure the Value data is set to “0” and click the OK button.
  1. Finally, restart your PC, and the issue should be fixed. If this procedure doesn’t fix the error, move on to the last solution below.

Option 4: Clear TPM 

Another viable solution to fix this error on your Windows 11 computer is to clear the TPM (Trust Platform Module). However, before doing that, ensure to back up all of your important files.

That being said, observe the following procedures to clear the TPM in Windows 11.

  1. Click the Start button on the Windows 11 taskbar. Then, input “windows security” in the search field and select the Windows Security app from the search result.
  1. On the Windows Security window, select Device security from the homepage.
Fix "Your Computer's Trusted Platform Module Has Malfunctioned" Error By Clearing TPM
  1. Now, click the Security processor details link under Security processor.
  1. Following that, in the Status category, click the Security processor troubleshooting link.
Fix "Your Computer's Trusted Platform Module Has Malfunctioned" Error By Clearing TPM
  1. Afterward, click the Select button in the Clear TPM category. Then, choose a reason you want to clear TPM from the list of options that appear.
  1. After doing that, click the Clear TPM button.
Fix "Your Computer's Trusted Platform Module Has Malfunctioned" Error By Clearing TPM
  1. Consequently, a prompt will appear listing a couple of things that could happen if you clear TPM – click Clear and restart from the prompt.
[mai mult...]

How to fix Windows 11 Widgets if not working

Solution 1: Re-enable Widgets

The easiest and fastest way to fix this problem is to disable and re-enable Widgets on your Windows 11 PC. To do that, follow the steps below.

  1. Right-click a free area on your Windows 11 taskbar and select Taskbar settings
  2. Following that, turn off and turn on the Widgets toggle on the Settings window’s right pane. After doing that, check if the problem has been fixed.If it hasn’t been fixed, try the other solutions below.
Fix Windows 11 Widgets If Not Working By Re-enabling Widgets

Solution 2: Restart Windows Widgets and Windows Explorer Processes

Another way to fix this problem is to restart the Windows Widgets and Windows Explorer processes on your Windows 11 PC. Follow the procedures below to accomplish that.

  1. Right-click your Windows 11 Start menu button and select Task Manager from the displayed options. Alternatively, you can also use the Ctrl + Shift + Esc keyboard shortcut to open Task Manager.
Fix Windows 11 Widgets If Not Working By Restarting Windows Widgets And Windows Explorer Processes
  1. Under the Background processes section in the Processes tab in Task Manager, right-click Windows Widgets and select End task.
  1. After doing that, right-click Windows Explorer under the Windows processes section and select Restart.
Fix Windows 11 Widgets If Not Working By Restarting Windows Widgets And Windows Explorer Processes
  1. After doing all that, check if your Windows 11 widgets are working again. If they are working, cheers!However, if they still aren’t working, check out the last solution of this guide below.

Solution 3: update Graphics Driver

In some instances, an outdated graphics driver can cause the widgets on your Windows 11 PC not to work. If that’s the case, updating the graphics driver on your PC should resolve the issue.

The following steps demonstrate how to update the graphics driver in Windows 11.

  1. On your Windows 11 taskbar, right-click the Start menu and select Device Manager from the options that appear
Fix Windows 11 Widgets If Not Working By Updating Graphics Driver
  1. Following that, double-click Display adapters on the Device Manager window to expand it
  1. Under Display adapters, right-click your PC’s graphics driver and select Update driver
Fix Windows 11 Widgets If Not Working By Updating Graphics Driver
  1. After that, click Search automatically for drivers on the Update Drivers window
  1. Consequently, Windows will start searching online for the latest graphics driver and automatically install it on your PC. Hence, ensure your Windows 11 PC is connected to the internet during this process.
Fix Windows 11 Widgets If Not Working By Updating Graphics Driver
  1. After updating your computer’s graphics driver, reboot your PC. Optimistically, the problem will be solved, and the widgets will start working again.
[mai mult...]

How to fix a Tombstoned Domain Controller

Step 1: Remove the DNS Server Role from the DC

This must be performed first. Otherwise, the DC demotion task (Step 2) fails.

#Open PowerShell as administrator

Uninstall-WindowsFeature -Name DNS

Restart the server to complete the removal of the DNS role.

Step 2: Remove the Global Catalog Role from the DC

If the server is badly broken, you must remove the Global Catalog role from the DC. Otherwise, the DC demotion will also fail.

  1. Open Active Directory Sites and Services via Server Manager (link opens in a new browser tab).
  2. Then, navigate to the DC’s site and expand it, then expand Servers and click the server name. On the details blade, right-click NTDS Settings, and select Properties.
  1. After that, clear the Global Catalog check box, select Yes to the warning message, and finally, select OK.
clear the Global Catalog check box, select Yes to the warning message, and choose OK

Step 3: Demote the Server as a Domain Controller

#1. Save the password to use as local Administrator password. At the cred prompt, enter Administrator as the username and then, the password you want to use as the server's local Administrator password post its demotion as a DC

$password = Get-Credential

#2. Demote the Server as a DC

Uninstall-ADDSDomainController -LocalAdministratorPassword $password.password -Confirm:$false -NoRebootOnCompletion -ForceRemoval -SkipPreChecks

See the results of the commands below:

Save the password to use as local Administrator password. At the cred prompt, enter Administrator as the username and then, the password you want to use as the server's local Administrator password post its demotion as a DC
Uninstall-ADDSDomainController -LocalAdministratorPassword $password.password -Confirm:$false -NoRebootOnCompletion -ForceRemoval -SkipPreChecks

Restart the server to complete the demotion.

Step 4: Perform Metadata Cleanup from the FSMO Role Holder

After demoting the DC, before re-proting it, you must perform a metadata cleanup of the DC using ntdsutil.

Follow the steps below to complete this task.

  1. Determine the FSMO role holder by running the command below from any Domain Controller.
netdom query fsmo
  1. Sign into the DC that holds the FSMO roles and open the command prompt as administrator. Then, run the following ntdsutil commands in the order provided.
#1. Type ntdsutil and press enter. Then, on the ntdsutil prompt, type metadata cleanup and press enter

ntdsutil: metadata cleanup

#2. On the metadata cleanup: prompt, execute the followin commands

metadata cleanup: connections
metadata cleanup: connect to server <domain_fsmo-role-holder>
metadata cleanup: q

#3. Then, on the metadata cleanup: prompt, type select operation target, then press enter key. 

metadata cleanup: select operation target

#4. On the select operation target: prompt, run the following commands in order:

select operation target: list domains
select operation target: select domain <enter number for the domain where the failed DC resides>
select operation target: list sites
select operation target: select site <enter the site number of the failed DC>
select operation target: list servers in site
select operation target: select server <enter number of the server>
select operation target: q

#5. On the metadata cleanup: prompt, execute remove selected server
metadata cleanup: remove selected server
Then, on the Server Remove Confirmation Dialog, confirm that the DC you want to remove is displayed, then select Yes. 
#6. Quit metadata cleanup and ntdsutil by executing the q command in both prompts
On the metadata cleanup: prompt, execute remove selected server
  1. Log on to the FSMO role DC and force replication by running the command below from a command prompt opened as administrator.
repadmin /syncall <domain_fsmo-role-holder> /Aped

Quit the repadmin command by pressing any key.

  1. Then, monitor the progress of the replication by running the command below. Replace the text in bold with the Distinguished Name of the server you’re cleaning its metadata.
repadmin /showobjmeta * "<enter the Distinguished Name of the server here>"

For the avoidance of doubt, the above command must only return parts of the result that says “Directory object not found.” If it rertuns a table, you must wait until the command no longer returns a table.

Step 5: Reinstall the DNS Server Role on the Server

In Step 1, we removed the DNS Server role. Before promoting it to a DC, you must reinstall this role with the following steps:

  1. Sign in to the server as local administrator – enter .\administrator in the username field – and use the password you specified in Step 3 when you demoted the server as a DC.
  2. Execute the command below to reinstall the DNS Server role, including all sub-features and management tools, and restart the server if required.
#Open PowerShell as administrator

Install-WindowsFeature -Name DNS -IncludeAllSubFeature -IncludeManagementTools -Restart
#see the screenshots below for the progress and result of the command
Reinstall the DNS Server Role on the Server 1
Reinstall the DNS Server Role on the Server 2
[mai mult...]