Ubuntu 22.04 PrivateGPT Instructions

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

##Create VM with at least 50GB of space

##Download/Install Ubuntu LTS 22.04 (Minimal Install)

sudo apt update


sudo apt upgrade

##Nvidia Driver/Cuda Installation

##Blacklist nouveau driver


sudo nano /etc/modprobe.d/blacklist-nouveau.conf

##add to end of file


blacklist nouveau
options nouveau modeset=0

#Update
sudo update-initramfs -u

##Reboot VM
reboot

##Grab the current driver for your card (ie 470 for my Tesla P4)
sudo ubuntu-drivers devices

sudo apt install nvidia-driver-470


reboot

##Verify drivers
nvidia-smi

##Verify gcc installed


gcc —version

##Install CUDA Toolkit


wget
https://developer.download.nvidia.com/compute/cuda/repos/ub
untu2204/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update
sudo apt-get -y install cuda
reboot
##Add Environment Variable
sudo nano ~/.bashrc

##add at the bottom


export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-
12.3/lib64\${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Source ~/.bashrc

##Verify cuda install


nvcc -V

##PrivateGPT installation

##Install Python3.11

sudo add-apt-repository ppa:deadsnakes/ppa


sudo apt install python3.11 python3.11-venv git pip -y
sudo update-alternatives --install /usr/bin/python3 python3
/usr/bin/python3.10 110
sudo update-alternatives --install /usr/bin/python3 python3
/usr/bin/python3.11 100
sudo update-alternatives --config python3
select option2 (3.11)

##Verify version 3.11


python3 --version

##verify pip
python3 -m pip install pip

##Install poetry
pip install poetry

##Add Environment Variable


sudo nano ~/.bashrc

##add to end of file


export PATH=“/home/{insert-username-here}/.local/bin:$PATH”
##update source
source ~/.bashrc

##Verify Poetry Version (1.7)


poetry --version

##Setup privateGPT
git clone https://github.com/imartinez/privateGPT

##Set permissions on privateGPT


sudo chown -R {insert-username-here} privateGPT

##Change Directory
cd privateGPT

##Create/enter python environment


python3 -m venv venv
source venv/bin/activate
poetry install --with ui,local
poetry run python scripts/setup
CMAKE_ARGS='-DLLAMA_CUBLAS=on' poetry run pip install --
force-reinstall --no-cache-dir llama-cpp-python

##Optional

##Make BASH script to run on boot (There is probably a better way to do this
and if someone wants to provide it ill update this)

sudo nano /privateGPT.sh

#!/bin/bash
cd /home/{put-username-here}/privateGPT
python3 -m venv venv
source venv/bin/activate
PGPT_PROFILE=local make run

##Change ownership and permissions on file


sudo chmod +x /privateGPT.sh
sudo chown root /privateGPT.sh
##Add bash script to cron to run on startup
Crontab -e
##Choose nano and add to the end
@reboot /privateGPT.sh

##To stop the service if its running in the background


ps -ef | grep python
##take note of the process number
Kill -9 {insert-process-number}

##If you run into memory issues when you are trying to ingest files into GPT
##Kill the process from the previous step

cd ~/privateGPT
nano settings.yaml

##Edit the “embedding” mode from local to mock


##Ingest the files you want
##Then edit the file again back to local

##If you ingest files and need to remove them you can erase them all with
Make wipe

You might also like