2011年10月21日 星期五

CentOS 6 安裝Nvidia驅動

真是煎熬的過程啊!

安裝過程中遇到一大堆錯誤

不過也感謝前輩們在網路上發得教學文跟GOOGLE大神

在這邊發個教學文

以便自己以後需要用到或者是其他有相同困擾的朋友們

系統:CentOS 6 (32bit)

顯示卡: Nvidia Gforce 9600GT
--------------------------------------------------------------

1)首先請先至官方網站下載您的顯示卡驅動
http://www.nvidia.com.tw/Download/index.aspx?lang=tw

Ps:下載格式為.run 因為瀏覽器無法正確判斷出為下載檔案

◎使用Firefox
(1)在"同意和下載"之按鈕點選右鍵
(2)選取"鏈結另存新檔"

◎使用Google Chrome
(1)在"同意和下載"之按鈕點選右鍵
(2)選取"另存連結為 "

即可將.run檔下載下來
建議下載完放在家目錄底下,用以方便安裝!


2)打開終端機並且進入超級使用者模式
$ su
輸入你的root密碼

3)切換成文字模式,並且登入使用者帳戶,再登入root帳戶
$ init 3 (會切換成文字模式)
   請輸入使用者帳戶名稱
   請輸入使用者帳戶密碼

4)安裝Nvidia顯示卡驅動
$ sh NVIDIA-Linux-x86-285.05.09.run
打完指令之後,會進入一個藍底的畫面
要你點選接不接受他的條款(當然是接受囉!)
接著重點出現了!就出現Error的畫面了

以下是出現的錯誤
ERROR: The Nouveau kernel driver is currently in use by your system. This driver is incompatible with the NVIDIA driver, and must be disabled before proceeding. Please consult the NVIDIA driver README and your Linux distribution's documentation for details on how to correctly disable the Nouveau kernel driver.
        Nouveau kernel driver 這個驅動正在被系統使用,這個驅動和Nvidia驅動衝突,要想繼續安裝,則必須禁用此驅動!因為Centos 6 系統默認裝的顯卡驅動就是Nouveau . Nouveau是一個由愛好者組織的針對NVIDIA顯卡開發第三方開源3D驅動的共同項目,並且Nouveau是在完全沒有得到NVIDIA任何支 持的情況下進行開發的,Nouveau算是X.Org基金會的一個項目。

為了方便以下使用者操作,請返回圖形介面模式
$ init 5

5)關閉CentOS內建顯卡驅動 Nouveau
進入/etc/modprobe.d/blacklist.conf 將Nouveau 加入黑名單
輸入以下指令
$ vi /etc/modprobe.d/blacklist.conf

編輯請點鍵盤i, 在最後一行輸入 blacklist nouveau

點選esc跳出編輯模式,輸入:wq 儲存並且跳出

6)使用 dracut重新建立  initramfs image file :
* 備份 the initramfs file,輸入以下指令
$ sudo mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak

* 重新建立 the initramfs file,輸入以下指令
$ sudo dracut -v /boot/initramfs-$(uname -r).img

7)接著再返回文字介面
 $ init 3

Ps.記得登入進去超級使用者模式喔($ su) 

會發現文字變大了,表示Nouveau驅動已經沒被加載了,成功禁用了Nouveau

8)檢查nouveau driver確保沒有被加載!<此步驟小弟我輸入了也沒發生啥事= =>
 $ lsmod | grep nouveau

9)運行安裝模式
$ sudo ./NVIDIA-Linux-x86_64-195.36.15-pkg2.run

結果又出現Error,有完沒完啊?
unable to find the development tool 'cc' in your path. please make sure you have the package 'gcc' installed. if gcc installed on your system, please check 'cc' is in your path.
看到gcc就想到以前用linux寫程式需要的編譯器,感覺上就是沒安裝(真的有夠討人厭),所以呢!再返回去文字介面,輸入
$ yum install gcc

或者你是出現另一個error
Error: unable to find the kernel source tree for the currently running kernel. Please make sure you have installed the kernal source files for your kernel and that they are properly configured; on Red Hat Linux systems, for example, be sure you have the 'kernel-source' or 'kernel-devel' RPM installed. If you know the correct kernel source files are installed, you may specify the kernel source path with the '--kernel-source-path' command line option.
輸入
$ yum install kernel-devel (先升級系統 yum update 再裝驅動)

10)重新啟動系統,即可完成安裝
$reboot

本文參考:http://blog.chinaunix.net/space.php?uid=20781850&do=blog&id=2132949

2 則留言:

  1. 請問你有測過哪個型號的顯示卡對 RHEL 5(CentOS 5)支援度最好嗎?

    回覆刪除
    回覆
    1. 哇!抱歉很晚才看到你的留言
      因為這項作業是很久以前做的了

      我的印象是很N牌的驅動較多,ATI沒試過
      (我之前GT9600可以安裝,且支援度滿好的,我同學8xxx就半殘怪怪的,但也要看官方是否有出相容驅動)
      我在推測最新的顯卡支援度就會比較差
      建議挑選不會太舊也不會太新的顯卡
      因為Linux算是非主流的OS,我相信官方不會那麼勤快去寫這些Driver

      希望可以幫助到你,也謝謝你的拜訪 :目

      刪除