-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdebian12-xfce-nvidia.yaml
133 lines (133 loc) · 4.23 KB
/
debian12-xfce-nvidia.yaml
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#cloud-config
disable_root: false
network:
config: disabled
users:
- name: ${USERNAME}
groups: users, admin, docker, sudo, kvm
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
lock_passwd: false
passwd: ${PASSWORD}
ssh_import_id:
- gh:${GITHUB_USER}
- name: ${VM_ADMIN}
gecos: system acct
groups: users, admin, docker, sudo
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
lock_passwd: false
passwd: ${PASSWORD}
ssh_authorized_keys:
- ${VM_KEY}
write_files:
- path: /etc/netplan/99-my-new-config.yaml
permissions: '0644'
content: |
network:
ethernets:
${INTERFACE}:
dhcp4: no
dhcp6: no
addresses: [${STATIC_IP_ADDRESS}/24]
routes:
- to: default
via: ${GATEWAY_IP}
mtu: 1500
nameservers:
addresses: [${DNS_SERVER_IP}]
renderer: networkd
version: 2
- path: /etc/modprobe.d/nouveau.conf
content: |
blacklist nouveau
- path: /var/lib/cloud/scripts/per-boot/nvidia-installer.sh
permissions: "0755"
content: |
#!/bin/bash
/NVIDIA-Linux-x86_64-*/nvidia-installer --silent --install-compat32-libs --no-nouveau-check
sudo nvidia-xconfig
package_update: true
package_upgrade: true
packages:
- ssh-import-id
- sudo
- curl
- tmux
- netplan.io
- apt-transport-https
- ca-certificates
- software-properties-common
- git-extras
- rsyslog
- fail2ban
- htop
- gpg
- open-iscsi
- nfs-common
- kmod
- pkg-config
- make
- libvulkan1
- dbus
- dbus-x11
- xvfb
- xorg
- xinit
- x11vnc
- xfce4
- xfce4-goodies
- tzdata
- wget
- gcc
- firefox-esr
runcmd:
#####################
# Apply netplan config
- /usr/sbin/netplan --debug generate
- /usr/sbin/netplan --debug apply
- sleep 5
- rm /etc/netplan/50*
#####################
# Download kernel headers
- sudo apt-get install -y linux-headers-amd64
- sudo apt-get install -y linux-headers-`uname -r`
#####################
# Import SSH keys
- sudo -u ${USERNAME} ssh-import-id-gh ${GITHUB_USER}
######################
# Install YQ
- wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq &&\
- chmod +x /usr/bin/yq
######################
# Install Docker
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
- echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- sudo apt-get update
- sudo apt-get install -y docker-ce
########################
# Install Docker Compose
- sudo -u ${USERNAME} -i mkdir -p /home/${USERNAME}/.docker/cli-plugins/
- sudo -u ${USERNAME} -i curl -SL https://github.com/docker/compose/releases/download/v2.17.3/docker-compose-linux-x86_64 -o /home/${USERNAME}/.docker/cli-plugins/docker-compose
- sudo chmod +x /home/${USERNAME}/.docker/cli-plugins/docker-compose
########################
# Brew and Python3
- wget https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh
- chmod +x /install.sh
- chmod 777 /install.sh
- sudo -u ${USERNAME} NONINTERACTIVE=1 /bin/bash /install.sh
- sudo -u ${USERNAME} /home/linuxbrew/.linuxbrew/bin/brew shellenv >> /home/${USERNAME}/.profile
- sudo -u ${USERNAME} /home/linuxbrew/.linuxbrew/bin/brew install python@3.11
- sudo -u ${USERNAME} /home/linuxbrew/.linuxbrew/opt/python@3.11/libexec/bin >> /home/${USERNAME}/.profile
- sudo chown -R ${USERNAME}:${USERNAME} /home/linuxbrew
- sudo chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}
########################
# Configure System Services
- sudo systemctl disable lightdm.service
- sudo systemctl enable fail2ban
- sudo systemctl start fail2ban
########################
# Download and extract the Nvidia driver
- wget -O NVIDIA-Linux-x86_64.run https://us.download.nvidia.com/XFree86/Linux-x86_64/525.125.06/NVIDIA-Linux-x86_64-525.125.06.run
- bash NVIDIA-Linux-x86_64.run -x
- reboot