Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
Linux Installation

Note: Due to the USB 3.0 translation layer between native hardware and virtual machine, the librealsense team does not recommend or support installation in a VM.

Install pre-built snap

Install librealsense in seconds on Ubuntu and other snap supported Linux distributions with:

snap install librealsense

Snaps contain all necessary dependencies required to run. The snap will get automatically updated when a new version is pushed to the store.

3rd-party dependencies

The project requires two external dependencies, glfw and libusb-1.0. The Cmake build environment additionally requires pkg-config.

Important Several scripts below invoke wget, git, add-apt-repository which may be blocked by router settings or a firewall. Infrequently, apt-get mirrors or repositories may also timeout. For librealsense users behind an enterprise firewall, configuring the system-wide Ubuntu proxy generally resolves most timeout issues.

Make Ubuntu Up-to-date

  1. Update Ubuntu distribution, including getting the latest stable kernel

    • sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade

    Check the kernel version - > uname -r
    In case of stack Ubuntu 14 LTS with Kernel prior to 4.4.0-04 (e.g. 3.19..) the basic apt-get upgrade rule is not sufficient to bring the distribution to the latest baseline recommended.
    Therefore, perform the following command to promote both Kernel and FrontEnd

    • sudo apt-get install --install-recommends linux-generic-lts-xenial xserver-xorg-core-lts-xenial xserver-xorg-lts-xenial xserver-xorg-video-all-lts-xenial xserver-xorg-input-all-lts-xenial libwayland-egl1-mesa-lts-xenial

    Note the exact Kernel version being installed (4.4.0-XX) for the next step.

    At the end update OS Boot Menu and reboot to enforce the correct kernel selection

    • sudo update-grub && sudo reboot

    Interrupt the boot process at Grub2 Boot Menu -> "Advanced Options for Ubuntu" -> Select the kernel version installed in the previous step.
    Complete the boot, login and verify that the required kernel version in place

    • uname -r >= 4.4.0-50
  2. Install the packages required for librealsense build:
    libusb-1.0 and pkg-config:

    • sudo apt-get install libusb-1.0-0-dev pkg-config.

    glfw3:
    For Ubuntu 14.04: use

    • ./scripts/install_glfw3.sh

    For Ubuntu 16.04 install glfw3 via

    • sudo apt-get install libglfw3-dev
  3. Library Build Process
    librealsense employs CMake as a cross-platform build and project management system. Navigate to librealsense root directory and run

    • mkdir build && cd build
      The default build is set to produce the core shared object and unit-tests binaries
    • cmake ../
      In order to build librealsense along with the demos and tutorials use
    • cmake ../ -DBUILD_EXAMPLES=true
      If you don't want to have build dependencies to OpenGL and X11, you can also
      build only the non-graphical examples:
    • cmake ../ -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=false

    Generate and install binaries:

    • make && sudo make install
      The library will be installed in /usr/local/lib, header files in /usr/local/include
      The demos, tutorials and tests will located in /usr/local/bin.
      Note: Linux build configuration is presently configured to use the V4L2 backend by default
  4. Install IDE (Optional): We use QtCreator as an IDE for Linux development on Ubuntu
    • Follow the link for QtCreator5 installation

Video4Linux backend preparation

Note: Running RealSense Depth Cameras on Linux requires applying patches to kernel modules.
Ensure no Intel RealSense cameras are presently plugged into the system.
Install udev rules located in librealsense source directory:

Install openssl package required for kernel module build:

Next, build the patched module for the desired machine configuration.

Check installation by examining the latest entries in kernel log:

Troubleshooting Installation and Patch-related Issues

Error Cause Correction Steps
git.launchpad... access timeout Behind Firewall Configure Proxy Server
dmesg:... uvcvideo: module verification failed: signature and/or required key missing - tainting kernel A standard warning issued since Kernel 4.4-30+ Notification only - does not affect module's functionality
sudo modprobe uvcvideo produces dmesg: uvc kernel module is not loaded The patched module kernel version is incompatible with the resident kernel Verify the actual kernel version with uname -r.
Revert and proceed on Make Ubuntu Up-to-date step
Execution of ./scripts/patch-video-formats-ubuntu-xenial.sh fails with fatal error: openssl/opensslv.h Missing Dependency Install openssl package from Video4Linux backend preparation step