Blog InstructionsGNU/Linux

How to install CUDA 5.0 Toolkit on Ubuntu 12.04

This set of instructions explains how to get a complete CUDA 5.0 Toolkit compiler up and running in Ubuntu 12.04 for the x86_64 architecture.
It explains how to avoid getting stuck with a fast booting bios and missing out on loading GRUB by introducing a 3 second timeout. This timeout can be removed after everything is set up.
It also explains how to fix all the linking issues with the toolchains, and how to fix a garbled display when setting up a machine for use with Cuda 5.0 on Ubuntu 12.04.

Be careful when pasting this code, you need to fix the line wrapping yourself. Sorry about that.

cd ~/Desktop
chmod +x
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/ /usr/lib/

#Edit this file:
sudo gedit /etc/modprobe.d/blacklist.conf

#Put this at the end of the file:

blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv

#Save and close.

#Edit this file:
sudo gedit /etc/default/grub

#Put these settings in the file:

GRUB_CMDLINE_LINUX_DEFAULT=”nomodeset” # used to be quiet splash
GRUB_TERMINAL=console # fixes stupid slow scrolling problem in grub

sudo update-grub


#Hit LEFT SHIFT when 3 second countdown

#Append this word to the end of the linux boot option:

#Hit Ctrl-X to boot

#Login in text mode:

#Remove all nvidia crap
sudo apt-get remove --purge nvidia-*

#BACKUP YOUR xorg.conf then do this:

sudo dpkg-reconfigure xserver-xorg
sudo apt-get install -V nvidia-experimental-310 nvidia-experimental-310-dev
sudo ln -s /usr/lib/nvidia-experimental-310/ /lib/

#Restore your xorg.conf

#Check your version of gcc/g++, you need 4.5
gcc -v
sudo apt-get install gcc-4.5
sudo apt-get install g++-4.5
cd /usr/bin
sudo rm gcc
sudo ln -s gcc-4.5 gcc
sudo rm g++
sudo ln -s g++-4.5 g++

cd ~/Desktop
sudo ./

#Fix up linker options by creating this new file:

sudo nano /etc/

#Throw in these two lines, save and quit


#Update linker config
sudo ldconfig

#Add this to your path (or whichever place you told it to install):
sudo gedit ~/.bashrc

export PATH=${PATH}:/usr/local/cuda-5.0/bin

Now you should be able to compile Cuda 5.0 Samples or your own project using Ubuntu 12.04!

2 thoughts on “How to install CUDA 5.0 Toolkit on Ubuntu 12.04

Leave a Reply

Your email address will not be published. Required fields are marked *