All notes
Nvidia

Install driver

CentOS

// Re-generate /etc/X11/xorg.conf.
sudo nvidia-xconfig

Tecmint. ArchWiki.

yum groupinstall "Development Tools"
yum install kernel-devel kernel-headers dkms

# Before installing NVIDIA drivers, you need to know your driver product type by using following command.
lspci | grep -E "VGA|3D"
# On my ideapad y430p, there are two lines:
# 3:00:02.0 VGA compatible controller: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller (rev 06)
# 15:01:00.0 3D controller: NVIDIA Corporation GM107M [GeForce GTX 850M] (rev ff)
ArchWiki. Dynamic Kernel Module Support (DKMS) is a program/framework that enables generating Linux kernel modules whose sources generally reside outside the kernel source tree. The concept is to have DKMS modules automatically rebuilt when a new kernel is installed.

Bumblebee

bbswitch

Github. bbswitch is a kernel module which automatically detects the required ACPI calls for two kinds of Optimus laptops: real and legacy Optimus laptops.

DKMS support

If you have DKMS installed, you can install bbswitch in such a way that it survives kernel upgrades. It is recommended to remove older versions of bbswitch by running dkms remove -m bbswitch -v OLDVERSION --all as root. To install the new version, simply run:

make -f Makefile.dkms
To uninstall it, run:
make -f Makefile.dkms uninstall

# Get the status:
cat /proc/acpi/bbswitch  
# 0000:01:00.0 ON

# Turn the card off, respectively on:
tee /proc/acpi/bbswitch <<<OFF
tee /proc/acpi/bbswitch <<<ON

# If the card stays on when trying to disable it, you've probably forgotten to unload the driver,
dmesg |tail -1
# bbswitch: device 0000:01:00.0 is in use by driver 'nouveau', refusing OFF

NVIDIA Optimus

NVIDIA Optimus is a technology that allows an Intel integrated GPU and discrete NVIDIA GPU to be built into and accessed by a laptop.

ArchWiki. Installing Bumblebee with Intel/NVIDIA needs:

  1. Edit the file /usr/share/applications/nvidia-settings.desktop and change the Exec line to:
    Exec=optirun nvidia-settings -c :8.0
    
  2. Create a new group called bumblebee and add your user ID to it.
  3. chkconfig --add bumblebeed
  4. Edit /etc/bumblebee/bumblebee.conf file and make sure to set the following parameters:
    ServerGroup=bumblebee
    Driver=nvidia
    KernelDriver=nvidia
    Module=nvidia
    PMMethod=bbswitch
    LibraryPath=/usr/lib64/nvidia:/usr/lib64/vdpau:/usr/lib/nvidia:/usr/lib/vdpau
    XorgModulePath=/usr/lib64/xorg/nvidia,/usr/lib64/xorg/modules
    

CentOS. Needed:

Here are some repos for those tools: (wcf NOTE: it is outdated, install bumblebee from elrepo will install all)