How to install CUDA, CUDNN and TensorFlow in GPU Server


This article will show you how to install CUDA 10.0 + cudnn 7.6 + keras 2.3.1 + tensorflow 1.15.2 + python 3.7.10 in Ubuntu 18 OS. In other Linux OS, the KB is not suitable.

9 Steps to install CUDA, CUDNN and TensorFlow in GPU Server

Step 1: Install GCC
# sudo apt update
# sudo apt install build-essential
# sudo apt-get install manpages-dev
# gcc --version
Install GCC
Step 2: Install GPU driver.(You could upload it from terminal server.)

Note: The version of GPU driver must match the version of CUDA. The following driver is matching the CUDA 10.0.

Install GPU driver

Note: During this installation, you might encounter the following issue:

Install GPU driver

Detailed error information:Error 1:

Install GPU driver

Solution 1:

A: Edit the file /etc/modprobe.d/blacklist-nouveau.conf and add the following contents to this file:
blacklist nouveau
options nouveau modeset=0

B: running the following command to regenerate the initramfs file
sudo update-initramfs -u

C: Reboot the server

Error 2:

Install GPU driver

Solution 2:
Running the following command:

# sudo apt-get install linux-headers-`uname -r`
Step 3: Install CUDA 10.0
# sudo apt-get install freeglut3 freeglut3-dev libxi-dev libxmu-dev
# wget
# wget
# mv cuda_10.0.130_410.48_linux
# sudo sh
Install CUDA 10.0
Install CUDA 10.0
Step 4: Install CUDA Patch
# sudo sh
Install CUDA Patch
Step 5: Set up the environment path
# export PATH=/usr/local/cuda-10.0/bin:$PATH
# export LD_LIBRARY_PATH=/usr/local/cuda-10.0/64:$LD_LIBRARY_PATH
Set up the environment path
Step 6: Install CUDNN 7.6

6.1 Upload the .tgz file from our terminal server.

6.2 Running the following commands

# tar xvf cudnn-10.0-linux-x64-v7.4.2.24.tgz
# sudo cp -P cuda/include/cudnn.h /usr/local/cuda/include (This path should be update)
# sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda/lib64
# sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

6.3 Check if CUDNN is installed successfully

# cat /usr/local/cuda-10.0/include/cudnn.h |grep CUDNN_MAJOR -A 2
Step 7: Install TensorFlowGPU

7.1 Install anaconda

# wget
# bash

During the installation process, keep pressing enter until yes/no appears. Enter yes. When asked whether to add environment variables, be sure to enter y.

7.2 Check if anaconda is installed successfully

Disconnect the server, reconnect to the server, and enter python. If no error is reported, the installation is successful.
Unexpected situation: If the environment variables are not configured successfully, the following operations need to be performed
(1) Enter the following command in the terminal: vim ~/.bashrc Open the bashrc file and edit it
(2) Add this line after the bashrc file. After PATH, add the path of the installed anaconda: export PATH=/home/.../bin:$PATH
(3)Activation file: source ~/.bashrc

7.3 Install TensorFlowGPU 1.15

# conda install --channel tensorflow-gpu=1.15

7.4 Check if TensorFlowGPU is installed successfully

# python
>>>import tensorflow as tf
>>> tf.test.is_built_with_cuda()
>>> tf.test.is_gpu_available(cuda_only=False,min_cuda_compute_capability=None)
Check if TensorFlowGPU is installed successfully
Check if TensorFlowGPU is installed successfully
Step 8: Check the version of TensorFlowGPU
pip list | grep -i tensor
pip list | grep -i keras
Contact Us and Get a 3-Day Trial Now!
Leave us a note when purchasing, or contact us to apply a trial GPU server. You have enough time to test the performance, network latency, compatibility, multiple instance capacity, etc.
Recommend Friends, Get Credits
$20 will be credited to your account once you recommend a new client to purchase servers. Rewards can be superimposed.
Hosted Nvidia GPU servers