Skip to content

Instantly share code, notes, and snippets.

@kengz
Last active July 18, 2024 11:04
Show Gist options
  • Save kengz/a106e03a782cfaec339433daf8965d76 to your computer and use it in GitHub Desktop.
Save kengz/a106e03a782cfaec339433daf8965d76 to your computer and use it in GitHub Desktop.
Ubuntu GPU server setup

Ubuntu GPU Server Setup

Quick and smooth setup of Ubuntu GPU server, including proper installation of Nvidia driver.

Estimated time: < 1 hour

  1. Download the “alternative” server image from Ubuntu: Alternative downloads | Ubuntu
  2. Create a bootable USB stick on macOS | Ubuntu
  3. Go to BIOS, disable secure boot. Then boot UEFI. Install Ubuntu, overwrite full partition, add SSH Server. Finish installation and login.
  4. You can now ssh in with password. Login and install nvidia driver. Since secure boot is disable, nvidia installation should go smoothly.
# if you install ubuntu server no GUI, ok
sudo add-apt-repository ppa:graphics-drivers
sudo apt-get update
sudo apt install ubuntu-drivers-common
ubuntu-drivers devices
# this will show a list of drivers
sudo apt-get install nvidia-driver-440
# reboot required later

# install Docker
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt update
apt-cache policy docker-ce
sudo apt install docker-ce
sudo usermod -aG docker ${USER}

# install nvidia-container-toolkit to run Docker with GPU
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
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
sudo systemctl restart docker
  1. Configure WiFi Connections | NetworkManager documentation.
# if you have wifi
sudo apt-get install network-manager
sudo /etc/init.d/network-manager restart
nmcli d
nmcli r wifi on
nmcli d wifi list
nmcli d wifi connect my_wifi password <password>
  1. setup ssh keys, authorized keys, sshd_config:
ssh-keygen
nano ~/.ssh/authorized_keys
chmod 400 ~/.ssh/authorized_keys
sudo nano /etc/ssh/sshd_config
# set: PasswordAuthentication no
sudo systemctl restart sshd
  1. install zsh and change shell:
sudo apt install zsh
chsh -s $(which zsh)
# then restore your dotfiles from git
  1. Install libraries:
# xvfb, roboschool, orca dependencies
sudo apt-get install xvfb libpcre16-3 libgtk2.0-0 libxss1 libgconf2-4 libnss3
# install glances
curl -L https://bit.ly/glances | /bin/bash
  1. Reboot:
sudo reboot now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment