Home >Operation and Maintenance >Linux Operation and Maintenance >How to install device driver in linux

How to install device driver in linux

王林
王林Original
2019-12-18 09:54:105063browse

How to install device driver in linux

Two ways to find the driver

1. User interface

If you have just transferred from Windows or MacOS For those of you who are new to Linux, you will be happy to know that Linux also provides a way to check whether the driver is available through a wizard-like process. Ubuntu provides an Additional Driver option. Other Linux distributions also provide helpers, like GNOME's package manager, that you can use to check whether a driver is available.

2. Command line

What should you do if you cannot find the driver through the beautiful user interface? Maybe you can only do it through a shell without any graphical interface? You can even use the console to show off your skills. You have two options:

1. Through a repository

This is very similar to the homebrew command line in MacOS. By using yum, dnf, apt-get, etc. You can basically add a repository and update the package cache.

2. Download, compile, and then build it yourself

This usually involves downloading the source code package directly from the network or through the wget command, and then running the configuration, compilation, and installation. This is beyond the scope of this article, but you can find many online guides on the web if you choose to go this route.

Online learning video tutorial sharing: linux video tutorial

Check whether this driver has been installed

Learn further Before installing the Linux driver, let's learn a few commands to check whether the driver is already available on your system.

The lspci command displays detailed information about all PCI bus and device drivers on the system.

$ lscpci

Or use grep:

$ lscpci | grep SOME_DRIVER_KEYWORD

For example, you can use the lspci | grep SAMSUNG command if you want to know whether the Samsung driver has been installed.

The dmesg command displays all drivers recognized by the kernel.

$ dmesg

Or use with grep:

$ dmesg | grep SOME_DRIVER_KEYWORD

Any identified driver will be displayed in the results.

If no driver is recognized through the dmesg or lscpi command, try these two commands to see if the driver is at least loaded to the hard disk.

$ /sbin/lsmod

and

$ find /lib/modules

Tip: As with lspci or dmesg, filter the results by adding | grep after the above command.

If a driver has been recognized but not found through lscpi or dmesg, it means that the driver already exists on the hard disk but has not been loaded into the kernel. In this case, You can load this module through the modprobe command.

$ sudo modprobe MODULE_NAME

Use sudo to run this command, because this module needs to be installed with root privileges.

Add a warehouse and install it

You can add a warehouse in several different ways through yum, dnf and apt-get; after introducing them one by one, they are not included in this article. scope. To put it simply, this example will use apt-get, but this command is very similar to the others.

1. Delete the existing repository, if it exists

$ sudo apt-get purge NAME_OF_DRIVER*

where NAME_OF_DRIVER is the possible name of your driver. You can also add pattern matching to regular expressions to further filter.

2. Add the warehouse to the warehouse table, which should be specified in the driver guide

$ sudo add-apt-repository REPOLIST_OF_DRIVER

Among them, REPOLIST_OF_DRIVER should be specified from the driver document (for example: epel-list).

3. Update the warehouse list

$ sudo apt-get update

4. Install the driver

$ sudo apt-get install NAME_OF_DRIVER

5. Check the installation status

As mentioned above, pass the lscpi command to check whether the driver has been installed successfully.

Recommended related articles and tutorials: linux tutorial

The above is the detailed content of How to install device driver in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn