ubuntu 安装NVIDIA显卡驱动

终于可以用ubuntu的桌面特效了。安装了 compiz和显卡驱动。


第一步,在官方网站上下载对于的驱动安装文件。

第二步, 取消然来的显卡的驱动(如果已经默认安装了)

这一步有两个方法,运行下载的安装文件,它会帮你生成一个  /etc/modprobe.d/nvidia-installer-disable-nouveau.conf 文件,阻止启动的时候加载老的驱动。这样才能顺利安装新的驱动。
方法二,参考如下,自己建一个*.conf文件,添加内容是: blacklist nouveau options nouveau modeset=0

官方参考如下:

“8.1. Interaction with the Nouveau Driver

What is Nouveau, and why do I need to disable it?

Nouveau is a display driver for NVIDIA GPUs, developed as an open-source project through reverse-engineering of the NVIDIA driver. It ships with many current Linux distributions as the default display driver for NVIDIA hardware. It is not developed or supported by NVIDIA, and is not related to the NVIDIA driver, other than the fact that both Nouveau and the NVIDIA driver are capable of driving NVIDIA GPUs. Only one driver can control a GPU at a time, so if a GPU is being driven by the Nouveau driver, Nouveau must be disabled before installing the NVIDIA driver.

Nouveau performs modesets in the kernel. This can make disabling Nouveau difficult, as the kernel modeset is used to display a framebuffer console, which means that Nouveau will be in use even if X is not running. As long as Nouveau is in use, its kernel module cannot be unloaded, which will prevent the NVIDIA kernel module from loading. It is therefore important to make sure that Nouveau's kernel modesetting is disabled before installing the NVIDIA driver.

How do I prevent Nouveau from loading and performing a kernel modeset?

A simple way to prevent Nouveau from loading and performing a kernel modeset is to add configuration directives for the module loader to a file in /etc/modprobe.d/. These configuration directives can technically be added to any file in /etc/modprobe.d/, but many of the existing files in that directory are provided and maintained by your distributor, which may from time to time provide updated configuration files which could conflict with your changes. Therefore, it is recommended to create a new file, for example, /etc/modprobe.d/disable-nouveau.conf, rather than editing one of the existing files, such as the popular/etc/modprobe.d/blacklist.conf. Note that some module loaders will only look for configuration directives in files whose names end with .conf, so if you are creating a new file, make sure its name ends with.conf.

Whether you choose to create a new file or edit an existing one, the following two lines will need to be added:

blacklist nouveau
options nouveau modeset=0

The first line will prevent Nouveau's kernel module from loading automatically at boot. It will not prevent manual loading of the module, and it will not prevent the X server from loading the kernel module; see "How do I prevent the X server from loading Nouveau?" below. The second line will prevent Nouveau from doing a kernel modeset. Without the kernel modeset, it is possible to unload Nouveau's kernel module, in the event that it is accidentally or intentionally loaded.

You will need to reboot your system after adding these configuration directives in order for them to take effect.

If nvidia-installer detects Nouveau is in use by the system, it will offer to create such a modprobe configuration file to disable Nouveau.

What if my initial ramdisk image contains Nouveau?

Some distributions, particularly recent Red Hat/Fedora distributions, include Nouveau in an initial ramdisk image (henceforth referred to as "initrd" in this document, and sometimes also known as "initramfs"), so that Nouveau's kernel modeset can take place as early as possible in the boot process. This poses an additional challenge to those who wish to prevent the modeset from occurring, as the modeset will occur while the system is executing within the initrd, before the directives in /etc/modprobe.d are processed.

If you have an initrd which loads the Nouveau driver, you will additionally need to ensure that Nouveau is disabled in the initrd. If your initrd understands the rdblacklist parameter, you can add the optionrdblacklist=nouveau to your kernel's boot parameters. This should be done in your bootloader's configuration file(s), so that the option gets passed to your kernel every time the system is booted. Please consult your distribution's documentation on how to configure your bootloader, as different distributions use different configuration files.

An alternative is to rebuild your initrd without Nouveau. If you choose this option instead of configuring your bootloader, please consult your distribution's documentation on how to rebuild the initrd, as different distributions have different tools for building and modifying the initrd.

How do I prevent the X server from loading Nouveau?

Blacklisting Nouveau will only prevent it from being loaded automatically at boot. If an X server is started as part of the normal boot process, and that X server uses the Nouveau X driver, then the Nouveau kernel module will still be loaded. Should this happen, you will be able to unload Nouveau with `modprobe -r nouveau` after stopping the X server, as long as you have taken care to prevent it from doing a kernel modeset; however, it is probably better to just make sure that X does not load Nouveau in the first place.

If your system is not configured to start an X server at boot, then you can simply run the NVIDIA driver installer after rebooting. Otherwise, the easiest thing to do is to edit your X server's configuration file so that your X server uses a non-modesetting driver that is compatible with your card, such as the vesa driver. You can then stop X and and install the driver as usual. Please consult your X server's documentation to determine where your X server configuration file is located.”


第三步,从新启动系统。Ubuntu进入recovery模式。然后选择"boot",进入终端,运行下载的驱动文件。一步一步下去就可以安装了。


参考如下。

Starting the Installer

After you have downloaded the file NVIDIA-Linux-x86_64-295.59.run, change to the directory containing the downloaded file, and as the root user run the executable:

    # cd yourdirectory
    # sh NVIDIA-Linux-x86_64-295.59.run

The .run file is a self-extracting archive. When executed, it extracts the contents of the archive and runs the contained nvidia-installer utility, which provides an interactive interface to walk you through the installation.

nvidia-installer will also install itself to /usr/bin/nvidia-installer, which may be used at some later time to uninstall drivers, auto-download updated drivers, etc. The use of this utility is detailed later in this chapter.

You may also supply command line options to the .run file. Some of the more common options are listed below.

Common .run Options

--info

Print embedded info about the .run file and exit.

--check

Check integrity of the archive and exit.

--extract-only

Extract the contents of ./NVIDIA-Linux-x86_64-295.59.run, but do not run nvidia-installer.

--help

Print usage information for the common commandline options and exit.

--advanced-options

Print usage information for common command line options as well as the advanced options, and then exit.

Installing the Kernel Interface

The NVIDIA kernel module has a kernel interface layer that must be compiled specifically for each kernel. NVIDIA distributes the source code to this kernel interface layer.

When the installer is run, it will check your system for the required kernel sources and compile the kernel interface. You must have the source code for your kernel installed for compilation to work. On most systems, this means that you will need to locate and install the correct kernel-source, kernel-headers, or kernel-devel package; on some distributions, no additional packages are required.

After the correct kernel interface has been compiled, the kernel interface will be linked with the closed-source portion of the NVIDIA kernel module. This requires that you have a linker installed on your system. The linker, usually /usr/bin/ld, is part of the binutils package. You must have a linker installed prior to installing the NVIDIA driver.

Features of the Installer

Without options, the .run file executes the installer after unpacking it. The installer can be run as a separate step in the process, or can be run at a later time to get updates, etc. Some of the more important commandline options of nvidia-installer are:

nvidia-installer options

--uninstall

During installation, the installer will make backups of any conflicting files and record the installation of new files. The uninstall option undoes an install, restoring the system to its pre-install state.

--latest

Connect to NVIDIA's FTP site, and report the latest driver version and the url to the latest driver file.

--update

Connect to NVIDIA's FTP site, download the most recent driver file, and install it.

--ui=none

The installer uses an ncurses-based user interface if it is able to locate the correct ncurses library. Otherwise, it will fall back to a simple commandline user interface. This option disables the use of the ncurses library.


如果觉得新驱动不好用,可以将/etc/modprobe.d/nvidia-installer-disable-nouveau.conf的confg后最改掉,就可以加载原来的驱动了。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值