Install Nvidia Driver&Docker&NV Docker
fatwinnie edited this page Apr 22, 2019
·
2 revisions
Download runfile fromNVIDIA Website
先安裝gcc, make這兩個套件,因安裝驅動時需要
sudo apt update
sudo apt install gcc make
將下載之驅動,改成可執行的狀態才可run
sudo chmod +x NVIDIA-Linux-x86_64-418.43.run
./NVIDIA-Linux-x86_64-418.43.run
sudo reboot #安裝完要重新開機
Get Dcoker CE for Ubuntu
#Update the apt package index
sudo apt-get update
#Install packages to allow apt to use a repository over HTTPS
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
#匯入Docker的GPG金鑰
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
#Verify that you now have the key with the fingerprint
sudo apt-key fingerprint 0EBFCD88
# Set up the docker stable repository
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
#Install the latest version of Docker CE
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
#執行Hello World容器來測試Docker CE有無安裝成功
sudo docker run hello-world
#不是root的用户,可以把自己加至「docker」群組內。下面的命令可以讓没有root權限的用户使用Docker
#之後指令就不用加sudo
sudo usermod -aG docker $USER
#設定完後重新啟動才會生效
sudo reboot
Get NVIDIA Docker 2
# Add the package repositories
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
# Install nvidia-docker2 and reload the Docker daemon configuration
sudo apt-get install -y nvidia-docker2
sudo pkill -SIGHUP dockerd
# Test nvidia-smi with the latest official CUDA image
docker run --runtime=nvidia --rm nvidia/cuda:9.0-base nvidia-smi