Skip to content

Instantly share code, notes, and snippets.

@c9s c9s/debian-8-opencv-gpu
Last active Sep 26, 2017

What would you like to do?
This script allows you to install Nvidia CUDA 8 and OpenCV with GPU support
# update the base system packages
apt-get update && apt-get upgrade -y
# Update source list for cuda and python3.6
cat <<ENDLIST >> /etc/apt/sources.list
# non-free to nvidia-cuda-toolkit
deb stretch non-free
deb stretch contrib
# experimental for python3.6
deb experimental main
deb unstable main
echo 'APT::Default-Release "stable";' | sudo tee -a /etc/apt/apt.conf.d/00local
apt-get update && apt-get upgrade -y
apt-get -t experimental install -y cmake golang-1.8 build-essential git wget unzip yasm pkg-config \
libswscale-dev \
libeigen3-dev \
libtbb2 \
libtbb-dev \
libjpeg-dev \
libavformat-dev \
libpng-dev \
libtiff-dev \
libpq-dev \
python3.6 python3.6-dev libboost-python1.63-dev
# unsupported GNU version! gcc versions later than 5 are not supported by CUDA
# -D CMAKE_C_COMPILER=/usr/bin/gcc-5
# -D CMAKE_CXX_COMPILER=/usr/bin/g++-5
apt-get install -y gcc-5 g++-5
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 1
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 1
# python3-pip doesn't depends on python3.6, it depends on all python >= 3.4
apt-get install -y python3-pip
pip3 install numpy
pip3 install scipy
# install nvidia-cuda
apt-get install -y nvidia-cuda-toolkit
cat <<ENDLIST >> /etc/profile.d/cuda
export CUDA_HOME=/usr/lib/nvidia-cuda-toolkit
export PATH=\$PATH:\$CUDA_HOME/bin
source /etc/profile.d/cuda
rm -f build-python3
curl -O
bash build-python3
# install docker
# curl -sSL | sh
# usermod -aG docker c9s
# install nvidia docker
sudo dpkg -i nvidia-docker*.deb
sudo nvidia-docker run --rm nvidia/cuda nvidia-smi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.