blob: 5f2f294950b05ad1d8c420738230d23923004c0c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
Vagrant.configure("2") do |config|
config.vm.box = "generic/ubuntu2204" # Or any other preferred Linux distribution
# Configure VM hardware
config.vm.provider "libvirt" do |virt|
virt.memory = 32768
virt.cpus = 4
virt.pci :bus => '26', :slot => '0', :function => '1'
end
# Provisioning script
config.vm.provision "shell", inline: <<-SHELL
# Update and install prerequisites
sudo apt-get update
sudo apt-get install -y curl gnupg build-essential
# Add NVIDIA package repositories
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/$distribution/x86_64/7fa2af80.pub
echo "deb https://developer.download.nvidia.com/compute/cuda/repos/$distribution/x86_64 /" | sudo tee /etc/apt/sources.list.d/cuda.list
echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/$distribution/x86_64 /" | sudo tee /etc/apt/sources.list.d/nvidia-ml.list
# Install NVIDIA drivers and CUDA toolkit
sudo apt-get update
sudo apt-get install -y cuda
# Add CUDA to the PATH
echo 'export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashrc
source ~/.bashrc
# Install Tailscale
curl -fsSL https://tailscale.com/install.sh | sh
# Install NVIDIA container toolkit
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
# Restart Docker to load the NVIDIA runtime
sudo systemctl restart docker
SHELL
end
|