Installing Ubuntu 19.04 Server on desktop with Nvidia GPUs
Introduction
Notes based on my experience installing and setting up a desktop machine to run Ubuntu 19.04 server.
Installing Ubuntu
- Download iso from here
- Download unetbootin from here
- Have an empty ~4GB USB pen drive
- Use unetbootin to flash the above iso into this usb drive
- Boot via this usb drive on your desktop
- In boot menu select 'Install Ubuntu ...'
- Follow the instructions on screen
- Don't forget to select "Install OpenSSH", if you want remote access
- Select to upgrade and install ubuntu (optional)
- Provide hostname, username and credentials
- Wait until finished!
Setting up
Basics
My personal preference is to use python3. So, I just remove python2.7.
sudo apt remove python2.7 python python2.7-minimal
sudo apt purge python2.7 python python2.7-minimal
sudo apt autoremove
sudo ln -s /usr/bin/python3 /usr/bin/python
Some essentials:
sudo apt-get install curl g++ gcc git make tmux
docker
Following steps will let you run docker commands without sudo
:
curl -sSL https://get.docker.com/ | sudo sh
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
nvidia driver
- Make sure card is getting detected:
lspci | grep -i nv
. - Install kernel headers:
sudo apt-get install linux-headers-$(uname -r)
- Download toolkit installer:
wget https://developer.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.168_418.67_linux.run
- Install only the driver:
sudo sh cuda_10.1.168_418.67_linux.run --driver
- Disable nouveau driver:
sudo sh -c "echo blacklist nouveau > /etc/modprobe.d/blacklist-nouveau.conf && echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nouveau.conf && update-initramfs -u && reboot"
nvidia-smi
should now run successfully.
nvidia-docker
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | \
sudo apt-key add -
# this is because 19.04 is not yet supported, at the time of this writing
# thus, force fallback on 18.04 version's release
# that seems to be working fine
#distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
distribution=18.04
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 nvidia-docker2
sudo pkill -SIGHUP dockerd